taro-ui 3.3.1 → 3.3.3
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/dist/common/component.d.ts +10 -0
- package/dist/common/component.js +32 -0
- package/dist/common/component.js.map +1 -0
- package/dist/common/utils.d.ts +41 -0
- package/dist/common/utils.js +203 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +121 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/action-sheet/body/index.d.ts +5 -0
- package/dist/components/action-sheet/body/index.js +13 -0
- package/dist/components/action-sheet/body/index.js.map +1 -0
- package/dist/components/action-sheet/body/item/index.d.ts +9 -0
- package/dist/components/action-sheet/body/item/index.js +25 -0
- package/dist/components/action-sheet/body/item/index.js.map +1 -0
- package/dist/components/action-sheet/footer/index.d.ts +9 -0
- package/dist/components/action-sheet/footer/index.js +28 -0
- package/dist/components/action-sheet/footer/index.js.map +1 -0
- package/dist/components/action-sheet/header/index.d.ts +5 -0
- package/dist/components/action-sheet/header/index.js +16 -0
- package/dist/components/action-sheet/header/index.js.map +1 -0
- package/dist/components/action-sheet/index.d.ts +14 -0
- package/dist/components/action-sheet/index.js +76 -0
- package/dist/components/action-sheet/index.js.map +1 -0
- package/dist/components/activity-indicator/index.d.ts +8 -0
- package/dist/components/activity-indicator/index.js +39 -0
- package/dist/components/activity-indicator/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +9 -0
- package/dist/components/avatar/index.js +68 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +10 -0
- package/dist/components/badge/index.js +51 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/button/index.d.ts +15 -0
- package/dist/components/button/index.js +177 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/calendar/body/index.d.ts +26 -0
- package/dist/components/calendar/body/index.js +289 -0
- package/dist/components/calendar/body/index.js.map +1 -0
- package/dist/components/calendar/common/constant.d.ts +3 -0
- package/dist/components/calendar/common/constant.js +9 -0
- package/dist/components/calendar/common/constant.js.map +1 -0
- package/dist/components/calendar/common/helper.d.ts +4 -0
- package/dist/components/calendar/common/helper.js +84 -0
- package/dist/components/calendar/common/helper.js.map +1 -0
- package/dist/components/calendar/common/plugins.d.ts +11 -0
- package/dist/components/calendar/common/plugins.js +55 -0
- package/dist/components/calendar/common/plugins.js.map +1 -0
- package/dist/components/calendar/controller/index.d.ts +5 -0
- package/dist/components/calendar/controller/index.js +51 -0
- package/dist/components/calendar/controller/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +20 -0
- package/dist/components/calendar/index.js +244 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/calendar/ui/date-list/index.d.ts +12 -0
- package/dist/components/calendar/ui/date-list/index.js +54 -0
- package/dist/components/calendar/ui/date-list/index.js.map +1 -0
- package/dist/components/calendar/ui/day-list/index.d.ts +4 -0
- package/dist/components/calendar/ui/day-list/index.js +11 -0
- package/dist/components/calendar/ui/day-list/index.js.map +1 -0
- package/dist/components/card/index.d.ts +9 -0
- package/dist/components/card/index.js +80 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +9 -0
- package/dist/components/checkbox/index.js +59 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/countdown/index.d.ts +20 -0
- package/dist/components/countdown/index.js +152 -0
- package/dist/components/countdown/index.js.map +1 -0
- package/dist/components/countdown/item/index.d.ts +9 -0
- package/dist/components/countdown/item/index.js +24 -0
- package/dist/components/countdown/item/index.js.map +1 -0
- package/dist/components/curtain/index.d.ts +10 -0
- package/dist/components/curtain/index.js +62 -0
- package/dist/components/curtain/index.js.map +1 -0
- package/dist/components/divider/index.d.ts +8 -0
- package/dist/components/divider/index.js +57 -0
- package/dist/components/divider/index.js.map +1 -0
- package/dist/components/drawer/index.d.ts +16 -0
- package/dist/components/drawer/index.js +114 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +9 -0
- package/dist/components/fab/index.js +29 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/flex/index.d.ts +7 -0
- package/dist/components/flex/index.js +41 -0
- package/dist/components/flex/index.js.map +1 -0
- package/dist/components/flex/item/index.d.ts +7 -0
- package/dist/components/flex/item/index.js +34 -0
- package/dist/components/flex/item/index.js.map +1 -0
- package/dist/components/float-layout/index.d.ts +13 -0
- package/dist/components/float-layout/index.js +104 -0
- package/dist/components/float-layout/index.js.map +1 -0
- package/dist/components/form/index.d.ts +10 -0
- package/dist/components/form/index.js +43 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/grid/index.d.ts +9 -0
- package/dist/components/grid/index.js +101 -0
- package/dist/components/grid/index.js.map +1 -0
- package/dist/components/icon/index.d.ts +9 -0
- package/dist/components/icon/index.js +54 -0
- package/dist/components/icon/index.js.map +1 -0
- package/dist/components/image-picker/index.d.ts +11 -0
- package/dist/components/image-picker/index.js +164 -0
- package/dist/components/image-picker/index.js.map +1 -0
- package/dist/components/indexes/index.d.ts +29 -0
- package/dist/components/indexes/index.js +272 -0
- package/dist/components/indexes/index.js.map +1 -0
- package/dist/components/input/index.d.ts +17 -0
- package/dist/components/input/index.js +232 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input-number/index.d.ts +13 -0
- package/dist/components/input-number/index.js +193 -0
- package/dist/components/input-number/index.js.map +1 -0
- package/dist/components/list/index.d.ts +8 -0
- package/dist/components/list/index.js +26 -0
- package/dist/components/list/index.js.map +1 -0
- package/dist/components/list/item/index.d.ts +11 -0
- package/dist/components/list/item/index.js +152 -0
- package/dist/components/list/item/index.js.map +1 -0
- package/dist/components/load-more/index.d.ts +9 -0
- package/dist/components/load-more/index.js +72 -0
- package/dist/components/load-more/index.js.map +1 -0
- package/dist/components/loading/index.d.ts +12 -0
- package/dist/components/loading/index.js +32 -0
- package/dist/components/loading/index.js.map +1 -0
- package/dist/components/message/index.d.ts +15 -0
- package/dist/components/message/index.js +78 -0
- package/dist/components/message/index.js.map +1 -0
- package/dist/components/modal/action/index.d.ts +8 -0
- package/dist/components/modal/action/index.js +26 -0
- package/dist/components/modal/action/index.js.map +1 -0
- package/dist/components/modal/content/index.d.ts +5 -0
- package/dist/components/modal/content/index.js +13 -0
- package/dist/components/modal/content/index.js.map +1 -0
- package/dist/components/modal/header/index.d.ts +5 -0
- package/dist/components/modal/header/index.js +13 -0
- package/dist/components/modal/header/index.js.map +1 -0
- package/dist/components/modal/index.d.ts +15 -0
- package/dist/components/modal/index.js +106 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/nav-bar/index.d.ts +12 -0
- package/dist/components/nav-bar/index.js +217 -0
- package/dist/components/nav-bar/index.js.map +1 -0
- package/dist/components/noticebar/index.d.ts +16 -0
- package/dist/components/noticebar/index.js +186 -0
- package/dist/components/noticebar/index.js.map +1 -0
- package/dist/components/pagination/index.d.ts +12 -0
- package/dist/components/pagination/index.js +146 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/progress/index.d.ts +7 -0
- package/dist/components/progress/index.js +53 -0
- package/dist/components/progress/index.js.map +1 -0
- package/dist/components/radio/index.d.ts +9 -0
- package/dist/components/radio/index.js +54 -0
- package/dist/components/radio/index.js.map +1 -0
- package/dist/components/range/index.d.ts +22 -0
- package/dist/components/range/index.js +207 -0
- package/dist/components/range/index.js.map +1 -0
- package/dist/components/rate/index.d.ts +9 -0
- package/dist/components/rate/index.js +82 -0
- package/dist/components/rate/index.js.map +1 -0
- package/dist/components/search-bar/index.d.ts +16 -0
- package/dist/components/search-bar/index.js +176 -0
- package/dist/components/search-bar/index.js.map +1 -0
- package/dist/components/segmented-control/index.d.ts +9 -0
- package/dist/components/segmented-control/index.js +84 -0
- package/dist/components/segmented-control/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +13 -0
- package/dist/components/slider/index.js +115 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/steps/index.d.ts +9 -0
- package/dist/components/steps/index.js +67 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/swipe-action/index.d.ts +27 -0
- package/dist/components/swipe-action/index.js +220 -0
- package/dist/components/swipe-action/index.js.map +1 -0
- package/dist/components/swipe-action/options/index.d.ts +5 -0
- package/dist/components/swipe-action/options/index.js +24 -0
- package/dist/components/swipe-action/options/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +9 -0
- package/dist/components/switch/index.js +59 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/tab-bar/index.d.ts +9 -0
- package/dist/components/tab-bar/index.js +170 -0
- package/dist/components/tab-bar/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +24 -0
- package/dist/components/tabs/index.js +219 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs-pane/index.d.ts +8 -0
- package/dist/components/tabs-pane/index.js +43 -0
- package/dist/components/tabs-pane/index.js.map +1 -0
- package/dist/components/tag/index.d.ts +9 -0
- package/dist/components/tag/index.js +75 -0
- package/dist/components/tag/index.js.map +1 -0
- package/dist/components/textarea/index.d.ts +13 -0
- package/dist/components/textarea/index.js +141 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/timeline/index.d.ts +8 -0
- package/dist/components/timeline/index.js +76 -0
- package/dist/components/timeline/index.js.map +1 -0
- package/dist/components/toast/img.json +8 -0
- package/dist/components/toast/index.d.ts +16 -0
- package/dist/components/toast/index.js +124 -0
- package/dist/components/toast/index.js.map +1 -0
- package/{lib/index.js → dist/index.d.ts} +0 -2
- package/dist/index.esm.js +6020 -8272
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6104 -8332
- package/dist/index.js.map +1 -1
- package/dist/style/components/grid.scss +2 -2
- package/dist/style/components/index.scss +48 -48
- package/dist/style/components/list.scss +2 -2
- package/dist/style/index.css +11754 -0
- package/dist/style/index.css.map +1 -0
- package/dist/style/mixins/index.scss +13 -13
- package/dist/style/mixins/libs/shade.scss +4 -2
- package/dist/style/mixins/libs/tint.scss +4 -2
- package/dist/style/variables/default.scss +1 -1
- package/package.json +56 -33
- package/rn/components/action-sheet/index.tsx +8 -14
- package/rn/components/calendar/ui/date-list/index.tsx +1 -1
- package/rn/components/drawer/index.tsx +15 -15
- package/rn/components/float-layout/index.tsx +3 -2
- package/rn/components/input/index.tsx +14 -7
- package/rn/components/input-number/index.tsx +19 -19
- package/rn/components/message/index.tsx +1 -1
- package/rn/components/swipe-action/index.rn.tsx +4 -2
- package/rn/components/swipe-action/index.tsx +6 -5
- package/rn/components/tab-bar/index.tsx +1 -1
- package/rn/components/tabs/index.tsx +14 -14
- package/rn/components/textarea/index.tsx +2 -2
- package/dist/style/components/accordion.rn.scss +0 -79
- package/dist/style/components/action-sheet.rn.scss +0 -80
- package/dist/style/components/activity-indicator.rn.scss +0 -30
- package/dist/style/components/article.rn.scss +0 -59
- package/dist/style/components/avatar.rn.scss +0 -46
- package/dist/style/components/badge.rn.scss +0 -52
- package/dist/style/components/button.rn.scss +0 -80
- package/dist/style/components/calendar.rn.scss +0 -182
- package/dist/style/components/card.rn.scss +0 -88
- package/dist/style/components/checkbox.rn.scss +0 -108
- package/dist/style/components/countdown.rn.scss +0 -82
- package/dist/style/components/curtain.rn.scss +0 -129
- package/dist/style/components/divider.rn.scss +0 -33
- package/dist/style/components/drawer.rn.scss +0 -72
- package/dist/style/components/fab.rn.scss +0 -38
- package/dist/style/components/flex.rn.scss +0 -159
- package/dist/style/components/float-layout.rn.scss +0 -119
- package/dist/style/components/form.rn.scss +0 -12
- package/dist/style/components/grid.rn.scss +0 -104
- package/dist/style/components/icon.rn.scss +0 -221
- package/dist/style/components/image-picker.rn.scss +0 -108
- package/dist/style/components/index.rn.scss +0 -51
- package/dist/style/components/indexes.rn.scss +0 -53
- package/dist/style/components/input-number.rn.scss +0 -82
- package/dist/style/components/input.rn.scss +0 -149
- package/dist/style/components/list.rn.scss +0 -107
- package/dist/style/components/load-more.rn.scss +0 -28
- package/dist/style/components/loading.rn.scss +0 -45
- package/dist/style/components/message.rn.scss +0 -57
- package/dist/style/components/modal.rn.scss +0 -136
- package/dist/style/components/nav-bar.rn.scss +0 -123
- package/dist/style/components/noticebar.rn.scss +0 -111
- package/dist/style/components/pagination.rn.scss +0 -43
- package/dist/style/components/progress.rn.scss +0 -105
- package/dist/style/components/radio.rn.scss +0 -94
- package/dist/style/components/range.rn.scss +0 -52
- package/dist/style/components/rate.rn.scss +0 -48
- package/dist/style/components/search-bar.rn.scss +0 -134
- package/dist/style/components/segmented-control.rn.scss +0 -44
- package/dist/style/components/slider.rn.scss +0 -33
- package/dist/style/components/steps.rn.scss +0 -131
- package/dist/style/components/swipe-action.rn.scss +0 -53
- package/dist/style/components/switch.rn.scss +0 -61
- package/dist/style/components/tab-bar.rn.scss +0 -74
- package/dist/style/components/tabs.rn.scss +0 -205
- package/dist/style/components/tag.rn.scss +0 -74
- package/dist/style/components/textarea.rn.scss +0 -57
- package/dist/style/components/timeline.rn.scss +0 -89
- package/dist/style/components/toast.rn.scss +0 -112
- package/dist/style/index.rn.scss +0 -14
- package/dist/style/mixins/index.rn.scss +0 -18
- package/dist/style/mixins/libs/absolute-center.rn.scss +0 -9
- package/dist/style/mixins/libs/active.rn.scss +0 -10
- package/dist/style/mixins/libs/alignhack.rn.scss +0 -11
- package/dist/style/mixins/libs/border.rn.scss +0 -48
- package/dist/style/mixins/libs/clearfix.rn.scss +0 -21
- package/dist/style/mixins/libs/disabled.rn.scss +0 -6
- package/dist/style/mixins/libs/flex.rn.scss +0 -49
- package/dist/style/mixins/libs/hairline.rn.scss +0 -209
- package/dist/style/mixins/libs/line.rn.scss +0 -14
- package/dist/style/mixins/libs/overlay.rn.scss +0 -11
- package/dist/style/mixins/libs/placeholder.rn.scss +0 -12
- package/dist/style/mixins/libs/shade.rn.scss +0 -23
- package/dist/style/mixins/libs/tint.rn.scss +0 -23
- package/dist/style/themes/purple.rn.scss +0 -44
- package/dist/style/themes/red.rn.scss +0 -45
- package/dist/style/variables/default.rn.scss +0 -461
- package/lib/common/component.js +0 -33
- package/lib/common/component.js.map +0 -1
- package/lib/common/utils.js +0 -226
- package/lib/common/utils.js.map +0 -1
- package/lib/components/accordion/index.js +0 -116
- package/lib/components/accordion/index.js.map +0 -1
- package/lib/components/action-sheet/body/index.js +0 -10
- package/lib/components/action-sheet/body/index.js.map +0 -1
- package/lib/components/action-sheet/body/item/index.js +0 -22
- package/lib/components/action-sheet/body/item/index.js.map +0 -1
- package/lib/components/action-sheet/footer/index.js +0 -22
- package/lib/components/action-sheet/footer/index.js.map +0 -1
- package/lib/components/action-sheet/header/index.js +0 -10
- package/lib/components/action-sheet/header/index.js.map +0 -1
- package/lib/components/action-sheet/index.js +0 -71
- package/lib/components/action-sheet/index.js.map +0 -1
- package/lib/components/activity-indicator/index.js +0 -35
- package/lib/components/activity-indicator/index.js.map +0 -1
- package/lib/components/avatar/index.js +0 -64
- package/lib/components/avatar/index.js.map +0 -1
- package/lib/components/badge/index.js +0 -42
- package/lib/components/badge/index.js.map +0 -1
- package/lib/components/button/index.js +0 -125
- package/lib/components/button/index.js.map +0 -1
- package/lib/components/calendar/body/index.js +0 -193
- package/lib/components/calendar/body/index.js.map +0 -1
- package/lib/components/calendar/common/constant.js +0 -4
- package/lib/components/calendar/common/constant.js.map +0 -1
- package/lib/components/calendar/common/helper.js +0 -83
- package/lib/components/calendar/common/helper.js.map +0 -1
- package/lib/components/calendar/common/plugins.js +0 -71
- package/lib/components/calendar/common/plugins.js.map +0 -1
- package/lib/components/calendar/controller/index.js +0 -30
- package/lib/components/calendar/controller/index.js.map +0 -1
- package/lib/components/calendar/index.js +0 -207
- package/lib/components/calendar/index.js.map +0 -1
- package/lib/components/calendar/ui/date-list/index.js +0 -43
- package/lib/components/calendar/ui/date-list/index.js.map +0 -1
- package/lib/components/calendar/ui/day-list/index.js +0 -16
- package/lib/components/calendar/ui/day-list/index.js.map +0 -1
- package/lib/components/card/index.js +0 -59
- package/lib/components/card/index.js.map +0 -1
- package/lib/components/checkbox/index.js +0 -55
- package/lib/components/checkbox/index.js.map +0 -1
- package/lib/components/countdown/index.js +0 -137
- package/lib/components/countdown/index.js.map +0 -1
- package/lib/components/countdown/item/index.js +0 -24
- package/lib/components/countdown/item/index.js.map +0 -1
- package/lib/components/curtain/index.js +0 -45
- package/lib/components/curtain/index.js.map +0 -1
- package/lib/components/divider/index.js +0 -40
- package/lib/components/divider/index.js.map +0 -1
- package/lib/components/drawer/index.js +0 -93
- package/lib/components/drawer/index.js.map +0 -1
- package/lib/components/fab/index.js +0 -26
- package/lib/components/fab/index.js.map +0 -1
- package/lib/components/flex/index.js +0 -38
- package/lib/components/flex/index.js.map +0 -1
- package/lib/components/flex/item/index.js +0 -31
- package/lib/components/flex/item/index.js.map +0 -1
- package/lib/components/float-layout/index.js +0 -76
- package/lib/components/float-layout/index.js.map +0 -1
- package/lib/components/form/index.js +0 -30
- package/lib/components/form/index.js.map +0 -1
- package/lib/components/grid/index.js +0 -71
- package/lib/components/grid/index.js.map +0 -1
- package/lib/components/icon/index.js +0 -37
- package/lib/components/icon/index.js.map +0 -1
- package/lib/components/image-picker/index.js +0 -138
- package/lib/components/image-picker/index.js.map +0 -1
- package/lib/components/indexes/index.js +0 -215
- package/lib/components/indexes/index.js.map +0 -1
- package/lib/components/input/index.js +0 -168
- package/lib/components/input/index.js.map +0 -1
- package/lib/components/input-number/index.js +0 -165
- package/lib/components/input-number/index.js.map +0 -1
- package/lib/components/list/index.js +0 -19
- package/lib/components/list/index.js.map +0 -1
- package/lib/components/list/item/index.js +0 -105
- package/lib/components/list/item/index.js.map +0 -1
- package/lib/components/load-more/index.js +0 -48
- package/lib/components/load-more/index.js.map +0 -1
- package/lib/components/loading/index.js +0 -32
- package/lib/components/loading/index.js.map +0 -1
- package/lib/components/message/index.js +0 -69
- package/lib/components/message/index.js.map +0 -1
- package/lib/components/modal/action/index.js +0 -20
- package/lib/components/modal/action/index.js.map +0 -1
- package/lib/components/modal/content/index.js +0 -10
- package/lib/components/modal/content/index.js.map +0 -1
- package/lib/components/modal/header/index.js +0 -10
- package/lib/components/modal/header/index.js.map +0 -1
- package/lib/components/modal/index.js +0 -97
- package/lib/components/modal/index.js.map +0 -1
- package/lib/components/nav-bar/index.js +0 -105
- package/lib/components/nav-bar/index.js.map +0 -1
- package/lib/components/noticebar/index.js +0 -163
- package/lib/components/noticebar/index.js.map +0 -1
- package/lib/components/pagination/index.js +0 -115
- package/lib/components/pagination/index.js.map +0 -1
- package/lib/components/progress/index.js +0 -45
- package/lib/components/progress/index.js.map +0 -1
- package/lib/components/radio/index.js +0 -43
- package/lib/components/radio/index.js.map +0 -1
- package/lib/components/range/index.js +0 -152
- package/lib/components/range/index.js.map +0 -1
- package/lib/components/rate/index.js +0 -56
- package/lib/components/rate/index.js.map +0 -1
- package/lib/components/search-bar/index.js +0 -121
- package/lib/components/search-bar/index.js.map +0 -1
- package/lib/components/segmented-control/index.js +0 -59
- package/lib/components/segmented-control/index.js.map +0 -1
- package/lib/components/slider/index.js +0 -77
- package/lib/components/slider/index.js.map +0 -1
- package/lib/components/steps/index.js +0 -50
- package/lib/components/steps/index.js.map +0 -1
- package/lib/components/swipe-action/index.js +0 -171
- package/lib/components/swipe-action/index.js.map +0 -1
- package/lib/components/swipe-action/options/index.js +0 -10
- package/lib/components/swipe-action/options/index.js.map +0 -1
- package/lib/components/switch/index.js +0 -48
- package/lib/components/switch/index.js.map +0 -1
- package/lib/components/tab-bar/index.js +0 -96
- package/lib/components/tab-bar/index.js.map +0 -1
- package/lib/components/tabs/index.js +0 -190
- package/lib/components/tabs/index.js.map +0 -1
- package/lib/components/tabs-pane/index.js +0 -30
- package/lib/components/tabs-pane/index.js.map +0 -1
- package/lib/components/tag/index.js +0 -55
- package/lib/components/tag/index.js.map +0 -1
- package/lib/components/textarea/index.js +0 -95
- package/lib/components/textarea/index.js.map +0 -1
- package/lib/components/timeline/index.js +0 -53
- package/lib/components/timeline/index.js.map +0 -1
- package/lib/components/toast/img.json +0 -5
- package/lib/components/toast/index.js +0 -117
- package/lib/components/toast/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/types/accordion.d.ts +0 -49
- package/types/action-sheet.d.ts +0 -55
- package/types/activity-indicator.d.ts +0 -33
- package/types/avatar.d.ts +0 -39
- package/types/badge.d.ts +0 -24
- package/types/base.d.ts +0 -26
- package/types/button.d.ts +0 -70
- package/types/calendar.d.ts +0 -225
- package/types/card.d.ts +0 -48
- package/types/checkbox.d.ts +0 -24
- package/types/countdown.d.ts +0 -95
- package/types/curtain.d.ts +0 -26
- package/types/divider.d.ts +0 -33
- package/types/drawer.d.ts +0 -48
- package/types/fab.d.ts +0 -21
- package/types/flex.d.ts +0 -27
- package/types/float-button.d.ts +0 -26
- package/types/float-layout.d.ts +0 -73
- package/types/form.d.ts +0 -26
- package/types/grid.d.ts +0 -51
- package/types/icon.d.ts +0 -12
- package/types/image-picker.d.ts +0 -73
- package/types/index.d.ts +0 -55
- package/types/indexes.d.ts +0 -76
- package/types/input-number.d.ts +0 -89
- package/types/input.d.ts +0 -162
- package/types/list.d.ts +0 -84
- package/types/load-more.d.ts +0 -43
- package/types/message.d.ts +0 -43
- package/types/modal.d.ts +0 -62
- package/types/nav-bar.d.ts +0 -65
- package/types/noticebar.d.ts +0 -65
- package/types/pagination.d.ts +0 -51
- package/types/progress.d.ts +0 -30
- package/types/radio.d.ts +0 -47
- package/types/range.d.ts +0 -63
- package/types/rate.d.ts +0 -34
- package/types/search-bar.d.ts +0 -105
- package/types/segmented-control.d.ts +0 -44
- package/types/slider.d.ts +0 -73
- package/types/steps.d.ts +0 -69
- package/types/swipe-action.d.ts +0 -86
- package/types/switch.d.ts +0 -38
- package/types/tab-bar.d.ts +0 -98
- package/types/tabs-pane.d.ts +0 -25
- package/types/tabs.d.ts +0 -62
- package/types/tag.d.ts +0 -48
- package/types/textarea.d.ts +0 -113
- package/types/timeline.d.ts +0 -46
- package/types/toast.d.ts +0 -53
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import classnames from "classnames";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Swiper, SwiperItem, View } from "@tarojs/components";
|
|
5
|
+
import { delayQuerySelector } from "../../../common/utils";
|
|
6
|
+
import generateCalendarGroup from "../common/helper";
|
|
7
|
+
import AtCalendarDateList from "../ui/date-list/index";
|
|
8
|
+
import AtCalendarDayList from "../ui/day-list/index";
|
|
9
|
+
const ANIMTE_DURATION = 300;
|
|
10
|
+
const defaultProps = {
|
|
11
|
+
marks: [],
|
|
12
|
+
selectedDate: {
|
|
13
|
+
end: Date.now(),
|
|
14
|
+
start: Date.now()
|
|
15
|
+
},
|
|
16
|
+
format: "YYYY-MM-DD",
|
|
17
|
+
generateDate: Date.now()
|
|
18
|
+
};
|
|
19
|
+
class AtCalendarBody extends React.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.changeCount = 0;
|
|
23
|
+
this.currentSwiperIndex = 1;
|
|
24
|
+
this.startX = 0;
|
|
25
|
+
this.swipeStartPoint = 0;
|
|
26
|
+
this.isPreMonth = false;
|
|
27
|
+
this.maxWidth = 0;
|
|
28
|
+
this.isTouching = false;
|
|
29
|
+
this.getGroups = (generateDate, selectedDate) => {
|
|
30
|
+
const dayjsDate = dayjs(generateDate);
|
|
31
|
+
const arr = [];
|
|
32
|
+
const preList = this.generateFunc(
|
|
33
|
+
dayjsDate.subtract(1, "month").valueOf(),
|
|
34
|
+
selectedDate
|
|
35
|
+
);
|
|
36
|
+
const nowList = this.generateFunc(
|
|
37
|
+
generateDate,
|
|
38
|
+
selectedDate,
|
|
39
|
+
true
|
|
40
|
+
);
|
|
41
|
+
const nextList = this.generateFunc(
|
|
42
|
+
dayjsDate.add(1, "month").valueOf(),
|
|
43
|
+
selectedDate
|
|
44
|
+
);
|
|
45
|
+
const preListIndex = this.currentSwiperIndex === 0 ? 2 : this.currentSwiperIndex - 1;
|
|
46
|
+
const nextListIndex = this.currentSwiperIndex === 2 ? 0 : this.currentSwiperIndex + 1;
|
|
47
|
+
arr[preListIndex] = preList;
|
|
48
|
+
arr[nextListIndex] = nextList;
|
|
49
|
+
arr[this.currentSwiperIndex] = nowList;
|
|
50
|
+
return arr;
|
|
51
|
+
};
|
|
52
|
+
this.handleTouchStart = (e) => {
|
|
53
|
+
if (!this.props.isSwiper) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.isTouching = true;
|
|
57
|
+
this.startX = e.touches[0].clientX;
|
|
58
|
+
};
|
|
59
|
+
this.handleTouchMove = (e) => {
|
|
60
|
+
if (!this.props.isSwiper) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!this.isTouching) return;
|
|
64
|
+
const { clientX } = e.touches[0];
|
|
65
|
+
const offsetSize = clientX - this.startX;
|
|
66
|
+
this.setState({
|
|
67
|
+
offsetSize
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
this.animateMoveSlide = (offset, callback) => {
|
|
71
|
+
this.setState(
|
|
72
|
+
{
|
|
73
|
+
isAnimate: true
|
|
74
|
+
},
|
|
75
|
+
() => {
|
|
76
|
+
this.setState({
|
|
77
|
+
offsetSize: offset
|
|
78
|
+
});
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
this.setState(
|
|
81
|
+
{
|
|
82
|
+
isAnimate: false
|
|
83
|
+
},
|
|
84
|
+
() => {
|
|
85
|
+
callback == null ? void 0 : callback();
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}, ANIMTE_DURATION);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
this.handleTouchEnd = () => {
|
|
93
|
+
if (!this.props.isSwiper) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const { offsetSize } = this.state;
|
|
97
|
+
this.isTouching = false;
|
|
98
|
+
const isRight = offsetSize > 0;
|
|
99
|
+
const breakpoint = this.maxWidth / 2;
|
|
100
|
+
const absOffsetSize = Math.abs(offsetSize);
|
|
101
|
+
if (absOffsetSize > breakpoint) {
|
|
102
|
+
const res = isRight ? this.maxWidth : -this.maxWidth;
|
|
103
|
+
return this.animateMoveSlide(res, () => {
|
|
104
|
+
this.props.onSwipeMonth(isRight ? -1 : 1);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
this.animateMoveSlide(0);
|
|
108
|
+
};
|
|
109
|
+
this.handleChange = (e) => {
|
|
110
|
+
const { current, source } = e.detail;
|
|
111
|
+
if (source === "touch") {
|
|
112
|
+
this.currentSwiperIndex = current;
|
|
113
|
+
this.changeCount += 1;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
this.handleAnimateFinish = () => {
|
|
117
|
+
if (this.changeCount > 0) {
|
|
118
|
+
this.props.onSwipeMonth(
|
|
119
|
+
this.isPreMonth ? -this.changeCount : this.changeCount
|
|
120
|
+
);
|
|
121
|
+
this.changeCount = 0;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
this.handleSwipeTouchStart = (e) => {
|
|
125
|
+
const { clientY, clientX } = e.changedTouches[0];
|
|
126
|
+
this.swipeStartPoint = this.props.isVertical ? clientY : clientX;
|
|
127
|
+
};
|
|
128
|
+
this.handleSwipeTouchEnd = (e) => {
|
|
129
|
+
const { clientY, clientX } = e.changedTouches[0];
|
|
130
|
+
this.isPreMonth = this.props.isVertical ? clientY - this.swipeStartPoint > 0 : clientX - this.swipeStartPoint > 0;
|
|
131
|
+
};
|
|
132
|
+
const {
|
|
133
|
+
validDates,
|
|
134
|
+
marks,
|
|
135
|
+
format,
|
|
136
|
+
minDate,
|
|
137
|
+
maxDate,
|
|
138
|
+
generateDate,
|
|
139
|
+
selectedDate,
|
|
140
|
+
selectedDates
|
|
141
|
+
} = props;
|
|
142
|
+
this.generateFunc = generateCalendarGroup({
|
|
143
|
+
validDates,
|
|
144
|
+
format,
|
|
145
|
+
minDate,
|
|
146
|
+
maxDate,
|
|
147
|
+
marks,
|
|
148
|
+
selectedDates
|
|
149
|
+
});
|
|
150
|
+
const listGroup = this.getGroups(generateDate, selectedDate);
|
|
151
|
+
this.state = {
|
|
152
|
+
listGroup,
|
|
153
|
+
offsetSize: 0,
|
|
154
|
+
isAnimate: false
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
componentDidMount() {
|
|
158
|
+
delayQuerySelector(".at-calendar-slider__main").then((res) => {
|
|
159
|
+
this.maxWidth = res[0].width;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
163
|
+
const {
|
|
164
|
+
validDates,
|
|
165
|
+
marks,
|
|
166
|
+
format,
|
|
167
|
+
minDate,
|
|
168
|
+
maxDate,
|
|
169
|
+
generateDate,
|
|
170
|
+
selectedDate,
|
|
171
|
+
selectedDates
|
|
172
|
+
} = nextProps;
|
|
173
|
+
this.generateFunc = generateCalendarGroup({
|
|
174
|
+
validDates,
|
|
175
|
+
format,
|
|
176
|
+
minDate,
|
|
177
|
+
maxDate,
|
|
178
|
+
marks,
|
|
179
|
+
selectedDates
|
|
180
|
+
});
|
|
181
|
+
const listGroup = this.getGroups(generateDate, selectedDate);
|
|
182
|
+
this.setState({
|
|
183
|
+
offsetSize: 0,
|
|
184
|
+
listGroup
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
render() {
|
|
188
|
+
const { isSwiper } = this.props;
|
|
189
|
+
const { isAnimate, offsetSize, listGroup } = this.state;
|
|
190
|
+
if (!isSwiper) {
|
|
191
|
+
return /* @__PURE__ */ React.createElement(
|
|
192
|
+
View,
|
|
193
|
+
{
|
|
194
|
+
className: classnames(
|
|
195
|
+
"main",
|
|
196
|
+
"at-calendar-slider__main",
|
|
197
|
+
`at-calendar-slider__main--${process.env.TARO_ENV}`
|
|
198
|
+
)
|
|
199
|
+
},
|
|
200
|
+
/* @__PURE__ */ React.createElement(AtCalendarDayList, null),
|
|
201
|
+
/* @__PURE__ */ React.createElement(View, { className: "main__body body" }, /* @__PURE__ */ React.createElement(View, { className: "body__slider body__slider--now" }, /* @__PURE__ */ React.createElement(
|
|
202
|
+
AtCalendarDateList,
|
|
203
|
+
{
|
|
204
|
+
list: listGroup[1].list,
|
|
205
|
+
onClick: this.props.onDayClick,
|
|
206
|
+
onLongClick: this.props.onLongClick
|
|
207
|
+
}
|
|
208
|
+
)))
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
if (process.env.TARO_ENV === "h5") {
|
|
212
|
+
return /* @__PURE__ */ React.createElement(
|
|
213
|
+
View,
|
|
214
|
+
{
|
|
215
|
+
className: classnames(
|
|
216
|
+
"main",
|
|
217
|
+
"at-calendar-slider__main",
|
|
218
|
+
`at-calendar-slider__main--${process.env.TARO_ENV}`
|
|
219
|
+
),
|
|
220
|
+
onTouchEnd: this.handleTouchEnd,
|
|
221
|
+
onTouchMove: this.handleTouchMove,
|
|
222
|
+
onTouchStart: this.handleTouchStart
|
|
223
|
+
},
|
|
224
|
+
/* @__PURE__ */ React.createElement(AtCalendarDayList, null),
|
|
225
|
+
/* @__PURE__ */ React.createElement(
|
|
226
|
+
View,
|
|
227
|
+
{
|
|
228
|
+
className: classnames("main__body body", {
|
|
229
|
+
"main__body--slider": isSwiper,
|
|
230
|
+
"main__body--animate": isAnimate
|
|
231
|
+
}),
|
|
232
|
+
style: {
|
|
233
|
+
transform: isSwiper ? `translateX(-100%) translate3d(${offsetSize},0,0)` : "",
|
|
234
|
+
WebkitTransform: isSwiper ? `translateX(-100%) translate3d(${offsetSize}px,0,0)` : ""
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
/* @__PURE__ */ React.createElement(View, { className: "body__slider body__slider--pre" }, /* @__PURE__ */ React.createElement(AtCalendarDateList, { list: listGroup[0].list })),
|
|
238
|
+
/* @__PURE__ */ React.createElement(View, { className: "body__slider body__slider--now" }, /* @__PURE__ */ React.createElement(
|
|
239
|
+
AtCalendarDateList,
|
|
240
|
+
{
|
|
241
|
+
list: listGroup[1].list,
|
|
242
|
+
onClick: this.props.onDayClick,
|
|
243
|
+
onLongClick: this.props.onLongClick
|
|
244
|
+
}
|
|
245
|
+
)),
|
|
246
|
+
/* @__PURE__ */ React.createElement(View, { className: "body__slider body__slider--next" }, /* @__PURE__ */ React.createElement(AtCalendarDateList, { list: listGroup[2].list }))
|
|
247
|
+
)
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
return /* @__PURE__ */ React.createElement(
|
|
251
|
+
View,
|
|
252
|
+
{
|
|
253
|
+
className: classnames(
|
|
254
|
+
"main",
|
|
255
|
+
"at-calendar-slider__main",
|
|
256
|
+
`at-calendar-slider__main--${process.env.TARO_ENV}`
|
|
257
|
+
)
|
|
258
|
+
},
|
|
259
|
+
/* @__PURE__ */ React.createElement(AtCalendarDayList, null),
|
|
260
|
+
/* @__PURE__ */ React.createElement(
|
|
261
|
+
Swiper,
|
|
262
|
+
{
|
|
263
|
+
circular: true,
|
|
264
|
+
current: 1,
|
|
265
|
+
skipHiddenItemLayout: true,
|
|
266
|
+
className: classnames("main__body"),
|
|
267
|
+
onChange: this.handleChange,
|
|
268
|
+
vertical: this.props.isVertical,
|
|
269
|
+
onAnimationFinish: this.handleAnimateFinish,
|
|
270
|
+
onTouchEnd: this.handleSwipeTouchEnd,
|
|
271
|
+
onTouchStart: this.handleSwipeTouchStart
|
|
272
|
+
},
|
|
273
|
+
listGroup.map((item, key) => /* @__PURE__ */ React.createElement(SwiperItem, { key, itemId: key.toString() }, /* @__PURE__ */ React.createElement(
|
|
274
|
+
AtCalendarDateList,
|
|
275
|
+
{
|
|
276
|
+
list: item.list,
|
|
277
|
+
onClick: this.props.onDayClick,
|
|
278
|
+
onLongClick: this.props.onLongClick
|
|
279
|
+
}
|
|
280
|
+
)))
|
|
281
|
+
)
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
AtCalendarBody.defaultProps = defaultProps;
|
|
286
|
+
export {
|
|
287
|
+
AtCalendarBody as default
|
|
288
|
+
};
|
|
289
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/calendar/body/index.tsx"],"sourcesContent":["import classnames from 'classnames'\nimport dayjs from 'dayjs'\nimport React from 'react'\nimport { Swiper, SwiperItem, View } from '@tarojs/components'\nimport {\n BaseEventOrig,\n ITouch,\n ITouchEvent\n} from '@tarojs/components/types/common'\nimport {\n AtCalendarBodyListGroup,\n AtCalendarBodyProps,\n AtCalendarBodyState,\n Calendar\n} from '../../../../types/calendar'\nimport { delayQuerySelector } from '../../../common/utils'\nimport generateCalendarGroup from '../common/helper'\nimport AtCalendarDateList from '../ui/date-list/index'\nimport AtCalendarDayList from '../ui/day-list/index'\n\nconst ANIMTE_DURATION = 300\n\nconst defaultProps: Partial<AtCalendarBodyProps> = {\n marks: [],\n selectedDate: {\n end: Date.now(),\n start: Date.now()\n },\n format: 'YYYY-MM-DD',\n generateDate: Date.now()\n}\n\nexport default class AtCalendarBody extends React.Component<\n AtCalendarBodyProps,\n Readonly<AtCalendarBodyState>\n> {\n static defaultProps: Partial<AtCalendarBodyProps> = defaultProps\n\n public constructor(props: AtCalendarBodyProps) {\n super(props)\n const {\n validDates,\n marks,\n format,\n minDate,\n maxDate,\n generateDate,\n selectedDate,\n selectedDates\n } = props\n\n this.generateFunc = generateCalendarGroup({\n validDates,\n format,\n minDate,\n maxDate,\n marks,\n selectedDates\n })\n const listGroup = this.getGroups(generateDate, selectedDate)\n\n this.state = {\n listGroup,\n offsetSize: 0,\n isAnimate: false\n }\n }\n\n public componentDidMount(): void {\n delayQuerySelector('.at-calendar-slider__main').then(res => {\n this.maxWidth = res[0].width\n })\n }\n\n public UNSAFE_componentWillReceiveProps(\n nextProps: AtCalendarBodyProps\n ): void {\n const {\n validDates,\n marks,\n format,\n minDate,\n maxDate,\n generateDate,\n selectedDate,\n selectedDates\n } = nextProps\n\n this.generateFunc = generateCalendarGroup({\n validDates,\n format,\n minDate,\n maxDate,\n marks,\n selectedDates\n })\n const listGroup = this.getGroups(generateDate, selectedDate)\n\n this.setState({\n offsetSize: 0,\n listGroup\n })\n }\n\n private changeCount = 0\n private currentSwiperIndex = 1\n private startX = 0\n private swipeStartPoint = 0\n private isPreMonth = false\n private maxWidth = 0\n private isTouching = false\n\n private generateFunc: (\n generateDate: number,\n selectedDate: Calendar.SelectedDate,\n isShowStatus?: boolean\n ) => Calendar.ListInfo<Calendar.Item>\n\n private getGroups = (\n generateDate: number,\n selectedDate: Calendar.SelectedDate\n ): AtCalendarBodyListGroup => {\n const dayjsDate = dayjs(generateDate)\n const arr: AtCalendarBodyListGroup = []\n const preList: Calendar.ListInfo<Calendar.Item> = this.generateFunc(\n dayjsDate.subtract(1, 'month').valueOf(),\n selectedDate\n )\n\n const nowList: Calendar.ListInfo<Calendar.Item> = this.generateFunc(\n generateDate,\n selectedDate,\n true\n )\n\n const nextList: Calendar.ListInfo<Calendar.Item> = this.generateFunc(\n dayjsDate.add(1, 'month').valueOf(),\n selectedDate\n )\n\n const preListIndex =\n this.currentSwiperIndex === 0 ? 2 : this.currentSwiperIndex - 1\n const nextListIndex =\n this.currentSwiperIndex === 2 ? 0 : this.currentSwiperIndex + 1\n\n arr[preListIndex] = preList\n arr[nextListIndex] = nextList\n arr[this.currentSwiperIndex] = nowList\n\n return arr\n }\n\n private handleTouchStart = (e: ITouchEvent): void => {\n if (!this.props.isSwiper) {\n return\n }\n this.isTouching = true\n this.startX = e.touches[0].clientX\n }\n\n private handleTouchMove = (e: ITouchEvent): void => {\n if (!this.props.isSwiper) {\n return\n }\n if (!this.isTouching) return\n\n const { clientX } = e.touches[0]\n const offsetSize = clientX - this.startX\n\n this.setState({\n offsetSize\n })\n }\n\n private animateMoveSlide = (offset: number, callback?: () => void): void => {\n this.setState(\n {\n isAnimate: true\n },\n () => {\n this.setState({\n offsetSize: offset\n })\n setTimeout(() => {\n this.setState(\n {\n isAnimate: false\n },\n () => {\n callback?.()\n }\n )\n }, ANIMTE_DURATION)\n }\n )\n }\n\n private handleTouchEnd = (): void => {\n if (!this.props.isSwiper) {\n return\n }\n\n const { offsetSize } = this.state\n\n this.isTouching = false\n const isRight = offsetSize > 0\n\n const breakpoint = this.maxWidth / 2\n const absOffsetSize = Math.abs(offsetSize)\n\n if (absOffsetSize > breakpoint) {\n const res = isRight ? this.maxWidth : -this.maxWidth\n return this.animateMoveSlide(res, () => {\n this.props.onSwipeMonth(isRight ? -1 : 1)\n })\n }\n this.animateMoveSlide(0)\n }\n\n private handleChange = (\n e: BaseEventOrig<{\n current: number\n source: string\n }>\n ): void => {\n const { current, source } = e.detail\n\n if (source === 'touch') {\n this.currentSwiperIndex = current\n this.changeCount += 1\n }\n }\n\n private handleAnimateFinish = (): void => {\n if (this.changeCount > 0) {\n this.props.onSwipeMonth(\n this.isPreMonth ? -this.changeCount : this.changeCount\n )\n this.changeCount = 0\n }\n }\n\n private handleSwipeTouchStart = (\n e: ITouchEvent & { changedTouches: Array<ITouch> }\n ): void => {\n const { clientY, clientX } = e.changedTouches[0]\n this.swipeStartPoint = this.props.isVertical ? clientY : clientX\n }\n\n private handleSwipeTouchEnd = (\n e: ITouchEvent & { changedTouches: Array<ITouch> }\n ): void => {\n const { clientY, clientX } = e.changedTouches[0]\n this.isPreMonth = this.props.isVertical\n ? clientY - this.swipeStartPoint > 0\n : clientX - this.swipeStartPoint > 0\n }\n\n public render(): JSX.Element {\n const { isSwiper } = this.props\n const { isAnimate, offsetSize, listGroup } = this.state\n\n if (!isSwiper) {\n return (\n <View\n className={classnames(\n 'main',\n 'at-calendar-slider__main',\n `at-calendar-slider__main--${process.env.TARO_ENV}`\n )}\n >\n <AtCalendarDayList />\n <View className='main__body body'>\n <View className='body__slider body__slider--now'>\n <AtCalendarDateList\n list={listGroup[1].list}\n onClick={this.props.onDayClick}\n onLongClick={this.props.onLongClick}\n />\n </View>\n </View>\n </View>\n )\n }\n\n /* 需要 Taro 组件库维护 Swiper 使 小程序 和 H5 的表现保持一致 */\n if (process.env.TARO_ENV === 'h5') {\n return (\n <View\n className={classnames(\n 'main',\n 'at-calendar-slider__main',\n `at-calendar-slider__main--${process.env.TARO_ENV}`\n )}\n onTouchEnd={this.handleTouchEnd}\n onTouchMove={this.handleTouchMove}\n onTouchStart={this.handleTouchStart}\n >\n <AtCalendarDayList />\n <View\n className={classnames('main__body body', {\n 'main__body--slider': isSwiper,\n 'main__body--animate': isAnimate\n })}\n style={{\n transform: isSwiper\n ? `translateX(-100%) translate3d(${offsetSize},0,0)`\n : '',\n WebkitTransform: isSwiper\n ? `translateX(-100%) translate3d(${offsetSize}px,0,0)`\n : ''\n }}\n >\n <View className='body__slider body__slider--pre'>\n <AtCalendarDateList list={listGroup[0].list} />\n </View>\n <View className='body__slider body__slider--now'>\n <AtCalendarDateList\n list={listGroup[1].list}\n onClick={this.props.onDayClick}\n onLongClick={this.props.onLongClick}\n />\n </View>\n <View className='body__slider body__slider--next'>\n <AtCalendarDateList list={listGroup[2].list} />\n </View>\n </View>\n </View>\n )\n }\n\n return (\n <View\n className={classnames(\n 'main',\n 'at-calendar-slider__main',\n `at-calendar-slider__main--${process.env.TARO_ENV}`\n )}\n >\n <AtCalendarDayList />\n <Swiper\n circular\n current={1}\n skipHiddenItemLayout\n className={classnames('main__body')}\n onChange={this.handleChange}\n vertical={this.props.isVertical}\n onAnimationFinish={this.handleAnimateFinish}\n onTouchEnd={this.handleSwipeTouchEnd}\n onTouchStart={this.handleSwipeTouchStart}\n >\n {listGroup.map((item, key) => (\n <SwiperItem key={key} itemId={key.toString()}>\n <AtCalendarDateList\n list={item.list}\n onClick={this.props.onDayClick}\n onLongClick={this.props.onLongClick}\n />\n </SwiperItem>\n ))}\n </Swiper>\n </View>\n )\n }\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,SAAS,QAAQ,YAAY,YAAY;AAYzC,SAAS,0BAA0B;AACnC,OAAO,2BAA2B;AAClC,OAAO,wBAAwB;AAC/B,OAAO,uBAAuB;A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AC,EAAE;AAAA,cACnB,SAAS,KAAK,MAAM;AAAA,cACpB,aAAa,KAAK,MAAM;AAAA;AAAA,UAC1B,CACF;AAAA,UACA,oCAAC,QAAK,WAAU,qCACd,oCAAC,sBAAmB,MAAM,UAAU,CAAC,EAAE,MAAM,CAC/C;AAAA,QACF;AAAA,MACF;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA,6BAA6B,QAAQ,IAAI,QAAQ;AAAA,QACnD;AAAA;AAAA,MAEA,oCAAC,uBAAkB;AAAA,MACnB;AAAA,QAAC;AAAA;AAAA,UACC,UAAQ;AAAA,UACR,SAAS;AAAA,UACT,sBAAoB;AAAA,UACpB,WAAW,WAAW,YAAY;AAAA,UAClC,UAAU,KAAK;AAAA,UACf,UAAU,KAAK,MAAM;AAAA,UACrB,mBAAmB,KAAK;AAAA,UACxB,YAAY,KAAK;AAAA,UACjB,cAAc,KAAK;AAAA;AAAA,QAElB,UAAU,IAAI,CAAC,MAAM,QACpB,oCAAC,cAAW,KAAU,QAAQ,IAAI,SAAS,KACzC;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,KAAK;AAAA,YACX,SAAS,KAAK,MAAM;AAAA,YACpB,aAAa,KAAK,MAAM;AAAA;AAAA,QAC1B,CACF,CACD;AAAA,MACH;AAAA,IACF;AAAA,EAEJ;AACF;AA5UqB,eAIZ,eAA6C;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/calendar/common/constant.ts"],"sourcesContent":["export const TYPE_PRE_MONTH = -1\n\nexport const TYPE_NOW_MONTH = 0\n\nexport const TYPE_NEXT_MONTH = 1\n"],"mappings":"AAAO,MAAM,iBAAiB;AAEvB,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;","names":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { Calendar } from '../../../../types/calendar';
|
|
3
|
+
export default function generateCalendarGroup(options: Calendar.GroupOptions): (generateDate: number, selectedDate: Calendar.SelectedDate, isShowStatus?: boolean) => Calendar.ListInfo<Calendar.Item>;
|
|
4
|
+
export declare function getGenerateDate(date: Calendar.DateArg | undefined): Dayjs;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import _flow from "lodash/flow";
|
|
3
|
+
import * as constant from "./constant";
|
|
4
|
+
import plugins from "./plugins";
|
|
5
|
+
const TOTAL = 7 * 6;
|
|
6
|
+
function getFullItem(item, options, selectedDate, isShowStatus) {
|
|
7
|
+
if (options.marks.find((x) => x.value === item.value)) {
|
|
8
|
+
item.marks = [
|
|
9
|
+
{
|
|
10
|
+
value: item.value
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
if (!isShowStatus) return item;
|
|
15
|
+
const bindedPlugins = plugins.map(
|
|
16
|
+
(fn) => fn.bind(null, {
|
|
17
|
+
options,
|
|
18
|
+
selectedDate
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
return _flow(bindedPlugins)(item);
|
|
22
|
+
}
|
|
23
|
+
function generateCalendarGroup(options) {
|
|
24
|
+
return function(generateDate, selectedDate, isShowStatus) {
|
|
25
|
+
const date = dayjs(generateDate);
|
|
26
|
+
const { format } = options;
|
|
27
|
+
const firstDate = date.startOf("month");
|
|
28
|
+
const lastDate = date.endOf("month");
|
|
29
|
+
const preMonthDate = date.subtract(1, "month");
|
|
30
|
+
const list = [];
|
|
31
|
+
const nowMonthDays = date.daysInMonth();
|
|
32
|
+
const preMonthLastDay = preMonthDate.endOf("month").day();
|
|
33
|
+
for (let i2 = 1; i2 <= preMonthLastDay + 1; i2++) {
|
|
34
|
+
const thisDate = firstDate.subtract(i2, "day").startOf("day");
|
|
35
|
+
let item = {
|
|
36
|
+
marks: [],
|
|
37
|
+
_value: thisDate,
|
|
38
|
+
text: thisDate.date(),
|
|
39
|
+
type: constant.TYPE_PRE_MONTH,
|
|
40
|
+
value: thisDate.format(format)
|
|
41
|
+
};
|
|
42
|
+
item = getFullItem(item, options, selectedDate, isShowStatus);
|
|
43
|
+
list.push(item);
|
|
44
|
+
}
|
|
45
|
+
list.reverse();
|
|
46
|
+
for (let i2 = 0; i2 < nowMonthDays; i2++) {
|
|
47
|
+
const thisDate = firstDate.add(i2, "day").startOf("day");
|
|
48
|
+
let item = {
|
|
49
|
+
marks: [],
|
|
50
|
+
_value: thisDate,
|
|
51
|
+
text: thisDate.date(),
|
|
52
|
+
type: constant.TYPE_NOW_MONTH,
|
|
53
|
+
value: thisDate.format(format)
|
|
54
|
+
};
|
|
55
|
+
item = getFullItem(item, options, selectedDate, isShowStatus);
|
|
56
|
+
list.push(item);
|
|
57
|
+
}
|
|
58
|
+
let i = 1;
|
|
59
|
+
while (list.length < TOTAL) {
|
|
60
|
+
const thisDate = lastDate.add(i++, "day").startOf("day");
|
|
61
|
+
let item = {
|
|
62
|
+
marks: [],
|
|
63
|
+
_value: thisDate,
|
|
64
|
+
text: thisDate.date(),
|
|
65
|
+
type: constant.TYPE_NEXT_MONTH,
|
|
66
|
+
value: thisDate.format(format)
|
|
67
|
+
};
|
|
68
|
+
item = getFullItem(item, options, selectedDate, isShowStatus);
|
|
69
|
+
list.push(item);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
list,
|
|
73
|
+
value: generateDate
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function getGenerateDate(date) {
|
|
78
|
+
return dayjs(date).startOf("month");
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
generateCalendarGroup as default,
|
|
82
|
+
getGenerateDate
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/calendar/common/helper.ts"],"sourcesContent":["import dayjs, { Dayjs } from 'dayjs'\nimport _flow from 'lodash/flow'\nimport { Calendar } from '../../../../types/calendar'\nimport * as constant from './constant'\nimport plugins from './plugins'\n\nconst TOTAL = 7 * 6\n\nfunction getFullItem(\n item: Partial<Calendar.Item>,\n options: Calendar.GroupOptions,\n selectedDate: Calendar.SelectedDate,\n isShowStatus?: boolean\n): any {\n if (options.marks.find(x => x.value === item.value)) {\n item.marks = [\n {\n value: item.value as string\n }\n ]\n }\n if (!isShowStatus) return item\n\n const bindedPlugins = plugins.map(fn =>\n fn.bind(null, {\n options,\n selectedDate\n })\n )\n return _flow(bindedPlugins)(item)\n}\n\nexport default function generateCalendarGroup(\n options: Calendar.GroupOptions\n): (\n generateDate: number,\n selectedDate: Calendar.SelectedDate,\n isShowStatus?: boolean\n) => Calendar.ListInfo<Calendar.Item> {\n return function (\n generateDate: number,\n selectedDate: Calendar.SelectedDate,\n isShowStatus?: boolean\n ): Calendar.ListInfo<Calendar.Item> {\n const date = dayjs(generateDate)\n\n const { format } = options\n\n // 获取生成日期的第一天 和 最后一天\n const firstDate = date.startOf('month')\n const lastDate = date.endOf('month')\n\n const preMonthDate = date.subtract(1, 'month')\n\n const list: Calendar.List<Calendar.Item> = []\n\n const nowMonthDays: number = date.daysInMonth() // 获取这个月有多少天\n const preMonthLastDay = preMonthDate.endOf('month').day() // 获取上个月最后一天是周几\n\n // 生成上个月的日期\n for (let i = 1; i <= preMonthLastDay + 1; i++) {\n const thisDate = firstDate.subtract(i, 'day').startOf('day')\n\n let item = {\n marks: [],\n _value: thisDate,\n text: thisDate.date(),\n type: constant.TYPE_PRE_MONTH,\n value: thisDate.format(format)\n }\n\n item = getFullItem(item, options, selectedDate, isShowStatus)\n\n list.push(item)\n }\n list.reverse()\n\n // 生成这个月的日期\n for (let i = 0; i < nowMonthDays; i++) {\n const thisDate = firstDate.add(i, 'day').startOf('day')\n let item = {\n marks: [],\n _value: thisDate,\n text: thisDate.date(),\n type: constant.TYPE_NOW_MONTH,\n value: thisDate.format(format)\n }\n\n item = getFullItem(item, options, selectedDate, isShowStatus)\n\n list.push(item)\n }\n\n // 生成下个月的日期\n let i = 1\n while (list.length < TOTAL) {\n const thisDate = lastDate.add(i++, 'day').startOf('day')\n let item = {\n marks: [],\n _value: thisDate,\n text: thisDate.date(),\n type: constant.TYPE_NEXT_MONTH,\n value: thisDate.format(format)\n }\n\n item = getFullItem(item, options, selectedDate, isShowStatus)\n\n list.push(item)\n }\n\n return {\n list,\n value: generateDate\n }\n }\n}\n\nexport function getGenerateDate(date: Calendar.DateArg | undefined): Dayjs {\n return dayjs(date).startOf('month')\n}\n"],"mappings":"AAAA,OAAO,WAAsB;AAC7B,OAAO,WAAW;AAElB,YAAY,cAAc;AAC1B,OAAO,aAAa;AAEpB,MAAM,QAAQ,IAAI;AAElB,SAAS,YACP,MACA,SACA,cACA,cACK;AACL,MAAI,QAAQ,MAAM,KAAK,OAAK,EAAE,UAAU,KAAK,KAAK,GAAG;AACnD,SAAK,QAAQ;AAAA,MACX;AAAA,QACE,OAAO,KAAK;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACA,MAAI,CAAC,aAAc,QAAO;AAE1B,QAAM,gBAAgB,QAAQ;AAAA,IAAI,QAChC,GAAG,KAAK,MAAM;AAAA,MACZ;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO,MAAM,aAAa,EAAE,IAAI;AAClC;AAEe,SAAR,sBACL,SAKoC;AACpC,SAAO,SACL,cACA,cACA,cACkC;AAClC,UAAM,OAAO,MAAM,YAAY;AAE/B,UAAM,EAAE,OAAO,IAAI;AAGnB,UAAM,YAAY,KAAK,QAAQ,OAAO;AACtC,UAAM,WAAW,KAAK,MAAM,OAAO;AAEnC,UAAM,eAAe,KAAK,SAAS,GAAG,OAAO;AAE7C,UAAM,OAAqC,CAAC;AAE5C,UAAM,eAAuB,KAAK,YAAY;AAC9C,UAAM,kBAAkB,aAAa,MAAM,OAAO,EAAE,IAAI;AAGxD,aAASA,KAAI,GAAGA,MAAK,kBAAkB,G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../../../../types/calendar';
|
|
2
|
+
interface PluginArg {
|
|
3
|
+
options: Calendar.GroupOptions;
|
|
4
|
+
selectedDate: Calendar.SelectedDate;
|
|
5
|
+
}
|
|
6
|
+
export declare function handleActive(args: PluginArg, item: Calendar.Item): Calendar.Item;
|
|
7
|
+
export declare function handleMarks(args: PluginArg, item: Calendar.Item): Calendar.Item;
|
|
8
|
+
export declare function handleDisabled(args: PluginArg, item: Calendar.Item): Calendar.Item;
|
|
9
|
+
export declare function handleValid(args: PluginArg, item: Calendar.Item): Calendar.Item;
|
|
10
|
+
declare const _default: (typeof handleActive)[];
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import _isEmpty from "lodash/isEmpty";
|
|
3
|
+
function handleActive(args, item) {
|
|
4
|
+
const { selectedDate } = args;
|
|
5
|
+
const { _value } = item;
|
|
6
|
+
const { start, end } = selectedDate;
|
|
7
|
+
const dayjsEnd = dayjs(end);
|
|
8
|
+
const dayjsStart = start ? dayjs(start) : dayjsEnd;
|
|
9
|
+
item.isSelected = (_value == null ? void 0 : _value.isSame(dayjsEnd)) || (_value == null ? void 0 : _value.isSame(dayjsStart)) || (_value == null ? void 0 : _value.isAfter(dayjsStart)) && (_value == null ? void 0 : _value.isBefore(dayjsEnd));
|
|
10
|
+
item.isSelectedHead = _value == null ? void 0 : _value.isSame(dayjsStart);
|
|
11
|
+
item.isSelectedTail = _value == null ? void 0 : _value.isSame(dayjsEnd);
|
|
12
|
+
item.isToday = (_value == null ? void 0 : _value.diff(dayjs(Date.now()).startOf("day"), "day")) === 0;
|
|
13
|
+
return item;
|
|
14
|
+
}
|
|
15
|
+
function handleMarks(args, item) {
|
|
16
|
+
const { options } = args;
|
|
17
|
+
const { _value } = item;
|
|
18
|
+
const { marks } = options;
|
|
19
|
+
const markList = marks.filter(
|
|
20
|
+
(mark) => _value ? dayjs(mark.value).startOf("day").isSame(_value) : false
|
|
21
|
+
);
|
|
22
|
+
item.marks = markList.slice(0, 1);
|
|
23
|
+
return item;
|
|
24
|
+
}
|
|
25
|
+
function handleDisabled(args, item) {
|
|
26
|
+
const { options } = args;
|
|
27
|
+
const { _value } = item;
|
|
28
|
+
const { minDate, maxDate } = options;
|
|
29
|
+
const dayjsMinDate = dayjs(minDate);
|
|
30
|
+
const dayjsMaxDate = dayjs(maxDate);
|
|
31
|
+
item.isDisabled = !!(minDate && (_value == null ? void 0 : _value.isBefore(dayjsMinDate))) || !!(maxDate && (_value == null ? void 0 : _value.isAfter(dayjsMaxDate)));
|
|
32
|
+
return item;
|
|
33
|
+
}
|
|
34
|
+
function handleValid(args, item) {
|
|
35
|
+
const { options } = args;
|
|
36
|
+
const { _value } = item;
|
|
37
|
+
const { validDates } = options;
|
|
38
|
+
if (!_isEmpty(validDates)) {
|
|
39
|
+
const isInclude = validDates.some(
|
|
40
|
+
(date) => _value ? dayjs(date.value).startOf("day").isSame(_value) : false
|
|
41
|
+
);
|
|
42
|
+
item.isDisabled = !isInclude;
|
|
43
|
+
}
|
|
44
|
+
delete item._value;
|
|
45
|
+
return item;
|
|
46
|
+
}
|
|
47
|
+
var plugins_default = [handleActive, handleMarks, handleDisabled, handleValid];
|
|
48
|
+
export {
|
|
49
|
+
plugins_default as default,
|
|
50
|
+
handleActive,
|
|
51
|
+
handleDisabled,
|
|
52
|
+
handleMarks,
|
|
53
|
+
handleValid
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/calendar/common/plugins.ts"],"sourcesContent":["import dayjs from 'dayjs'\nimport _isEmpty from 'lodash/isEmpty'\nimport { Calendar } from '../../../../types/calendar'\n\ninterface PluginArg {\n options: Calendar.GroupOptions\n\n selectedDate: Calendar.SelectedDate\n}\n\nexport function handleActive(\n args: PluginArg,\n item: Calendar.Item\n): Calendar.Item {\n const { selectedDate } = args\n const { _value } = item\n\n const { start, end } = selectedDate\n\n const dayjsEnd = dayjs(end)\n const dayjsStart = start ? dayjs(start) : dayjsEnd\n\n item.isSelected =\n _value?.isSame(dayjsEnd) ||\n _value?.isSame(dayjsStart) ||\n (_value?.isAfter(dayjsStart) && _value?.isBefore(dayjsEnd))\n\n item.isSelectedHead = _value?.isSame(dayjsStart)\n item.isSelectedTail = _value?.isSame(dayjsEnd)\n\n item.isToday = _value?.diff(dayjs(Date.now()).startOf('day'), 'day') === 0\n\n return item\n}\n\nexport function handleMarks(\n args: PluginArg,\n item: Calendar.Item\n): Calendar.Item {\n const { options } = args\n const { _value } = item\n const { marks } = options\n\n const markList = marks.filter(mark =>\n _value ? dayjs(mark.value).startOf('day').isSame(_value) : false\n )\n\n item.marks = markList.slice(0, 1)\n\n return item\n}\n\n// export function handleSelectedDates (args: PluginArg): Calendar.Item {\n// const { item, options } = args\n// const { _value } = item\n// const { selectedDates } = options\n\n// if (selectedDates.length === 0) return args\n\n// _forEach(selectedDates, date => {\n// const { isSelected, isHead, isTail } = item\n\n// // 如果当前 Item 已经具备了 三种状态下 无需继续判断 跳出循环\n// if (isSelected) {\n// return false\n// }\n\n// const { start, end } = date\n\n// const dayjsEnd = dayjs(end).startOf('day')\n// const dayjsStart = dayjs(start).startOf('day')\n\n// item.isSelected =\n// item.isSelected ||\n// (_value.isAfter(dayjsStart) && _value.isBefore(dayjsEnd))\n\n// item.isHead = item.isHead || _value.isSame(dayjsStart)\n\n// item.isTail = item.isTail || _value.isSame(dayjsEnd)\n// })\n\n// return item\n// }\n\nexport function handleDisabled(\n args: PluginArg,\n item: Calendar.Item\n): Calendar.Item {\n const { options } = args\n const { _value } = item\n const { minDate, maxDate } = options\n\n const dayjsMinDate = dayjs(minDate)\n const dayjsMaxDate = dayjs(maxDate)\n\n item.isDisabled =\n !!(minDate && _value?.isBefore(dayjsMinDate)) ||\n !!(maxDate && _value?.isAfter(dayjsMaxDate))\n\n return item\n}\n\nexport function handleValid(\n args: PluginArg,\n item: Calendar.Item\n): Calendar.Item {\n const { options } = args\n const { _value } = item\n const { validDates } = options\n\n if (!_isEmpty(validDates)) {\n const isInclude = validDates.some(date =>\n _value ? dayjs(date.value).startOf('day').isSame(_value) : false\n )\n\n item.isDisabled = !isInclude\n }\n\n delete item._value\n\n return item\n}\n\nexport default [handleActive, handleMarks, handleDisabled, handleValid]\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,OAAO,cAAc;AASd,SAAS,aACd,MACA,MACe;AACf,QAAM,EAAE,aAAa,IAAI;AACzB,QAAM,EAAE,OAAO,IAAI;AAEnB,QAAM,EAAE,OAAO,IAAI,IAAI;AAEvB,QAAM,WAAW,MAAM,GAAG;AAC1B,QAAM,aAAa,QAAQ,MAAM,KAAK,IAAI;AAE1C,OAAK,cACH,iCAAQ,OAAO,eACf,iCAAQ,OAAO,iBACd,iCAAQ,QAAQ,iBAAe,iCAAQ,SAAS;AAEnD,OAAK,iBAAiB,iCAAQ,OAAO;AACrC,OAAK,iBAAiB,iCAAQ,OAAO;AAErC,OAAK,WAAU,iCAAQ,KAAK,MAAM,KAAK,IAAI,CAAC,EAAE,QAAQ,KAAK,GAAG,YAAW;AAEzE,SAAO;AACT;AAEO,SAAS,YACd,MACA,MACe;AACf,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,EAAE,MAAM,IAAI;AAElB,QAAM,WAAW,MAAM;AAAA,IAAO,UAC5B,SAAS,MAAM,KAAK,KAAK,EAAE,QAAQ,KAAK,EAAE,OAAO,MAAM,IAAI;AAAA,EAC7D;AAEA,OAAK,QAAQ,SAAS,MAAM,GAAG,CAAC;AAEhC,SAAO;AACT;AAkCO,SAAS,eACd,MACA,MACe;AACf,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,EAAE,SAAS,QAAQ,IAAI;AAE7B,QAAM,eAAe,MAAM,OAAO;AAClC,QAAM,eAAe,MAAM,OAAO;AAElC,OAAK,aACH,CAAC,EAAE,YAAW,iCAAQ,SAAS,mBAC/B,CAAC,EAAE,YAAW,iCAAQ,QAAQ;AAEhC,SAAO;AACT;AAEO,SAAS,YACd,MACA,MACe;AACf,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,EAAE,WAAW,IAAI;AAEvB,MAAI,CAAC,SAAS,UAAU,GAAG;AACzB,UAAM,YAAY,WAAW;AAAA,MAAK,UAChC,SAAS,MAAM,KAAK,KAAK,EAAE,QAAQ,KAAK,EAAE,OAAO,MAAM,IAAI;AAAA,IAC7D;AAEA,SAAK,aAAa,CAAC;AAAA,EACrB;AAEA,SAAO,KAAK;AAEZ,SAAO;AACT;AAEA,IAAO,kBAAQ,CAAC,cAAc,aAAa,gBAAgB,WAAW;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AtCalendarControllerProps, AtCalendarControllerState } from '../../../../types/calendar';
|
|
3
|
+
export default class AtCalendarController extends React.Component<AtCalendarControllerProps, AtCalendarControllerState> {
|
|
4
|
+
render(): JSX.Element;
|
|
5
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import classnames from "classnames";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Picker, Text, View } from "@tarojs/components";
|
|
5
|
+
class AtCalendarController extends React.Component {
|
|
6
|
+
render() {
|
|
7
|
+
const { generateDate, minDate, maxDate, monthFormat, hideArrow } = this.props;
|
|
8
|
+
const dayjsDate = dayjs(generateDate);
|
|
9
|
+
const dayjsMinDate = !!minDate && dayjs(minDate);
|
|
10
|
+
const dayjsMaxDate = !!maxDate && dayjs(maxDate);
|
|
11
|
+
const isMinMonth = dayjsMinDate && dayjsMinDate.startOf("month").isSame(dayjsDate);
|
|
12
|
+
const isMaxMonth = dayjsMaxDate && dayjsMaxDate.startOf("month").isSame(dayjsDate);
|
|
13
|
+
const minDateValue = dayjsMinDate ? dayjsMinDate.format("YYYY-MM") : "";
|
|
14
|
+
const maxDateValue = dayjsMaxDate ? dayjsMaxDate.format("YYYY-MM") : "";
|
|
15
|
+
return /* @__PURE__ */ React.createElement(View, { className: "at-calendar__controller controller" }, hideArrow ? null : /* @__PURE__ */ React.createElement(
|
|
16
|
+
View,
|
|
17
|
+
{
|
|
18
|
+
className: classnames("controller__arrow controller__arrow--left", {
|
|
19
|
+
"controller__arrow--disabled": isMinMonth
|
|
20
|
+
}),
|
|
21
|
+
onClick: this.props.onPreMonth.bind(this, isMinMonth)
|
|
22
|
+
}
|
|
23
|
+
), /* @__PURE__ */ React.createElement(
|
|
24
|
+
Picker,
|
|
25
|
+
{
|
|
26
|
+
mode: "date",
|
|
27
|
+
fields: "month",
|
|
28
|
+
end: maxDateValue,
|
|
29
|
+
start: minDateValue,
|
|
30
|
+
onChange: this.props.onSelectDate,
|
|
31
|
+
value: dayjsDate.format("YYYY-MM")
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ React.createElement(Text, { className: "controller__info" }, dayjsDate.format(monthFormat))
|
|
34
|
+
), hideArrow ? null : /* @__PURE__ */ React.createElement(
|
|
35
|
+
View,
|
|
36
|
+
{
|
|
37
|
+
className: classnames(
|
|
38
|
+
"controller__arrow controller__arrow--right",
|
|
39
|
+
{
|
|
40
|
+
"controller__arrow--disabled": isMaxMonth
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
onClick: this.props.onNextMonth.bind(this, isMaxMonth)
|
|
44
|
+
}
|
|
45
|
+
));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
AtCalendarController as default
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/calendar/controller/index.tsx"],"sourcesContent":["import classnames from 'classnames'\nimport dayjs, { Dayjs } from 'dayjs'\nimport React from 'react'\nimport { Picker, Text, View } from '@tarojs/components'\nimport {\n AtCalendarControllerProps,\n AtCalendarControllerState\n} from '../../../../types/calendar'\n\nexport default class AtCalendarController extends React.Component<\n AtCalendarControllerProps,\n AtCalendarControllerState\n> {\n public render(): JSX.Element {\n const { generateDate, minDate, maxDate, monthFormat, hideArrow } =\n this.props\n\n const dayjsDate: Dayjs = dayjs(generateDate)\n const dayjsMinDate: Dayjs | boolean = !!minDate && dayjs(minDate)\n const dayjsMaxDate: Dayjs | boolean = !!maxDate && dayjs(maxDate)\n\n const isMinMonth: boolean =\n dayjsMinDate && dayjsMinDate.startOf('month').isSame(dayjsDate)\n\n const isMaxMonth: boolean =\n dayjsMaxDate && dayjsMaxDate.startOf('month').isSame(dayjsDate)\n\n const minDateValue: string = dayjsMinDate\n ? dayjsMinDate.format('YYYY-MM')\n : ''\n const maxDateValue: string = dayjsMaxDate\n ? dayjsMaxDate.format('YYYY-MM')\n : ''\n\n return (\n <View className='at-calendar__controller controller'>\n {hideArrow ? null : (\n <View\n className={classnames('controller__arrow controller__arrow--left', {\n 'controller__arrow--disabled': isMinMonth\n })}\n onClick={this.props.onPreMonth.bind(this, isMinMonth)}\n />\n )}\n <Picker\n mode='date'\n fields='month'\n end={maxDateValue}\n start={minDateValue}\n onChange={this.props.onSelectDate}\n value={dayjsDate.format('YYYY-MM')}\n >\n <Text className='controller__info'>\n {dayjsDate.format(monthFormat)}\n </Text>\n </Picker>\n {hideArrow ? null : (\n <View\n className={classnames(\n 'controller__arrow controller__arrow--right',\n {\n 'controller__arrow--disabled': isMaxMonth\n }\n )}\n onClick={this.props.onNextMonth.bind(this, isMaxMonth)}\n />\n )}\n </View>\n )\n }\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,WAAsB;AAC7B,OAAO,WAAW;AAClB,SAAS,QAAQ,MAAM,YAAY;AAMnC,MAAO,6BAA2C,MAAM,UAGtD;AAAA,EACO,SAAsB;AAC3B,UAAM,EAAE,cAAc,SAAS,SAAS,aAAa,UAAU,IAC7D,KAAK;AAEP,UAAM,YAAmB,MAAM,YAAY;AAC3C,UAAM,eAAgC,CAAC,CAAC,WAAW,MAAM,OAAO;AAChE,UAAM,eAAgC,CAAC,CAAC,WAAW,MAAM,OAAO;AAEhE,UAAM,aACJ,gBAAgB,aAAa,QAAQ,OAAO,EAAE,OAAO,SAAS;AAEhE,UAAM,aACJ,gBAAgB,aAAa,QAAQ,OAAO,EAAE,OAAO,SAAS;AAEhE,UAAM,eAAuB,eACzB,aAAa,OAAO,SAAS,IAC7B;AACJ,UAAM,eAAuB,eACzB,aAAa,OAAO,SAAS,IAC7B;AAEJ,WACE,oCAAC,QAAK,WAAU,wCACb,YAAY,OACX;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,WAAW,6CAA6C;AAAA,UACjE,+BAA+B;AAAA,QACjC,CAAC;AAAA,QACD,SAAS,KAAK,MAAM,WAAW,KAAK,MAAM,UAAU;AAAA;AAAA,IACtD,GAEF;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,QAAO;AAAA,QACP,KAAK;AAAA,QACL,OAAO;AAAA,QACP,UAAU,KAAK,MAAM;AAAA,QACrB,OAAO,UAAU,OAAO,SAAS;AAAA;AAAA,MAEjC,oCAAC,QAAK,WAAU,sBACb,UAAU,OAAO,WAAW,CAC/B;AAAA,IACF,GACC,YAAY,OACX;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA;AAAA,YACE,+BAA+B;AAAA,UACjC;AAAA,QACF;AAAA,QACA,SAAS,KAAK,MAAM,YAAY,KAAK,MAAM,UAAU;AAAA;AAAA,IACvD,CAEJ;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AtCalendarDefaultProps, AtCalendarProps, AtCalendarState } from '../../../types/calendar';
|
|
3
|
+
export default class AtCalendar extends React.Component<AtCalendarProps, Readonly<AtCalendarState>> {
|
|
4
|
+
static defaultProps: AtCalendarDefaultProps;
|
|
5
|
+
constructor(props: AtCalendarProps);
|
|
6
|
+
UNSAFE_componentWillReceiveProps(nextProps: AtCalendarProps): void;
|
|
7
|
+
private getSingleSelectdState;
|
|
8
|
+
private getMultiSelectedState;
|
|
9
|
+
private getSelectedDate;
|
|
10
|
+
private getInitializeState;
|
|
11
|
+
private triggerChangeDate;
|
|
12
|
+
private setMonth;
|
|
13
|
+
private handleClickPreMonth;
|
|
14
|
+
private handleClickNextMonth;
|
|
15
|
+
private handleSelectDate;
|
|
16
|
+
private handleDayClick;
|
|
17
|
+
private handleSelectedDate;
|
|
18
|
+
private handleDayLongClick;
|
|
19
|
+
render(): JSX.Element;
|
|
20
|
+
}
|