fusions-ui 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/changelog.md +2 -0
- package/components/avatar/index.ts +1 -0
- package/components/avatar/src/avatar.ts +131 -0
- package/components/avatar/src/avatar.vue +104 -0
- package/components/avatar/src/composables/index.ts +1 -0
- package/components/avatar/src/composables/use-avatar.ts +61 -0
- package/components/avatar-group/index.ts +1 -0
- package/components/avatar-group/src/avatar-group.ts +86 -0
- package/components/{fu-avatar-group/fu-avatar-group.vue → avatar-group/src/avatar-group.vue} +27 -34
- package/components/avatar-group/src/composables/index.ts +1 -0
- package/components/avatar-group/src/composables/use-avatar-group.ts +17 -0
- package/components/badge/index.ts +1 -0
- package/components/badge/src/badge.ts +126 -0
- package/components/{fu-badge/fu-badge.vue → badge/src/badge.vue} +26 -62
- package/components/badge/src/composables/badge-custom.ts +51 -0
- package/components/badge/src/composables/index.ts +1 -0
- package/components/banner-arc/index.ts +1 -0
- package/components/banner-arc/src/banner-arc.ts +41 -0
- package/components/banner-arc/src/banner-arc.vue +49 -0
- package/components/banner-arc/src/composables/banner-arc-custom.ts +19 -0
- package/components/banner-arc/src/composables/index.ts +1 -0
- package/components/button/index.ts +1 -0
- package/components/button/src/button.ts +332 -0
- package/components/{fu-button/fu-button.vue → button/src/button.vue} +57 -163
- package/components/button/src/composables/button-custom.ts +90 -0
- package/components/button/src/composables/index.ts +2 -0
- package/components/button/src/composables/use-button.ts +137 -0
- package/components/cell/index.ts +1 -0
- package/components/cell/src/cell.ts +167 -0
- package/components/{fu-cell/fu-cell.vue → cell/src/cell.vue} +29 -38
- package/components/cell/src/composables/index.ts +1 -0
- package/components/cell/src/composables/use-cell.ts +20 -0
- package/components/cell-group/index.ts +1 -0
- package/components/cell-group/src/cell-group.ts +23 -0
- package/components/{fu-cell-group/fu-cell-group.vue → cell-group/src/cell-group.vue} +8 -13
- package/components/checkbox/index.ts +1 -0
- package/components/checkbox/src/checkbox.ts +144 -0
- package/components/checkbox/src/checkbox.vue +270 -0
- package/components/checkbox/src/composables/checkbox-custom.ts +15 -0
- package/components/checkbox/src/composables/index.ts +2 -0
- package/components/checkbox/src/composables/use-checkbox.ts +200 -0
- package/components/code-input/index.ts +1 -0
- package/components/code-input/src/code-input.ts +157 -0
- package/components/code-input/src/code-input.vue +158 -0
- package/components/code-input/src/composables/code-input-custom.ts +74 -0
- package/components/code-input/src/composables/index.ts +2 -0
- package/components/code-input/src/composables/use-code-input.ts +67 -0
- package/components/code-verify/index.ts +1 -0
- package/components/code-verify/src/code-verify.ts +160 -0
- package/components/code-verify/src/code-verify.vue +87 -0
- package/components/code-verify/src/composables/code-verify-custom.ts +23 -0
- package/components/code-verify/src/composables/index.ts +2 -0
- package/components/code-verify/src/composables/use-code-verify.ts +132 -0
- package/components/collapse/index.ts +1 -0
- package/components/collapse/src/collapse.ts +41 -0
- package/components/collapse/src/collapse.vue +48 -0
- package/components/collapse/src/composables/index.ts +1 -0
- package/components/collapse/src/composables/use-collapse.ts +150 -0
- package/components/collapse-item/index.ts +1 -0
- package/components/collapse-item/src/collapse-item.ts +102 -0
- package/components/{fu-collapse-item/fu-collapse-item.vue → collapse-item/src/collapse-item.vue} +20 -159
- package/components/collapse-item/src/composables/index.ts +1 -0
- package/components/collapse-item/src/composables/use-collapse-item.ts +139 -0
- package/components/countdown/index.ts +1 -0
- package/components/countdown/src/composables/index.ts +1 -0
- package/components/countdown/src/composables/use-countdown.ts +133 -0
- package/components/countdown/src/countdown.ts +63 -0
- package/components/countdown/src/countdown.vue +60 -0
- package/components/{fu-countdown/util.js → countdown/src/util.ts} +5 -5
- package/components/datetime-picker/index.ts +1 -0
- package/components/datetime-picker/src/composables/index.ts +1 -0
- package/components/datetime-picker/src/composables/use-datetime-picker.ts +325 -0
- package/components/datetime-picker/src/datetime-picker.ts +223 -0
- package/components/datetime-picker/src/datetime-picker.vue +96 -0
- package/components/form/index.ts +1 -0
- package/components/form/src/composables/index.ts +1 -0
- package/components/form/src/composables/use-form.ts +256 -0
- package/components/form/src/form.ts +108 -0
- package/components/form/src/form.vue +64 -0
- package/components/{fu-form/utils.js → form/src/utils.ts} +49 -42
- package/components/{fu-form/validate.js → form/src/validate.ts} +58 -49
- package/components/form-item/index.ts +1 -0
- package/components/form-item/src/composables/index.ts +1 -0
- package/components/form-item/src/composables/use-form-item.ts +292 -0
- package/components/form-item/src/form-item.ts +81 -0
- package/components/form-item/src/form-item.vue +229 -0
- package/components/fusions-ui/src/fusions-ui.vue +8 -0
- package/components/grid/index.ts +1 -0
- package/components/grid/src/composables/index.ts +1 -0
- package/components/grid/src/composables/use-grid.ts +67 -0
- package/components/grid/src/grid.ts +54 -0
- package/components/grid/src/grid.vue +69 -0
- package/components/grid-item/index.ts +1 -0
- package/components/grid-item/src/composables/grid-item-custom.ts +16 -0
- package/components/grid-item/src/composables/index.ts +2 -0
- package/components/grid-item/src/composables/use-grid-item.ts +55 -0
- package/components/grid-item/src/grid-item.ts +15 -0
- package/components/grid-item/src/grid-item.vue +102 -0
- package/components/icon/index.ts +1 -0
- package/components/icon/src/composables/icon-custom.ts +41 -0
- package/components/icon/src/composables/index.ts +2 -0
- package/components/icon/src/composables/use-icon.ts +14 -0
- package/components/{fu-icon → icon/src}/fuicon.css +584 -584
- package/components/icon/src/fuicon.ts +1023 -0
- package/components/icon/src/icon.ts +84 -0
- package/components/icon/src/icon.vue +92 -0
- package/components/image/index.ts +1 -0
- package/components/image/src/composables/image-custom.ts +36 -0
- package/components/image/src/composables/index.ts +2 -0
- package/components/image/src/composables/use-image.ts +135 -0
- package/components/image/src/image.ts +185 -0
- package/components/image/src/image.vue +152 -0
- package/components/index-anchor/index.ts +1 -0
- package/components/index-anchor/src/composables/index.ts +1 -0
- package/components/index-anchor/src/composables/use-index-anchor.ts +44 -0
- package/components/index-anchor/src/index-anchor.ts +45 -0
- package/components/index-anchor/src/index-anchor.vue +60 -0
- package/components/index-item/index.ts +1 -0
- package/components/index-item/src/composables/index.ts +1 -0
- package/components/index-item/src/composables/use-index-item.ts +75 -0
- package/components/index-item/src/index-item.ts +13 -0
- package/components/index-item/src/index-item.vue +32 -0
- package/components/index-list/index.ts +1 -0
- package/components/index-list/src/composables/index.ts +1 -0
- package/components/index-list/src/composables/use-index-list.ts +297 -0
- package/components/index-list/src/index-list.ts +52 -0
- package/components/index-list/src/index-list.vue +178 -0
- package/components/index.ts +62 -0
- package/components/input/index.ts +1 -0
- package/components/input/src/composables/index.ts +2 -0
- package/components/input/src/composables/input-custom.ts +69 -0
- package/components/input/src/composables/use-input.ts +117 -0
- package/components/input/src/input.ts +360 -0
- package/components/input/src/input.vue +241 -0
- package/components/keyboard/index.ts +1 -0
- package/components/keyboard/src/composables/index.ts +3 -0
- package/components/keyboard/src/composables/use-keyboard-car.ts +99 -0
- package/components/keyboard/src/composables/use-keyboard-number.ts +81 -0
- package/components/keyboard/src/composables/use-keyboard.ts +61 -0
- package/components/keyboard/src/keyboard-car.ts +53 -0
- package/components/{fu-keyboard → keyboard/src}/keyboard-car.vue +37 -199
- package/components/keyboard/src/keyboard-number.ts +44 -0
- package/components/keyboard/src/keyboard-number.vue +108 -0
- package/components/keyboard/src/keyboard.ts +174 -0
- package/components/{fu-keyboard/fu-keyboard.vue → keyboard/src/keyboard.vue} +38 -63
- package/components/line/index.ts +1 -0
- package/components/line/src/composables/index.ts +1 -0
- package/components/line/src/composables/line-custom.ts +30 -0
- package/components/line/src/line.ts +82 -0
- package/components/line/src/line.vue +44 -0
- package/components/link/index.ts +1 -0
- package/components/link/src/composables/index.ts +2 -0
- package/components/link/src/composables/link-custom.ts +19 -0
- package/components/link/src/composables/use-link.ts +33 -0
- package/components/link/src/link.ts +61 -0
- package/components/link/src/link.vue +62 -0
- package/components/loading/index.ts +1 -0
- package/{libs/function/colorGradient.js → components/loading/src/composables/colorGradient.ts} +4 -4
- package/components/loading/src/composables/index.ts +2 -0
- package/components/loading/src/composables/loading-custom.ts +21 -0
- package/components/loading/src/composables/use-loading.ts +100 -0
- package/components/loading/src/loading.ts +77 -0
- package/components/{fu-loading/fu-loading.vue → loading/src/loading.vue} +23 -119
- package/components/loading-more/index.ts +1 -0
- package/components/loading-more/src/loading-more.ts +75 -0
- package/components/{fu-loading-more/fu-loading-more.vue → loading-more/src/loading-more.vue} +18 -19
- package/components/modal/index.ts +1 -0
- package/components/modal/src/composables/index.ts +2 -0
- package/components/modal/src/composables/modal-custom.ts +17 -0
- package/components/modal/src/composables/use-modal.ts +56 -0
- package/components/modal/src/modal.ts +152 -0
- package/components/{fu-modal/fu-modal.vue → modal/src/modal.vue} +41 -69
- package/components/navbar/index.ts +1 -0
- package/components/navbar/src/composables/index.ts +2 -0
- package/components/navbar/src/composables/navbar-custom.ts +62 -0
- package/components/navbar/src/composables/use-navbar.ts +42 -0
- package/components/navbar/src/navbar.ts +151 -0
- package/components/navbar/src/navbar.vue +249 -0
- package/components/notice-bar/index.ts +3 -0
- package/components/notice-bar/src/composables/index.ts +5 -0
- package/components/notice-bar/src/composables/notice-column-custom.ts +43 -0
- package/components/notice-bar/src/composables/notice-row-custom.ts +26 -0
- package/components/notice-bar/src/composables/use-notice-bar.ts +34 -0
- package/components/notice-bar/src/composables/use-notice-column.ts +31 -0
- package/components/notice-bar/src/composables/use-notice-row.ts +88 -0
- package/components/notice-bar/src/notice-bar.ts +197 -0
- package/components/{fu-notice-bar/fu-notice-bar.vue → notice-bar/src/notice-bar.vue} +28 -41
- package/components/notice-bar/src/notice-column.ts +172 -0
- package/components/notice-bar/src/notice-column.vue +129 -0
- package/components/notice-bar/src/notice-row.ts +155 -0
- package/components/notice-bar/src/notice-row.vue +135 -0
- package/components/number-box/index.ts +1 -0
- package/components/number-box/src/composables/index.ts +2 -0
- package/components/number-box/src/composables/number-box-custom.ts +16 -0
- package/components/number-box/src/composables/use-number-box.ts +84 -0
- package/components/number-box/src/number-box.ts +98 -0
- package/components/number-box/src/number-box.vue +123 -0
- package/components/parse/index.ts +1 -0
- package/components/parse/src/app-plus/html/js/handler.js +254 -0
- package/components/parse/src/app-plus/html/js/uni.webview.min.js +188 -0
- package/components/parse/src/app-plus/html/local.html +32 -0
- package/components/parse/src/composables/index.ts +1 -0
- package/components/parse/src/composables/use-parse.ts +428 -0
- package/components/parse/src/node/node.vue +635 -0
- package/components/parse/src/parse.ts +156 -0
- package/components/parse/src/parse.vue +131 -0
- package/components/parse/src/parser.ts +1402 -0
- package/components/picker/index.ts +1 -0
- package/components/picker/src/composables/index.ts +2 -0
- package/components/picker/src/composables/picker-custom.ts +40 -0
- package/components/picker/src/composables/use-picker.ts +179 -0
- package/components/picker/src/picker.ts +172 -0
- package/components/picker/src/picker.vue +197 -0
- package/components/popup/index.ts +1 -0
- package/components/popup/src/composables/index.ts +1 -0
- package/components/popup/src/composables/use-popup.ts +346 -0
- package/components/popup/src/keypress.ts +55 -0
- package/components/popup/src/popup.ts +101 -0
- package/components/popup/src/popup.vue +204 -0
- package/components/progress/index.ts +1 -0
- package/components/progress/src/composables/index.ts +2 -0
- package/components/progress/src/composables/progress-custom.ts +24 -0
- package/components/progress/src/composables/use-progress.ts +159 -0
- package/components/progress/src/progress.ts +84 -0
- package/components/progress/src/progress.vue +150 -0
- package/components/rate/index.ts +1 -0
- package/components/rate/src/composables/index.ts +1 -0
- package/components/rate/src/composables/use-rate.ts +196 -0
- package/components/rate/src/rate.ts +114 -0
- package/components/rate/src/rate.vue +113 -0
- package/components/read-more/index.ts +1 -0
- package/components/read-more/src/composables/index.ts +2 -0
- package/components/read-more/src/composables/read-more-custom.ts +46 -0
- package/components/read-more/src/composables/use-read-more.ts +72 -0
- package/components/read-more/src/read-more.ts +102 -0
- package/components/read-more/src/read-more.vue +104 -0
- package/components/safe-bottom/index.ts +1 -0
- package/components/safe-bottom/src/composables/index.ts +2 -0
- package/components/safe-bottom/src/composables/safe-bottom-custom.ts +18 -0
- package/components/safe-bottom/src/composables/use-safe-bottom.ts +17 -0
- package/components/safe-bottom/src/safe-bottom.ts +8 -0
- package/components/safe-bottom/src/safe-bottom.vue +43 -0
- package/components/scroll-list/index.ts +1 -0
- package/components/scroll-list/src/composables/index.ts +2 -0
- package/components/scroll-list/src/composables/scroll-list-custom.ts +41 -0
- package/components/scroll-list/src/composables/use-scroll-list.ts +126 -0
- package/components/scroll-list/src/scroll-list.ts +57 -0
- package/components/scroll-list/src/scroll-list.vue +143 -0
- package/components/{fu-scroll-list/scrollWxs.wxs → scroll-list/src/scroll-wxs.wxs} +2 -2
- package/components/search/index.ts +1 -0
- package/components/search/src/composables/index.ts +2 -0
- package/components/search/src/composables/search-custom.ts +25 -0
- package/components/search/src/composables/use-search.ts +106 -0
- package/components/search/src/search.ts +186 -0
- package/components/{fu-search/fu-search.vue → search/src/search.vue} +42 -154
- package/components/section/index.ts +1 -0
- package/components/section/src/composables/index.ts +1 -0
- package/components/section/src/composables/use-section.ts +19 -0
- package/components/section/src/section.ts +83 -0
- package/components/{fu-section/fu-section.vue → section/src/section.vue} +36 -35
- package/components/sign-board/index.ts +1 -0
- package/components/sign-board/src/composables/index.ts +1 -0
- package/components/sign-board/src/composables/use-sign-board.ts +552 -0
- package/components/sign-board/src/sign-board.ts +48 -0
- package/components/sign-board/src/sign-board.vue +191 -0
- package/components/skeleton/index.ts +1 -0
- package/components/skeleton/src/composables/index.ts +2 -0
- package/components/skeleton/src/composables/skeleton-custom.ts +23 -0
- package/components/skeleton/src/composables/use-skeleton.ts +102 -0
- package/components/skeleton/src/skeleton.ts +37 -0
- package/components/skeleton/src/skeleton.vue +147 -0
- package/components/status-bar/src/composables/index.ts +1 -0
- package/components/status-bar/src/composables/use-status-bar.ts +29 -0
- package/components/status-bar/src/status-bar.vue +21 -0
- package/components/steps/index.ts +1 -0
- package/components/steps/src/composables/index.ts +1 -0
- package/components/steps/src/composables/use-steps.ts +27 -0
- package/components/steps/src/steps.ts +65 -0
- package/components/steps/src/steps.vue +46 -0
- package/components/steps-item/index.ts +1 -0
- package/components/steps-item/src/composables/index.ts +2 -0
- package/components/steps-item/src/composables/steps-item-custom.ts +81 -0
- package/components/steps-item/src/composables/use-steps-item.ts +87 -0
- package/components/steps-item/src/steps-item.ts +38 -0
- package/components/steps-item/src/steps-item.vue +224 -0
- package/components/sticky/index.ts +1 -0
- package/components/sticky/src/composables/index.ts +2 -0
- package/components/sticky/src/composables/sticky-custom.ts +57 -0
- package/components/sticky/src/composables/use-sticky.ts +152 -0
- package/components/sticky/src/sticky.ts +62 -0
- package/components/sticky/src/sticky.vue +65 -0
- package/components/subsection/index.ts +1 -0
- package/components/subsection/src/composables/index.ts +2 -0
- package/components/subsection/src/composables/subsection-custom.ts +71 -0
- package/components/subsection/src/composables/use-subsection.ts +85 -0
- package/components/subsection/src/subsection.ts +107 -0
- package/components/subsection/src/subsection.vue +165 -0
- package/components/swipe-action/src/composables/index.ts +1 -0
- package/components/swipe-action/src/composables/use-swipe-action.ts +58 -0
- package/components/swipe-action/src/swipe-action.vue +81 -0
- package/components/swipe-action-item/index.ts +1 -0
- package/components/{fu-swipe-action-item/mpwxs.js → swipe-action-item/src/mpwxs.ts} +22 -27
- package/components/swipe-action-item/src/swipe-action-item.ts +68 -0
- package/components/{fu-swipe-action-item/fu-swipe-action-item.vue → swipe-action-item/src/swipe-action-item.vue} +24 -17
- package/components/{fu-swipe-action-item → swipe-action-item/src}/wx.wxs +2 -2
- package/components/swiper/index.ts +1 -0
- package/components/swiper/src/composables/index.ts +2 -0
- package/components/swiper/src/composables/swiper-custom.ts +40 -0
- package/components/swiper/src/composables/use-swiper.ts +75 -0
- package/components/swiper/src/swiper.ts +189 -0
- package/components/{fu-swiper/fu-swiper.vue → swiper/src/swiper.vue} +49 -118
- package/components/switch/index.ts +1 -0
- package/components/switch/src/composables/index.ts +2 -0
- package/components/switch/src/composables/switch-custom.ts +32 -0
- package/components/switch/src/composables/use-switch.ts +38 -0
- package/components/switch/src/switch.ts +115 -0
- package/components/{fu-switch/fu-switch.vue → switch/src/switch.vue} +25 -73
- package/components/tabs/index.ts +1 -0
- package/components/tabs/src/composables/index.ts +2 -0
- package/components/tabs/src/composables/tabs-custom.ts +43 -0
- package/components/tabs/src/composables/use-tabs.ts +210 -0
- package/components/tabs/src/tabs.ts +123 -0
- package/components/tabs/src/tabs.vue +153 -0
- package/components/tag/index.ts +1 -0
- package/components/tag/src/composables/index.ts +2 -0
- package/components/tag/src/composables/tag-custom.ts +61 -0
- package/components/tag/src/composables/use-tag.ts +23 -0
- package/components/tag/src/tag.ts +159 -0
- package/components/{fu-tag/fu-tag.vue → tag/src/tag.vue} +53 -93
- package/components/text/index.ts +1 -0
- package/components/text/src/composables/index.ts +2 -0
- package/components/text/src/composables/text-custom.ts +120 -0
- package/components/text/src/composables/use-text.ts +83 -0
- package/components/text/src/text.ts +261 -0
- package/components/text/src/text.vue +186 -0
- package/components/textarea/index.ts +1 -0
- package/components/textarea/src/composables/index.ts +2 -0
- package/components/textarea/src/composables/textarea-custom.ts +50 -0
- package/components/textarea/src/composables/use-textarea.ts +88 -0
- package/components/textarea/src/textarea.ts +250 -0
- package/components/textarea/src/textarea.vue +162 -0
- package/components/{fu-timeaxis/fu-timeaxis.vue → timeaxis/src/timeaxis.vue} +3 -9
- package/components/timeaxis-item/index.ts +1 -0
- package/components/timeaxis-item/src/timeaxis-item.ts +20 -0
- package/components/timeaxis-item/src/timeaxis-item.vue +50 -0
- package/components/transition/index.ts +1 -0
- package/components/transition/src/composables/createAnimation.ts +171 -0
- package/components/transition/src/composables/index.ts +2 -0
- package/components/transition/src/composables/transform-custom.ts +18 -0
- package/components/transition/src/composables/use-transition.ts +251 -0
- package/components/transition/src/transition.ts +64 -0
- package/components/transition/src/transition.vue +70 -0
- package/components/upload/index.ts +1 -0
- package/components/upload/src/composables/index.ts +5 -0
- package/components/upload/src/composables/upload-file-custom.ts +68 -0
- package/components/upload/src/composables/upload-image-custom.ts +76 -0
- package/components/upload/src/composables/use-upload-file.ts +27 -0
- package/components/upload/src/composables/use-upload-image.ts +38 -0
- package/components/upload/src/composables/use-upload.ts +388 -0
- package/components/upload/src/upload-file.ts +84 -0
- package/components/upload/src/upload-file.vue +193 -0
- package/components/upload/src/upload-image.ts +90 -0
- package/components/upload/src/upload-image.vue +158 -0
- package/components/upload/src/upload.ts +196 -0
- package/components/upload/src/upload.vue +151 -0
- package/components/{fu-upload/utils.js → upload/src/utils.ts} +12 -12
- package/components/vtabs/index.ts +1 -0
- package/components/vtabs/src/composables/index.ts +2 -0
- package/components/vtabs/src/composables/use-vtabs.ts +276 -0
- package/components/vtabs/src/composables/vtabs-custom.ts +54 -0
- package/components/vtabs/src/vtabs.ts +130 -0
- package/components/vtabs/src/vtabs.vue +189 -0
- package/components/vtabs-item/index.ts +1 -0
- package/components/vtabs-item/src/composables/index.ts +1 -0
- package/components/vtabs-item/src/composables/use-vtabs-item.ts +60 -0
- package/components/vtabs-item/src/vtabs-item.ts +10 -0
- package/components/vtabs-item/src/vtabs-item.vue +20 -0
- package/components/waterfall/index.ts +1 -0
- package/components/waterfall/src/composables/index.ts +2 -0
- package/components/waterfall/src/composables/use-waterfall.ts +139 -0
- package/components/waterfall/src/composables/waterfall-custom.ts +18 -0
- package/components/waterfall/src/waterfall.ts +114 -0
- package/components/waterfall/src/waterfall.vue +104 -0
- package/{libs/config/config.js → config/config.ts} +13 -7
- package/constants/images.ts +18 -0
- package/constants/index.ts +6 -0
- package/constants/open-types.ts +33 -0
- package/constants/props.ts +18 -0
- package/constants/shapes.ts +6 -0
- package/constants/types.ts +10 -0
- package/constants/z-index.ts +27 -0
- package/global.d.ts +103 -0
- package/hooks/index.ts +25 -0
- package/index.scss +3 -5
- package/index.ts +56 -0
- package/package.json +12 -5
- package/{libs/route/min.route.config.js → route/min.route.config.ts} +62 -23
- package/route/route.config.ts +93 -0
- package/style/color.scss +26 -0
- package/{libs/style → style}/common.scss +1 -14
- package/{libs/function/applyEven.js → utils/applyEven.ts} +21 -12
- package/utils/check.ts +276 -0
- package/{libs/function/chooseUploadFile.js → utils/chooseUploadFile.ts} +22 -26
- package/utils/common.ts +609 -0
- package/{libs/function/digit.js → utils/digit.ts} +63 -33
- package/{components/fu-swipe-action-item/isPC.js → utils/isPC.ts} +1 -1
- package/utils/toast.ts +42 -0
- package/components/fu-avatar/fu-avatar.vue +0 -157
- package/components/fu-avatar/props.js +0 -117
- package/components/fu-avatar-group/props.js +0 -74
- package/components/fu-badge/props.js +0 -112
- package/components/fu-banner-arc/fu-banner-arc.vue +0 -58
- package/components/fu-banner-arc/props.js +0 -35
- package/components/fu-button/props.js +0 -228
- package/components/fu-cell/props.js +0 -108
- package/components/fu-cell-group/props.js +0 -19
- package/components/fu-checkbox/fu-checkbox.vue +0 -469
- package/components/fu-checkbox/props.js +0 -126
- package/components/fu-code-input/fu-code-input.vue +0 -269
- package/components/fu-code-input/props.js +0 -136
- package/components/fu-code-verify/fu-code-verify.vue +0 -221
- package/components/fu-code-verify/props.js +0 -136
- package/components/fu-collapse/fu-collapse.vue +0 -143
- package/components/fu-collapse/props.js +0 -29
- package/components/fu-collapse-item/props.js +0 -101
- package/components/fu-countdown/fu-countdown.vue +0 -164
- package/components/fu-countdown/props.js +0 -35
- package/components/fu-datetime-picker/fu-datetime-picker.vue +0 -375
- package/components/fu-datetime-picker/props.js +0 -194
- package/components/fu-form/fu-form.vue +0 -284
- package/components/fu-form/props.js +0 -74
- package/components/fu-form-item/fu-form-item.vue +0 -535
- package/components/fu-form-item/props.js +0 -66
- package/components/fu-grid/fu-grid.vue +0 -113
- package/components/fu-grid/props.js +0 -44
- package/components/fu-grid-item/fu-grid-item.vue +0 -136
- package/components/fu-grid-item/props.js +0 -27
- package/components/fu-icon/fu-icon.vue +0 -110
- package/components/fu-icon/fuicon.js +0 -1031
- package/components/fu-icon/props.js +0 -55
- package/components/fu-image/fu-image.vue +0 -268
- package/components/fu-image/props.js +0 -145
- package/components/fu-index-anchor/fu-index-anchor.vue +0 -91
- package/components/fu-index-anchor/props.js +0 -43
- package/components/fu-index-item/fu-index-item.vue +0 -79
- package/components/fu-index-list/fu-index-list.vue +0 -426
- package/components/fu-index-list/props.js +0 -42
- package/components/fu-input/fu-input.vue +0 -393
- package/components/fu-input/props.js +0 -291
- package/components/fu-keyboard/keyboard-number.vue +0 -195
- package/components/fu-keyboard/props.js +0 -138
- package/components/fu-line/fu-line.vue +0 -64
- package/components/fu-line/props.js +0 -58
- package/components/fu-link/fu-link.vue +0 -91
- package/components/fu-link/props.js +0 -49
- package/components/fu-loading/props.js +0 -60
- package/components/fu-loading-more/props.js +0 -59
- package/components/fu-modal/props.js +0 -128
- package/components/fu-navbar/fu-navbar.vue +0 -271
- package/components/fu-navbar/props.js +0 -72
- package/components/fu-navbar/status-bar.vue +0 -27
- package/components/fu-notice-bar/notice-column.vue +0 -313
- package/components/fu-notice-bar/notice-row.vue +0 -363
- package/components/fu-notice-bar/props.js +0 -173
- package/components/fu-number-box/fu-number-box.vue +0 -210
- package/components/fu-number-box/props.js +0 -79
- package/components/fu-parse/fu-parse.vue +0 -508
- package/components/fu-parse/node/node.vue +0 -576
- package/components/fu-parse/parser.js +0 -1335
- package/components/fu-picker/fu-picker.vue +0 -347
- package/components/fu-picker/props.js +0 -150
- package/components/fu-popup/fu-popup.vue +0 -475
- package/components/fu-popup/keypress.js +0 -45
- package/components/fu-popup/props.js +0 -83
- package/components/fu-progress/fu-progress.vue +0 -292
- package/components/fu-progress/props.js +0 -76
- package/components/fu-rate/fu-rate.vue +0 -301
- package/components/fu-rate/props.js +0 -103
- package/components/fu-read-more/fu-read-more.vue +0 -191
- package/components/fu-read-more/props.js +0 -72
- package/components/fu-ribbon/fu-ribbon.vue +0 -106
- package/components/fu-ribbon/props.js +0 -35
- package/components/fu-safe-area/fu-safe-area.vue +0 -61
- package/components/fu-scroll-list/fu-scroll-list.vue +0 -196
- package/components/fu-scroll-list/nvue.js +0 -28
- package/components/fu-scroll-list/props.js +0 -43
- package/components/fu-search/props.js +0 -149
- package/components/fu-section/props.js +0 -59
- package/components/fu-sign-board/fu-sign-board.vue +0 -730
- package/components/fu-sign-board/props.js +0 -34
- package/components/fu-skeleton/fu-skeleton.vue +0 -238
- package/components/fu-skeleton/props.js +0 -35
- package/components/fu-steps/fu-steps.vue +0 -81
- package/components/fu-steps/props.js +0 -55
- package/components/fu-steps-item/fu-steps-item.vue +0 -274
- package/components/fu-steps-item/props.js +0 -34
- package/components/fu-sticky/fu-sticky.vue +0 -232
- package/components/fu-sticky/props.js +0 -54
- package/components/fu-subsection/fu-subsection.vue +0 -288
- package/components/fu-subsection/props.js +0 -88
- package/components/fu-swipe-action/fu-swipe-action.vue +0 -64
- package/components/fu-swipe-action-item/props.js +0 -54
- package/components/fu-swiper/props.js +0 -163
- package/components/fu-switch/props.js +0 -102
- package/components/fu-tabs/fu-tabs.vue +0 -361
- package/components/fu-tabs/props.js +0 -109
- package/components/fu-tag/props.js +0 -135
- package/components/fu-text/button.js +0 -13
- package/components/fu-text/fu-text.vue +0 -254
- package/components/fu-text/openType.js +0 -47
- package/components/fu-text/props.js +0 -173
- package/components/fu-text/value.js +0 -88
- package/components/fu-textarea/fu-textarea.vue +0 -288
- package/components/fu-textarea/props.js +0 -206
- package/components/fu-timeaxis-item/fu-timeaxis-item.vue +0 -68
- package/components/fu-transition/createAnimation.js +0 -131
- package/components/fu-transition/fu-transition.vue +0 -292
- package/components/fu-transition/props.js +0 -21
- package/components/fu-upload/fu-upload.vue +0 -563
- package/components/fu-upload/props.js +0 -171
- package/components/fu-upload/upload-file.vue +0 -332
- package/components/fu-upload/upload-image.vue +0 -304
- package/components/fu-vtabs/fu-vtabs.vue +0 -443
- package/components/fu-vtabs/props.js +0 -114
- package/components/fu-vtabs-item/fu-vtabs-item.vue +0 -71
- package/components/fu-waterfall/fu-waterfall.vue +0 -238
- package/components/fu-waterfall/props.js +0 -85
- package/index.js +0 -71
- package/libs/function/check.js +0 -215
- package/libs/function/common.js +0 -527
- package/libs/function/message.js +0 -47
- package/libs/mixin/button.js +0 -85
- package/libs/mixin/mixin.js +0 -94
- package/libs/mixin/mpMixin.js +0 -8
- package/libs/mixin/mpShare.js +0 -15
- package/libs/route/route.config.js +0 -66
- package/libs/style/color.scss +0 -24
- /package/components/{fu-icon → icon/src}/fuicon.ttf +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/bindingx.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/mpalipay.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/mpother.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/render.js +0 -0
- /package/{libs/style → style}/components.scss +0 -0
- /package/{libs/style → style}/style.h5.scss +0 -0
- /package/{libs/style → style}/style.mp.scss +0 -0
- /package/{libs/function → utils}/dayjs.js +0 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { ref, computed, type SetupContext, watch, onMounted } from 'vue';
|
|
2
|
+
import type { DatetimePickerProps, DatetimePickerEmits } from '../datetime-picker';
|
|
3
|
+
import dayjs from '../../../../utils/dayjs.js';
|
|
4
|
+
function times(n: number, iteratee: (index: number) => any): any[] {
|
|
5
|
+
let index = -1
|
|
6
|
+
const result = Array(n < 0 ? 0 : n)
|
|
7
|
+
while (++index < n) {
|
|
8
|
+
result[index] = iteratee(index)
|
|
9
|
+
}
|
|
10
|
+
return result
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useDatetimePicker = (props : DatetimePickerProps, $emit : SetupContext<DatetimePickerEmits>['emit']) => {
|
|
14
|
+
const pickerRef = ref();
|
|
15
|
+
const columns = ref<any[]>([]);
|
|
16
|
+
const innerDefaultIndex = ref<number[]>([]);
|
|
17
|
+
const innerValue = ref<string | number>(0);
|
|
18
|
+
const innerFormatter = ref<(type : string, value : string) => string>((type, value) => value);
|
|
19
|
+
|
|
20
|
+
// 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
|
|
21
|
+
const propsChange = computed(() => {
|
|
22
|
+
return [
|
|
23
|
+
props.mode,
|
|
24
|
+
props.maxDate,
|
|
25
|
+
props.minDate,
|
|
26
|
+
props.minHour,
|
|
27
|
+
props.maxHour,
|
|
28
|
+
props.minMinute,
|
|
29
|
+
props.maxMinute,
|
|
30
|
+
props.filter,
|
|
31
|
+
props.modelValue
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 得出合法的时间
|
|
36
|
+
const correctValue = (value: string | number): string | number => {
|
|
37
|
+
const isDateMode = props.mode !== 'time';
|
|
38
|
+
if (isDateMode && !uni.$fu.checkDate(value)) {
|
|
39
|
+
// 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间
|
|
40
|
+
value = props.minDate;
|
|
41
|
+
} else if (!isDateMode && !value) {
|
|
42
|
+
// 如果是时间类型,而又没有默认值的话,就用最小时间
|
|
43
|
+
value = `${uni.$fu.padZero(props.minHour)}:${uni.$fu.padZero(props.minMinute)}`;
|
|
44
|
+
}
|
|
45
|
+
// 时间类型
|
|
46
|
+
if (!isDateMode) {
|
|
47
|
+
if (String(value).indexOf(':') === -1) return uni.$fu.error('时间错误,请传递如12:24的格式')
|
|
48
|
+
let [hour, minute] = value.split(':');
|
|
49
|
+
// 对时间补零,同时控制在最小值和最大值之间
|
|
50
|
+
hour = uni.$fu.padZero(uni.$fu.range(props.minHour, props.maxHour, Number(hour)));
|
|
51
|
+
minute = uni.$fu.padZero(uni.$fu.range(props.minMinute, props.maxMinute, Number(minute)));
|
|
52
|
+
return `${hour}:${minute}`
|
|
53
|
+
} else {
|
|
54
|
+
// 如果是日期格式,控制在最小日期和最大日期之间
|
|
55
|
+
value = dayjs(value).isBefore(dayjs(props.minDate)) ? props.minDate : value;
|
|
56
|
+
value = dayjs(value).isAfter(dayjs(props.maxDate)) ? props.maxDate : value;
|
|
57
|
+
return value
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// 获取每列的最大和最小值
|
|
62
|
+
const getRanges = () => {
|
|
63
|
+
if (props.mode === 'time') {
|
|
64
|
+
return [
|
|
65
|
+
{ type: 'hour', range: [props.minHour, props.maxHour] },
|
|
66
|
+
{ type: 'minute', range: [props.minMinute, props.maxMinute] },
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, } = getBoundary('max', innerValue.value);
|
|
70
|
+
const { minYear, minDate, minMonth, minHour, minMinute, } = getBoundary('min', innerValue.value);
|
|
71
|
+
const result = [
|
|
72
|
+
{ type: 'year', range: [minYear, maxYear] },
|
|
73
|
+
{ type: 'month', range: [minMonth, maxMonth] },
|
|
74
|
+
{ type: 'day', range: [minDate, maxDate] },
|
|
75
|
+
{ type: 'hour', range: [minHour, maxHour] },
|
|
76
|
+
{ type: 'minute', range: [minMinute, maxMinute] },
|
|
77
|
+
];
|
|
78
|
+
if (props.mode === 'date') result.splice(3, 2);
|
|
79
|
+
if (props.mode === 'year') result.splice(1, 4);
|
|
80
|
+
if (props.mode === 'year-month') result.splice(2, 3);
|
|
81
|
+
return result;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// 获取原始列数据
|
|
85
|
+
const getOriginColumns = () => {
|
|
86
|
+
// 生成各列的值
|
|
87
|
+
const results = getRanges().map(({ type, range }) => {
|
|
88
|
+
let values = times(range[1] - range[0] + 1, (index) => {
|
|
89
|
+
let value = range[0] + index
|
|
90
|
+
value = type === 'year' ? `${value}` : uni.$fu.padZero(value)
|
|
91
|
+
return value
|
|
92
|
+
});
|
|
93
|
+
// 进行过滤
|
|
94
|
+
if (props.filter) {
|
|
95
|
+
values = props.filter(type, values);
|
|
96
|
+
}
|
|
97
|
+
return { type, values }
|
|
98
|
+
});
|
|
99
|
+
return results
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// 更新各列的值
|
|
103
|
+
const updateColumns = () => {
|
|
104
|
+
const formatter = props.formatter || innerFormatter.value;
|
|
105
|
+
// 获取各列的值,并且map后,对各列的具体值进行补0操作
|
|
106
|
+
const results = getOriginColumns().map((column) => column.values.map((value : string) => formatter(column.type, value)));
|
|
107
|
+
columns.value = results;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// 更新索引
|
|
111
|
+
const updateIndexs = (value : string | number) => {
|
|
112
|
+
let values = [];
|
|
113
|
+
const formatter = props.formatter || innerFormatter.value;
|
|
114
|
+
const padZero = uni.$fu.padZero;
|
|
115
|
+
if (props.mode === 'time') {
|
|
116
|
+
// 将time模式的时间用:分隔成数组
|
|
117
|
+
const timeArr = (value as string).split(':');
|
|
118
|
+
// 使用formatter格式化方法进行管道处理
|
|
119
|
+
values = [formatter('hour', timeArr[0]), formatter('minute', timeArr[1])];
|
|
120
|
+
} else {
|
|
121
|
+
values = [
|
|
122
|
+
formatter('year', `${dayjs(value).year()}`),
|
|
123
|
+
// 月份补0
|
|
124
|
+
formatter('month', padZero(dayjs(value).month() + 1))
|
|
125
|
+
];
|
|
126
|
+
if (props.mode === 'date') {
|
|
127
|
+
// date模式,需要添加天列
|
|
128
|
+
values.push(formatter('day', padZero(dayjs(value).date())))
|
|
129
|
+
}
|
|
130
|
+
if (props.mode === 'datetime') {
|
|
131
|
+
// 数组的push方法,可以写入多个参数
|
|
132
|
+
values.push(formatter('day', padZero(dayjs(value).date())), formatter('hour', padZero(dayjs(value).hour())), formatter('minute', padZero(dayjs(value).minute())))
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// 根据当前各列的所有值,从各列默认值中找到默认值在各列中的索引
|
|
137
|
+
const indexs = columns.value.map((column, index) => {
|
|
138
|
+
// 通过取大值,可以保证不会出现找不到索引的-1情况
|
|
139
|
+
return Math.max(0, column.findIndex((item: string) => item === values[index]))
|
|
140
|
+
});
|
|
141
|
+
innerDefaultIndex.value = indexs;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const init = () => {
|
|
145
|
+
getValue()
|
|
146
|
+
// this.updateColumnValue(this.innerValue)
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// 列发生变化时触发
|
|
150
|
+
const change = (e: any) => {
|
|
151
|
+
const { indexs, values } = e;
|
|
152
|
+
let selectValue: string | number = '';
|
|
153
|
+
if(props.mode === 'time') {
|
|
154
|
+
// 根据value各列索引,从各列数组中,取出当前时间的选中值
|
|
155
|
+
selectValue = `${intercept(values[0][indexs[0]])}:${intercept(values[1][indexs[1]])}`;
|
|
156
|
+
} else if (props.mode === 'year') {
|
|
157
|
+
const year = parseInt(intercept(values[0][indexs[0]], 'year'));
|
|
158
|
+
selectValue = Number(new Date(year, 0));
|
|
159
|
+
} else {
|
|
160
|
+
// 将选择的值转为数值,比如'03'转为数值的3,'2019'转为数值的2019
|
|
161
|
+
const year = parseInt(intercept(values[0][indexs[0]],'year'));
|
|
162
|
+
const month = parseInt(intercept(values[1][indexs[1]]));
|
|
163
|
+
let date = parseInt(values[2]? intercept(values[2][indexs[2]]) : 1);
|
|
164
|
+
let hour = 0, minute = 0;
|
|
165
|
+
// 此月份的最大天数
|
|
166
|
+
const maxDate = dayjs(`${year}-${month}`).daysInMonth();
|
|
167
|
+
// year-month模式下,date不会出现在列中,设置为1,为了符合后边需要减1的需求
|
|
168
|
+
if (props.mode === 'year-month') {
|
|
169
|
+
date = 1;
|
|
170
|
+
}
|
|
171
|
+
// 不允许超过maxDate值
|
|
172
|
+
date = Math.min(maxDate, date);
|
|
173
|
+
if (props.mode === 'datetime') {
|
|
174
|
+
hour = parseInt(intercept(values[3][indexs[3]]));
|
|
175
|
+
minute = parseInt(intercept(values[4][indexs[4]]));
|
|
176
|
+
}
|
|
177
|
+
// 转为时间模式
|
|
178
|
+
selectValue = Number(new Date(year, month - 1, date, hour, minute));
|
|
179
|
+
}
|
|
180
|
+
// 取出准确的合法值,防止超越边界的情况
|
|
181
|
+
selectValue = correctValue(selectValue);
|
|
182
|
+
innerValue.value = selectValue;
|
|
183
|
+
updateColumnValue(selectValue)
|
|
184
|
+
// 发出change时间,value为当前选中的时间戳
|
|
185
|
+
$emit('change', {
|
|
186
|
+
value: selectValue,
|
|
187
|
+
// #ifndef MP-WEIXIN
|
|
188
|
+
// 微信小程序不能传递this实例,会因为循环引用而报错
|
|
189
|
+
picker: pickerRef.value,
|
|
190
|
+
// #endif
|
|
191
|
+
mode: props.mode
|
|
192
|
+
})
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const getValue = () => {
|
|
196
|
+
innerValue.value = correctValue(props.modelValue);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
|
|
200
|
+
const setFormatter = (e: any) => {
|
|
201
|
+
innerFormatter.value = e;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// 打开
|
|
205
|
+
const open = () => {
|
|
206
|
+
pickerRef.value.open();
|
|
207
|
+
getValue()
|
|
208
|
+
updateColumnValue(innerValue.value);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// 关闭选择器
|
|
212
|
+
const close = () => {
|
|
213
|
+
if (props.maskClosable) {
|
|
214
|
+
cancel()
|
|
215
|
+
$emit('close')
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// 点击工具栏的取消按钮
|
|
220
|
+
const cancel = () => {
|
|
221
|
+
$emit('cancel')
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// 点击工具栏的确定按钮
|
|
225
|
+
const confirm = () => {
|
|
226
|
+
cancel()
|
|
227
|
+
$emit('confirm', {
|
|
228
|
+
value: innerValue.value,
|
|
229
|
+
mode: props.mode
|
|
230
|
+
})
|
|
231
|
+
$emit('input', innerValue.value)
|
|
232
|
+
$emit('update:modelValue', innerValue.value)
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
//用正则截取输出值,当出现多组数字时,抛出错误
|
|
236
|
+
const intercept = (e: any, type?: string) => {
|
|
237
|
+
let judge = e.match(/\d+/g)
|
|
238
|
+
//判断是否掺杂数字
|
|
239
|
+
if(judge.length>1){
|
|
240
|
+
uni.$fu.error('请勿在过滤或格式化函数时添加数字')
|
|
241
|
+
return 0
|
|
242
|
+
}else if(type && judge[0].length == 4){//判断是否是年份
|
|
243
|
+
return judge[0]
|
|
244
|
+
}else if(judge[0].length > 2){
|
|
245
|
+
uni.$fu.error('请勿在过滤或格式化函数时添加数字')
|
|
246
|
+
return 0
|
|
247
|
+
}else{
|
|
248
|
+
return judge[0]
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// 更新各列的值,进行补0、格式化等操作
|
|
253
|
+
const updateColumnValue = (value: string | number) => {
|
|
254
|
+
innerValue.value = value;
|
|
255
|
+
updateColumns()
|
|
256
|
+
updateIndexs(value)
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// 根据minDate、maxDate、minHour、maxHour等边界值,判断各列的开始和结束边界值
|
|
260
|
+
const getBoundary = (type: any, innerValue: string | number) => {
|
|
261
|
+
const value = new Date(innerValue);
|
|
262
|
+
const boundary = new Date(props[`${type}Date`]);
|
|
263
|
+
const year = dayjs(boundary).year();
|
|
264
|
+
let month = 1;
|
|
265
|
+
let date = 1;
|
|
266
|
+
let hour = 0;
|
|
267
|
+
let minute = 0;
|
|
268
|
+
if (type === 'max') {
|
|
269
|
+
month = 12;
|
|
270
|
+
// 月份的天数
|
|
271
|
+
date = dayjs(value).daysInMonth();
|
|
272
|
+
hour = 23;
|
|
273
|
+
minute = 59;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// 获取边界值,逻辑是:当年达到了边界值(最大或最小年),就检查月允许的最大和最小值,以此类推
|
|
277
|
+
if (dayjs(value).year() === year) {
|
|
278
|
+
month = dayjs(boundary).month() + 1;
|
|
279
|
+
if (dayjs(value).month() + 1 === month) {
|
|
280
|
+
date = dayjs(boundary).date();
|
|
281
|
+
if (dayjs(value).date() === date) {
|
|
282
|
+
hour = dayjs(boundary).hour();
|
|
283
|
+
if (dayjs(value).hour() === hour) {
|
|
284
|
+
minute = dayjs(boundary).minute();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return {
|
|
291
|
+
[`${type}Year`]: year,
|
|
292
|
+
[`${type}Month`]: month,
|
|
293
|
+
[`${type}Date`]: date,
|
|
294
|
+
[`${type}Hour`]: hour,
|
|
295
|
+
[`${type}Minute`]: minute
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// 生命周期
|
|
300
|
+
onMounted(() => {
|
|
301
|
+
init()
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// watch监听事件
|
|
305
|
+
watch(() => propsChange.value, () => {
|
|
306
|
+
init()
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
watch(() => props.modelValue, (newVal) => {
|
|
310
|
+
innerValue.value = correctValue(newVal) as number
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
return {
|
|
314
|
+
pickerRef,
|
|
315
|
+
columns,
|
|
316
|
+
innerDefaultIndex,
|
|
317
|
+
open,
|
|
318
|
+
close,
|
|
319
|
+
cancel,
|
|
320
|
+
confirm,
|
|
321
|
+
change,
|
|
322
|
+
setFormatter,
|
|
323
|
+
updateColumnValue
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 日期时间选择器 mode 有效值
|
|
5
|
+
*/
|
|
6
|
+
export const datetimePickerModes = ['date', 'time', 'year', 'year-month', 'datetime'] as const;
|
|
7
|
+
|
|
8
|
+
export const datetimePickerProps = {
|
|
9
|
+
/**
|
|
10
|
+
* @description 绑定值
|
|
11
|
+
*/
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: [String, Number],
|
|
14
|
+
default: 0
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* @description 顶部标题
|
|
18
|
+
*/
|
|
19
|
+
title: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* @description 顶部标题字体大小 (注:不传单位,默认px)
|
|
25
|
+
* @default 15
|
|
26
|
+
*/
|
|
27
|
+
titleSize: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
default: 15
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @description 顶部标题字体颜色
|
|
33
|
+
* @default '#333333'
|
|
34
|
+
*/
|
|
35
|
+
titleColor: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: '#333333'
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* @description 展示格式
|
|
41
|
+
* @values 'date' - 日期选择, 'time' - 时间选择, 'year' - 年选择, 'year-month' - 年月选择, 'datetime' - 日期时间选择
|
|
42
|
+
* @default 'datetime'
|
|
43
|
+
*/
|
|
44
|
+
mode: {
|
|
45
|
+
type: String,
|
|
46
|
+
values: datetimePickerModes,
|
|
47
|
+
default: 'datetime'
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* @description 可选的最大时间 最大默认值为后10年
|
|
51
|
+
*/
|
|
52
|
+
maxDate: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: new Date(new Date().getFullYear() + 10, 0, 1).getTime()
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @description 可选的最小时间 最小默认值为前10年
|
|
58
|
+
*/
|
|
59
|
+
minDate: {
|
|
60
|
+
type: Number,
|
|
61
|
+
default: new Date(new Date().getFullYear() - 10, 0, 1).getTime()
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* @description 可选的最小小时(仅mode=time时生效)
|
|
65
|
+
*/
|
|
66
|
+
minHour: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 0
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* @description 可选的最大小时(仅mode=time时生效)
|
|
72
|
+
* @default 23
|
|
73
|
+
*/
|
|
74
|
+
maxHour: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 23
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* @description 可选的最小分钟(仅mode=time时生效)
|
|
80
|
+
* @default 0
|
|
81
|
+
*/
|
|
82
|
+
minMinute: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 0
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* @description 可选的最大分钟(仅mode=time时生效)
|
|
88
|
+
* @default 59
|
|
89
|
+
*/
|
|
90
|
+
maxMinute: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 59
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* @description 选项过滤函数
|
|
96
|
+
* @default null
|
|
97
|
+
*/
|
|
98
|
+
filter: {
|
|
99
|
+
type: [Function, null],
|
|
100
|
+
default: null
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* @description 选项格式化函数
|
|
104
|
+
* @default null
|
|
105
|
+
*/
|
|
106
|
+
formatter: {
|
|
107
|
+
type: [Function, null],
|
|
108
|
+
default: null
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* @description 是否显示加载中状态
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
loading: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* @description 各列中,单个选项的高度
|
|
120
|
+
* @default 44
|
|
121
|
+
*/
|
|
122
|
+
itemHeight: {
|
|
123
|
+
type: [String, Number],
|
|
124
|
+
default: 44
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* @description 取消按钮的文字
|
|
128
|
+
* @default '取消'
|
|
129
|
+
*/
|
|
130
|
+
cancelText: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: '取消'
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* @description 取消按钮字体大小 (注:不传单位,默认px)
|
|
136
|
+
* @default 13
|
|
137
|
+
*/
|
|
138
|
+
cancelSize: {
|
|
139
|
+
type: [String, Number],
|
|
140
|
+
default: 13
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* @description 取消按钮文本颜色
|
|
144
|
+
* @default '#888888'
|
|
145
|
+
*/
|
|
146
|
+
cancelColor: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: '#888888'
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* @description 确认按钮的文字
|
|
152
|
+
* @default '确认'
|
|
153
|
+
*/
|
|
154
|
+
confirmText: {
|
|
155
|
+
type: String,
|
|
156
|
+
default: '确认'
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* @description 确认按钮字体大小 (注:不传单位,默认px)
|
|
160
|
+
* @default 13
|
|
161
|
+
*/
|
|
162
|
+
confirmSize: {
|
|
163
|
+
type: [String, Number],
|
|
164
|
+
default: 13
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* @description 确认按钮文本颜色
|
|
168
|
+
*/
|
|
169
|
+
confirmColor: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: ''
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* @description 每列中可见选项的数量
|
|
175
|
+
* @default 5
|
|
176
|
+
*/
|
|
177
|
+
visibleItemCount: {
|
|
178
|
+
type: [String, Number],
|
|
179
|
+
default: 5
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* @description 各列的默认索引
|
|
183
|
+
*/
|
|
184
|
+
defaultIndex: {
|
|
185
|
+
type: Array,
|
|
186
|
+
default: () => []
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* @description 是否允许点击遮罩关闭选择器
|
|
190
|
+
* @default true
|
|
191
|
+
*/
|
|
192
|
+
maskClosable: {
|
|
193
|
+
type: Boolean,
|
|
194
|
+
default: true
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const datetimePickerEmits = {
|
|
199
|
+
'update:modelValue': (_e: any) => true,
|
|
200
|
+
/**
|
|
201
|
+
* @description 关闭选择器时触发
|
|
202
|
+
*/
|
|
203
|
+
close: () => true,
|
|
204
|
+
/**
|
|
205
|
+
* @description 点击取消按钮
|
|
206
|
+
*/
|
|
207
|
+
cancel: () => true,
|
|
208
|
+
/**
|
|
209
|
+
* @description 点击确定按钮
|
|
210
|
+
*/
|
|
211
|
+
confirm: (_e: any) => true,
|
|
212
|
+
/**
|
|
213
|
+
* @description 当选择值变化时触发
|
|
214
|
+
*/
|
|
215
|
+
change: (_e: any) => true,
|
|
216
|
+
/**
|
|
217
|
+
* @description 输入事件
|
|
218
|
+
*/
|
|
219
|
+
input: (_e: any) => true
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type DatetimePickerProps = ExtractPropTypes<typeof datetimePickerProps>;
|
|
223
|
+
export type DatetimePickerEmits = typeof datetimePickerEmits;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<fu-picker
|
|
3
|
+
ref="pickerRef"
|
|
4
|
+
:columns="columns"
|
|
5
|
+
:title="title"
|
|
6
|
+
:titleSize="titleSize"
|
|
7
|
+
:titleColor="titleColor"
|
|
8
|
+
:itemHeight="itemHeight"
|
|
9
|
+
:visibleItemCount="visibleItemCount"
|
|
10
|
+
:defaultIndex="innerDefaultIndex"
|
|
11
|
+
:cancelText="cancelText"
|
|
12
|
+
:cancelSize="cancelSize"
|
|
13
|
+
:cancelColor="cancelColor"
|
|
14
|
+
:confirmText="confirmText"
|
|
15
|
+
:confirmSize="confirmSize"
|
|
16
|
+
:confirmColor="confirmColor"
|
|
17
|
+
:maskClosable="maskClosable"
|
|
18
|
+
@close="close"
|
|
19
|
+
@cancel="cancel"
|
|
20
|
+
@confirm="confirm"
|
|
21
|
+
@change="change"></fu-picker>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
/**
|
|
26
|
+
* DatetimePicker 时间日期选择器
|
|
27
|
+
* @description 此组件选择器用于时间日期
|
|
28
|
+
* @tutorial http://www.fusions.top/components/datetimePicker.html
|
|
29
|
+
* @property {String | Number} value 绑定值 默认0
|
|
30
|
+
* @property {String} title 顶部标题 不传不显示
|
|
31
|
+
* @property {String | Number} titleSize 顶部标题字体大小 默认15 (注:不传单位,默认px)
|
|
32
|
+
* @property {String} titleColor 顶部标题字体颜色
|
|
33
|
+
* @property {String} mode = [date|time|year|year-month|datetime] 展示格式 ( 默认 'datetime' )
|
|
34
|
+
* @value date 日期选择
|
|
35
|
+
* @value time 时间选择
|
|
36
|
+
* @value year 年选择
|
|
37
|
+
* @value year-month 年月选择
|
|
38
|
+
* @value datetime 日期时间
|
|
39
|
+
* @property {Number} maxDate 可选的最大时间 最大默认值为后10年
|
|
40
|
+
* @property {Number} minDate 可选的最小时间 最小默认值为前10年
|
|
41
|
+
* @property {Number} maxHour 可选的最大小时,仅mode=time有效 ( 默认 23 )
|
|
42
|
+
* @property {Number} minHour 可选的最小小时,仅mode=time有效 ( 默认 0 )
|
|
43
|
+
* @property {Number} maxMinute 可选的最大分钟,仅mode=time有效 ( 默认 59 )
|
|
44
|
+
* @property {Number} minMinute 可选的最小分钟,仅mode=time有效 ( 默认 0 )
|
|
45
|
+
* @property {Function} filter 选项过滤函数 默认null
|
|
46
|
+
* @property {Function} formatter 选项格式化函数 默认null
|
|
47
|
+
* @property {Boolean} loading = [true|false] 是否显示加载中状态 默认false
|
|
48
|
+
* @property {String | Number} itemHeight 各列中,单个选项的高度 ( 默认 44 )
|
|
49
|
+
* @property {String} cancelText 取消按钮文本 默认取消
|
|
50
|
+
* @property {String | Number} cancelSize 取消按钮字体大小 默认13 (注:不传单位,默认px)
|
|
51
|
+
* @property {String} cancelColor 取消按钮文本颜色 默认#888888
|
|
52
|
+
* @property {String} confirmText 确认按钮的文字 ( 默认 '确定' )
|
|
53
|
+
* @property {String | Number} confirmSize 确认按钮字体大小 默认13 (注:不传单位,默认px)
|
|
54
|
+
* @property {String} confirmColor 确认按钮文本颜色
|
|
55
|
+
* @property {String | Number} visibleItemCount 每列中可见选项的数量 ( 默认 5 )
|
|
56
|
+
* @property {Array} defaultIndex 各列的默认索引
|
|
57
|
+
* @property {Boolean} maskClosable = [true|false] 是否允许点击遮罩关闭选择器 默认 true
|
|
58
|
+
*
|
|
59
|
+
* @event {Function} close 关闭选择器时触发
|
|
60
|
+
* @event {Function} confirm 点击确定按钮,返回当前选择的值
|
|
61
|
+
* @event {Function} change 当选择值变化时触发
|
|
62
|
+
* @event {Function} cancel 点击取消按钮
|
|
63
|
+
* @example <fu-datetime-picker ref="datetimePicker" mode="datetime"></fu-datetime-picker>
|
|
64
|
+
*/
|
|
65
|
+
import { datetimePickerProps, datetimePickerEmits } from './datetime-picker';
|
|
66
|
+
import { useDatetimePicker } from './composables';
|
|
67
|
+
|
|
68
|
+
defineOptions({ name: 'FuDatetimePicker', options: { virtualHost: true } });
|
|
69
|
+
|
|
70
|
+
const props = defineProps(datetimePickerProps);
|
|
71
|
+
const $emit = defineEmits(datetimePickerEmits);
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
pickerRef,
|
|
75
|
+
columns,
|
|
76
|
+
innerDefaultIndex,
|
|
77
|
+
open,
|
|
78
|
+
close,
|
|
79
|
+
cancel,
|
|
80
|
+
confirm,
|
|
81
|
+
change,
|
|
82
|
+
setFormatter,
|
|
83
|
+
updateColumnValue
|
|
84
|
+
} = useDatetimePicker(props, $emit);
|
|
85
|
+
|
|
86
|
+
// 暴露方法
|
|
87
|
+
defineExpose({
|
|
88
|
+
open,
|
|
89
|
+
close,
|
|
90
|
+
setFormatter,
|
|
91
|
+
updateColumnValue
|
|
92
|
+
});
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/form'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-form'
|