taro-ui 3.3.2 → 3.4.0
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/README.md +85 -0
- package/{lib → dist}/common/utils.d.ts +2 -1
- package/{lib → dist}/common/utils.js +3 -0
- package/{lib → dist}/common/utils.js.map +1 -1
- package/dist/components/accordion/index.d.ts +17 -0
- package/dist/components/accordion/index.js +101 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/action-sheet/body/index.d.ts +3 -0
- package/dist/components/action-sheet/body/index.js +15 -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 +25 -0
- package/dist/components/action-sheet/footer/index.js.map +1 -0
- package/dist/components/action-sheet/header/index.d.ts +3 -0
- package/dist/components/action-sheet/header/index.js +15 -0
- package/dist/components/action-sheet/header/index.js.map +1 -0
- package/dist/components/action-sheet/index.d.ts +13 -0
- package/dist/components/action-sheet/index.js +72 -0
- package/dist/components/action-sheet/index.js.map +1 -0
- package/dist/components/activity-indicator/index.d.ts +14 -0
- package/dist/components/activity-indicator/index.js +36 -0
- package/dist/components/activity-indicator/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +15 -0
- package/dist/components/avatar/index.js +61 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +13 -0
- package/dist/components/badge/index.js +35 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/button/index.d.ts +30 -0
- package/dist/components/button/index.js +162 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/calendar/body/index.d.ts +3 -0
- package/dist/components/calendar/body/index.js +269 -0
- package/dist/components/calendar/body/index.js.map +1 -0
- package/dist/components/calendar/controller/index.d.ts +3 -0
- package/dist/components/calendar/controller/index.js +55 -0
- package/dist/components/calendar/controller/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.js +262 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/{lib → dist}/components/calendar/ui/date-list/index.d.ts +2 -6
- package/dist/components/calendar/ui/date-list/index.js +49 -0
- package/dist/components/calendar/ui/date-list/index.js.map +1 -0
- package/dist/components/calendar/ui/day-list/index.d.ts +2 -0
- package/dist/components/calendar/ui/day-list/index.js +12 -0
- package/dist/components/calendar/ui/day-list/index.js.map +1 -0
- package/dist/components/card/index.d.ts +17 -0
- package/dist/components/card/index.js +79 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +13 -0
- package/dist/components/checkbox/index.js +54 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/config-provider/context.d.ts +6 -0
- package/dist/components/config-provider/context.js +13 -0
- package/dist/components/config-provider/context.js.map +1 -0
- package/dist/components/config-provider/index.d.ts +7 -0
- package/dist/components/config-provider/index.js +15 -0
- package/dist/components/config-provider/index.js.map +1 -0
- package/dist/components/countdown/index.d.ts +20 -0
- package/dist/components/countdown/index.js +217 -0
- package/dist/components/countdown/index.js.map +1 -0
- package/dist/components/countdown/item/index.d.ts +10 -0
- package/dist/components/countdown/item/index.js +21 -0
- package/dist/components/countdown/item/index.js.map +1 -0
- package/dist/components/curtain/index.d.ts +13 -0
- package/dist/components/curtain/index.js +53 -0
- package/dist/components/curtain/index.js.map +1 -0
- package/dist/components/divider/index.d.ts +15 -0
- package/dist/components/divider/index.js +48 -0
- package/dist/components/divider/index.js.map +1 -0
- package/dist/components/drawer/index.d.ts +14 -0
- package/dist/components/drawer/index.js +121 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +10 -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 +13 -0
- package/{lib → dist}/components/flex/index.js +17 -18
- package/dist/components/flex/index.js.map +1 -0
- package/dist/components/flex/item/index.d.ts +13 -0
- package/dist/components/flex/item/index.js +33 -0
- package/dist/components/flex/item/index.js.map +1 -0
- package/dist/components/float-layout/index.d.ts +21 -0
- package/dist/components/float-layout/index.js +88 -0
- package/dist/components/float-layout/index.js.map +1 -0
- package/dist/components/form/index.d.ts +13 -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 +24 -0
- package/dist/components/grid/index.js +96 -0
- package/dist/components/grid/index.js.map +1 -0
- package/dist/components/icon/index.d.ts +15 -0
- package/dist/components/icon/index.js +44 -0
- package/dist/components/icon/index.js.map +1 -0
- package/dist/components/image-picker/index.d.ts +21 -0
- package/dist/components/image-picker/index.js +145 -0
- package/dist/components/image-picker/index.js.map +1 -0
- package/dist/components/indexes/index.d.ts +17 -0
- package/dist/components/indexes/index.js +261 -0
- package/dist/components/indexes/index.js.map +1 -0
- package/dist/components/input/index.d.ts +39 -0
- package/dist/components/input/index.js +223 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input-number/index.d.ts +22 -0
- package/dist/components/input-number/index.js +174 -0
- package/dist/components/input-number/index.js.map +1 -0
- package/dist/components/list/index.d.ts +9 -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 +29 -0
- package/dist/components/list/item/index.js +124 -0
- package/dist/components/list/item/index.js.map +1 -0
- package/dist/components/load-more/index.d.ts +17 -0
- package/dist/components/load-more/index.js +51 -0
- package/dist/components/load-more/index.js.map +1 -0
- package/dist/components/loading/index.d.ts +13 -0
- package/dist/components/loading/index.js +26 -0
- package/dist/components/loading/index.js.map +1 -0
- package/dist/components/message/index.d.ts +10 -0
- package/dist/components/message/index.js +64 -0
- package/dist/components/message/index.js.map +1 -0
- package/dist/components/modal/action/index.d.ts +9 -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 +3 -0
- package/dist/components/modal/content/index.js +15 -0
- package/dist/components/modal/content/index.js.map +1 -0
- package/dist/components/modal/header/index.d.ts +3 -0
- package/dist/components/modal/header/index.js +15 -0
- package/dist/components/modal/header/index.js.map +1 -0
- package/dist/components/modal/index.d.ts +17 -0
- package/dist/components/modal/index.js +92 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/nav-bar/index.d.ts +22 -0
- package/dist/components/nav-bar/index.js +201 -0
- package/dist/components/nav-bar/index.js.map +1 -0
- package/dist/components/noticebar/index.d.ts +18 -0
- package/dist/components/noticebar/index.js +173 -0
- package/dist/components/noticebar/index.js.map +1 -0
- package/dist/components/pagination/index.d.ts +14 -0
- package/dist/components/pagination/index.js +90 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/progress/index.d.ts +13 -0
- package/dist/components/progress/index.js +56 -0
- package/dist/components/progress/index.js.map +1 -0
- package/dist/components/radio/index.d.ts +13 -0
- package/dist/components/radio/index.js +50 -0
- package/dist/components/radio/index.js.map +1 -0
- package/dist/components/range/index.d.ts +20 -0
- package/dist/components/range/index.js +200 -0
- package/dist/components/range/index.js.map +1 -0
- package/dist/components/rate/index.d.ts +15 -0
- package/dist/components/rate/index.js +67 -0
- package/dist/components/rate/index.js.map +1 -0
- package/dist/components/search-bar/index.d.ts +24 -0
- package/dist/components/search-bar/index.js +150 -0
- package/dist/components/search-bar/index.js.map +1 -0
- package/dist/components/segmented-control/index.d.ts +16 -0
- package/dist/components/segmented-control/index.js +70 -0
- package/dist/components/segmented-control/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +22 -0
- package/dist/components/slider/index.js +91 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/steps/index.d.ts +13 -0
- package/dist/components/steps/index.js +62 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/swipe-action/index.d.ts +14 -0
- package/dist/components/swipe-action/index.js +223 -0
- package/dist/components/swipe-action/index.js.map +1 -0
- package/dist/components/swipe-action/options/index.d.ts +3 -0
- package/dist/components/swipe-action/options/index.js +25 -0
- package/dist/components/swipe-action/options/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +16 -0
- package/dist/components/switch/index.js +54 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/tab-bar/index.d.ts +19 -0
- package/dist/components/tab-bar/index.js +143 -0
- package/dist/components/tab-bar/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +18 -0
- package/dist/components/tabs/index.js +230 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs-pane/index.d.ts +13 -0
- package/dist/components/tabs-pane/index.js +41 -0
- package/dist/components/tabs-pane/index.js.map +1 -0
- package/dist/components/tag/index.d.ts +16 -0
- package/dist/components/tag/index.js +66 -0
- package/dist/components/tag/index.js.map +1 -0
- package/dist/components/textarea/index.d.ts +31 -0
- package/dist/components/textarea/index.js +121 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/timeline/index.d.ts +11 -0
- package/dist/components/timeline/index.js +70 -0
- package/dist/components/timeline/index.js.map +1 -0
- package/dist/components/toast/img.json +5 -0
- package/dist/components/toast/index.d.ts +17 -0
- package/dist/components/toast/index.js +115 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/hooks/useComponentLocale.d.ts +2 -0
- package/dist/hooks/useComponentLocale.js +12 -0
- package/dist/hooks/useComponentLocale.js.map +1 -0
- package/{lib → dist}/index.d.ts +3 -0
- package/dist/index.esm.js +5856 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +5937 -0
- package/dist/index.js.map +1 -0
- package/dist/locale/en_US.d.ts +3 -0
- package/dist/locale/en_US.js +34 -0
- package/dist/locale/en_US.js.map +1 -0
- package/dist/locale/index.d.ts +4 -0
- package/dist/locale/index.js +10 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/types.d.ts +34 -0
- package/dist/locale/types.js +1 -0
- package/dist/locale/types.js.map +1 -0
- package/dist/locale/zh_CN.d.ts +3 -0
- package/dist/locale/zh_CN.js +34 -0
- package/dist/locale/zh_CN.js.map +1 -0
- package/{lib → dist}/style/components/avatar.scss +1 -1
- package/{lib → dist}/style/components/badge.scss +7 -2
- package/{lib → dist}/style/components/calendar.scss +1 -1
- package/{lib → dist}/style/components/countdown.scss +2 -1
- package/{lib → dist}/style/components/flex.scss +1 -1
- package/{lib → dist}/style/components/grid.scss +2 -2
- package/{lib → dist}/style/components/icon.scss +302 -101
- package/{lib → dist}/style/components/input.scss +2 -2
- package/{lib → dist}/style/components/progress.scss +1 -1
- package/{lib → dist}/style/components/search-bar.scss +1 -1
- package/{lib → dist}/style/components/steps.scss +2 -2
- package/{lib → dist}/style/components/tabs.scss +1 -1
- package/{lib → dist}/style/components/tag.scss +1 -1
- package/{lib → dist}/style/components/timeline.scss +1 -1
- package/{lib → dist}/style/components/toast.scss +7 -3
- package/{lib → dist}/style/index.css +176 -176
- package/dist/style/index.css.map +1 -0
- package/{lib → dist}/style/mixins/libs/hairline.scss +4 -19
- package/{lib → dist}/style/mixins/libs/shade.scss +3 -6
- package/{lib → dist}/style/mixins/libs/tint.scss +4 -7
- package/{lib → dist}/style/themes/purple.scss +15 -15
- package/{lib → dist}/style/themes/red.scss +16 -13
- package/{lib → dist}/style/variables/default.scss +69 -73
- package/package.json +45 -12
- package/rn/components/accordion/index.tsx +2 -9
- package/rn/components/action-sheet/body/index.tsx +1 -3
- package/rn/components/action-sheet/body/item/index.tsx +1 -3
- package/rn/components/action-sheet/footer/index.tsx +1 -3
- package/rn/components/action-sheet/header/index.tsx +1 -3
- package/rn/components/activity-indicator/index.tsx +1 -3
- package/rn/components/avatar/index.tsx +5 -5
- package/rn/components/calendar/controller/index.tsx +2 -7
- package/rn/components/card/index.tsx +4 -4
- package/rn/components/countdown/index.scss +5 -4
- package/rn/components/countdown/item/index.tsx +1 -3
- package/rn/components/curtain/index.tsx +5 -5
- package/rn/components/flex/index.scss +2 -2
- package/rn/components/flex/item/index.scss +2 -2
- package/rn/components/grid/index.tsx +15 -15
- package/rn/components/icon/index.tsx +4 -4
- package/rn/components/image-picker/index.tsx +7 -7
- package/rn/components/pagination/index.tsx +7 -7
- package/rn/components/progress/index.tsx +5 -5
- package/rn/components/radio/index.tsx +7 -7
- package/rn/components/rate/index.tsx +4 -4
- package/rn/components/segmented-control/index.tsx +8 -8
- package/rn/components/slider/index.tsx +9 -9
- package/rn/components/steps/index.tsx +8 -8
- package/rn/components/swipe-action/options/index.tsx +1 -3
- package/rn/components/switch/index.tsx +2 -9
- package/rn/components/toast/img.json +3 -6
- package/rn/components/toast/index.tsx +8 -8
- package/rn/style/components/accordion.scss +1 -1
- package/rn/style/components/action-sheet.scss +1 -1
- package/rn/style/components/avatar.scss +1 -1
- package/rn/style/components/badge.scss +8 -3
- package/rn/style/components/button.scss +1 -1
- package/rn/style/components/calendar.scss +1 -1
- package/rn/style/components/checkbox.scss +1 -1
- package/rn/style/components/curtain.scss +1 -1
- package/rn/style/components/fab.scss +1 -4
- package/rn/style/components/flex.scss +1 -1
- package/rn/style/components/grid.scss +2 -6
- package/rn/style/components/icon.scss +302 -101
- package/rn/style/components/index.scss +41 -41
- package/rn/style/components/input.scss +1 -1
- package/rn/style/components/list.scss +2 -4
- package/rn/style/components/loading.scss +4 -4
- package/rn/style/components/message.scss +1 -1
- package/rn/style/components/modal.scss +0 -2
- package/rn/style/components/nav-bar.scss +3 -3
- package/rn/style/components/noticebar.scss +0 -4
- package/rn/style/components/progress.scss +1 -1
- package/rn/style/components/radio.scss +2 -2
- package/rn/style/components/range.scss +1 -1
- package/rn/style/components/search-bar.scss +1 -1
- package/rn/style/components/segmented-control.scss +4 -1
- package/rn/style/components/slider.scss +0 -1
- package/rn/style/components/steps.scss +3 -3
- package/rn/style/components/switch.scss +0 -1
- package/rn/style/components/tabs.scss +2 -2
- package/rn/style/components/tag.scss +1 -1
- package/rn/style/components/timeline.scss +0 -2
- package/rn/style/components/toast.scss +5 -2
- package/rn/style/index.scss +1 -1
- package/rn/style/mixins/libs/hairline.scss +4 -22
- package/rn/style/mixins/libs/shade.scss +1 -4
- package/rn/style/mixins/libs/tint.scss +2 -5
- package/rn/style/themes/purple.scss +15 -15
- package/rn/style/themes/red.scss +16 -13
- package/rn/style/variables/default.scss +69 -73
- package/lib/components/accordion/index.d.ts +0 -14
- package/lib/components/accordion/index.js +0 -121
- package/lib/components/accordion/index.js.map +0 -1
- package/lib/components/action-sheet/body/index.d.ts +0 -5
- package/lib/components/action-sheet/body/index.js +0 -13
- package/lib/components/action-sheet/body/index.js.map +0 -1
- package/lib/components/action-sheet/body/item/index.d.ts +0 -9
- package/lib/components/action-sheet/body/item/index.js +0 -25
- package/lib/components/action-sheet/body/item/index.js.map +0 -1
- package/lib/components/action-sheet/footer/index.d.ts +0 -9
- package/lib/components/action-sheet/footer/index.js +0 -28
- package/lib/components/action-sheet/footer/index.js.map +0 -1
- package/lib/components/action-sheet/header/index.d.ts +0 -5
- package/lib/components/action-sheet/header/index.js +0 -16
- package/lib/components/action-sheet/header/index.js.map +0 -1
- package/lib/components/action-sheet/index.d.ts +0 -14
- package/lib/components/action-sheet/index.js +0 -76
- package/lib/components/action-sheet/index.js.map +0 -1
- package/lib/components/activity-indicator/index.d.ts +0 -8
- package/lib/components/activity-indicator/index.js +0 -39
- package/lib/components/activity-indicator/index.js.map +0 -1
- package/lib/components/avatar/index.d.ts +0 -9
- package/lib/components/avatar/index.js +0 -67
- package/lib/components/avatar/index.js.map +0 -1
- package/lib/components/badge/index.d.ts +0 -10
- package/lib/components/badge/index.js +0 -51
- package/lib/components/badge/index.js.map +0 -1
- package/lib/components/button/index.d.ts +0 -15
- package/lib/components/button/index.js +0 -177
- package/lib/components/button/index.js.map +0 -1
- package/lib/components/calendar/body/index.d.ts +0 -26
- package/lib/components/calendar/body/index.js +0 -289
- package/lib/components/calendar/body/index.js.map +0 -1
- package/lib/components/calendar/controller/index.d.ts +0 -5
- package/lib/components/calendar/controller/index.js +0 -51
- package/lib/components/calendar/controller/index.js.map +0 -1
- package/lib/components/calendar/index.d.ts +0 -20
- package/lib/components/calendar/index.js +0 -244
- package/lib/components/calendar/index.js.map +0 -1
- package/lib/components/calendar/ui/date-list/index.js +0 -54
- package/lib/components/calendar/ui/date-list/index.js.map +0 -1
- package/lib/components/calendar/ui/day-list/index.d.ts +0 -4
- package/lib/components/calendar/ui/day-list/index.js +0 -11
- package/lib/components/calendar/ui/day-list/index.js.map +0 -1
- package/lib/components/card/index.d.ts +0 -9
- package/lib/components/card/index.js +0 -80
- package/lib/components/card/index.js.map +0 -1
- package/lib/components/checkbox/index.d.ts +0 -9
- package/lib/components/checkbox/index.js +0 -59
- package/lib/components/checkbox/index.js.map +0 -1
- package/lib/components/countdown/index.d.ts +0 -20
- package/lib/components/countdown/index.js +0 -152
- package/lib/components/countdown/index.js.map +0 -1
- package/lib/components/countdown/item/index.d.ts +0 -9
- package/lib/components/countdown/item/index.js +0 -24
- package/lib/components/countdown/item/index.js.map +0 -1
- package/lib/components/curtain/index.d.ts +0 -10
- package/lib/components/curtain/index.js +0 -62
- package/lib/components/curtain/index.js.map +0 -1
- package/lib/components/divider/index.d.ts +0 -8
- package/lib/components/divider/index.js +0 -57
- package/lib/components/divider/index.js.map +0 -1
- package/lib/components/drawer/index.d.ts +0 -16
- package/lib/components/drawer/index.js +0 -114
- package/lib/components/drawer/index.js.map +0 -1
- package/lib/components/fab/index.d.ts +0 -9
- package/lib/components/fab/index.js +0 -29
- package/lib/components/fab/index.js.map +0 -1
- package/lib/components/flex/index.d.ts +0 -7
- package/lib/components/flex/index.js.map +0 -1
- package/lib/components/flex/item/index.d.ts +0 -7
- package/lib/components/flex/item/index.js +0 -34
- package/lib/components/flex/item/index.js.map +0 -1
- package/lib/components/float-layout/index.d.ts +0 -13
- package/lib/components/float-layout/index.js +0 -104
- package/lib/components/float-layout/index.js.map +0 -1
- package/lib/components/form/index.d.ts +0 -10
- package/lib/components/form/index.js +0 -43
- package/lib/components/form/index.js.map +0 -1
- package/lib/components/grid/index.d.ts +0 -9
- package/lib/components/grid/index.js +0 -101
- package/lib/components/grid/index.js.map +0 -1
- package/lib/components/icon/index.d.ts +0 -9
- package/lib/components/icon/index.js +0 -54
- package/lib/components/icon/index.js.map +0 -1
- package/lib/components/image-picker/index.d.ts +0 -11
- package/lib/components/image-picker/index.js +0 -164
- package/lib/components/image-picker/index.js.map +0 -1
- package/lib/components/indexes/index.d.ts +0 -29
- package/lib/components/indexes/index.js +0 -272
- package/lib/components/indexes/index.js.map +0 -1
- package/lib/components/input/index.d.ts +0 -17
- package/lib/components/input/index.js +0 -232
- package/lib/components/input/index.js.map +0 -1
- package/lib/components/input-number/index.d.ts +0 -13
- package/lib/components/input-number/index.js +0 -193
- package/lib/components/input-number/index.js.map +0 -1
- package/lib/components/list/index.d.ts +0 -8
- package/lib/components/list/index.js +0 -26
- package/lib/components/list/index.js.map +0 -1
- package/lib/components/list/item/index.d.ts +0 -11
- package/lib/components/list/item/index.js +0 -152
- package/lib/components/list/item/index.js.map +0 -1
- package/lib/components/load-more/index.d.ts +0 -9
- package/lib/components/load-more/index.js +0 -72
- package/lib/components/load-more/index.js.map +0 -1
- package/lib/components/loading/index.d.ts +0 -12
- package/lib/components/loading/index.js +0 -32
- package/lib/components/loading/index.js.map +0 -1
- package/lib/components/message/index.d.ts +0 -15
- package/lib/components/message/index.js +0 -78
- package/lib/components/message/index.js.map +0 -1
- package/lib/components/modal/action/index.d.ts +0 -8
- package/lib/components/modal/action/index.js +0 -26
- package/lib/components/modal/action/index.js.map +0 -1
- package/lib/components/modal/content/index.d.ts +0 -5
- package/lib/components/modal/content/index.js +0 -13
- package/lib/components/modal/content/index.js.map +0 -1
- package/lib/components/modal/header/index.d.ts +0 -5
- package/lib/components/modal/header/index.js +0 -13
- package/lib/components/modal/header/index.js.map +0 -1
- package/lib/components/modal/index.d.ts +0 -15
- package/lib/components/modal/index.js +0 -106
- package/lib/components/modal/index.js.map +0 -1
- package/lib/components/nav-bar/index.d.ts +0 -12
- package/lib/components/nav-bar/index.js +0 -217
- package/lib/components/nav-bar/index.js.map +0 -1
- package/lib/components/noticebar/index.d.ts +0 -16
- package/lib/components/noticebar/index.js +0 -186
- package/lib/components/noticebar/index.js.map +0 -1
- package/lib/components/pagination/index.d.ts +0 -12
- package/lib/components/pagination/index.js +0 -146
- package/lib/components/pagination/index.js.map +0 -1
- package/lib/components/progress/index.d.ts +0 -7
- package/lib/components/progress/index.js +0 -53
- package/lib/components/progress/index.js.map +0 -1
- package/lib/components/radio/index.d.ts +0 -9
- package/lib/components/radio/index.js +0 -54
- package/lib/components/radio/index.js.map +0 -1
- package/lib/components/range/index.d.ts +0 -22
- package/lib/components/range/index.js +0 -207
- package/lib/components/range/index.js.map +0 -1
- package/lib/components/rate/index.d.ts +0 -9
- package/lib/components/rate/index.js +0 -82
- package/lib/components/rate/index.js.map +0 -1
- package/lib/components/search-bar/index.d.ts +0 -16
- package/lib/components/search-bar/index.js +0 -176
- package/lib/components/search-bar/index.js.map +0 -1
- package/lib/components/segmented-control/index.d.ts +0 -9
- package/lib/components/segmented-control/index.js +0 -84
- package/lib/components/segmented-control/index.js.map +0 -1
- package/lib/components/slider/index.d.ts +0 -13
- package/lib/components/slider/index.js +0 -115
- package/lib/components/slider/index.js.map +0 -1
- package/lib/components/steps/index.d.ts +0 -9
- package/lib/components/steps/index.js +0 -67
- package/lib/components/steps/index.js.map +0 -1
- package/lib/components/swipe-action/index.d.ts +0 -27
- package/lib/components/swipe-action/index.js +0 -220
- package/lib/components/swipe-action/index.js.map +0 -1
- package/lib/components/swipe-action/options/index.d.ts +0 -5
- package/lib/components/swipe-action/options/index.js +0 -24
- package/lib/components/swipe-action/options/index.js.map +0 -1
- package/lib/components/switch/index.d.ts +0 -9
- package/lib/components/switch/index.js +0 -59
- package/lib/components/switch/index.js.map +0 -1
- package/lib/components/tab-bar/index.d.ts +0 -9
- package/lib/components/tab-bar/index.js +0 -170
- package/lib/components/tab-bar/index.js.map +0 -1
- package/lib/components/tabs/index.d.ts +0 -24
- package/lib/components/tabs/index.js +0 -219
- package/lib/components/tabs/index.js.map +0 -1
- package/lib/components/tabs-pane/index.d.ts +0 -8
- package/lib/components/tabs-pane/index.js +0 -43
- package/lib/components/tabs-pane/index.js.map +0 -1
- package/lib/components/tag/index.d.ts +0 -9
- package/lib/components/tag/index.js +0 -75
- package/lib/components/tag/index.js.map +0 -1
- package/lib/components/textarea/index.d.ts +0 -13
- package/lib/components/textarea/index.js +0 -141
- package/lib/components/textarea/index.js.map +0 -1
- package/lib/components/timeline/index.d.ts +0 -8
- package/lib/components/timeline/index.js +0 -76
- package/lib/components/timeline/index.js.map +0 -1
- package/lib/components/toast/img.json +0 -8
- package/lib/components/toast/index.d.ts +0 -16
- package/lib/components/toast/index.js +0 -124
- package/lib/components/toast/index.js.map +0 -1
- package/lib/index.js +0 -109
- package/lib/index.js.map +0 -1
- package/lib/style/index.css.map +0 -1
- /package/{lib → dist}/common/component.d.ts +0 -0
- /package/{lib → dist}/common/component.js +0 -0
- /package/{lib → dist}/common/component.js.map +0 -0
- /package/{lib → dist}/components/calendar/common/constant.d.ts +0 -0
- /package/{lib → dist}/components/calendar/common/constant.js +0 -0
- /package/{lib → dist}/components/calendar/common/constant.js.map +0 -0
- /package/{lib → dist}/components/calendar/common/helper.d.ts +0 -0
- /package/{lib → dist}/components/calendar/common/helper.js +0 -0
- /package/{lib → dist}/components/calendar/common/helper.js.map +0 -0
- /package/{lib → dist}/components/calendar/common/plugins.d.ts +0 -0
- /package/{lib → dist}/components/calendar/common/plugins.js +0 -0
- /package/{lib → dist}/components/calendar/common/plugins.js.map +0 -0
- /package/{lib → dist}/style/components/accordion.scss +0 -0
- /package/{lib → dist}/style/components/action-sheet.scss +0 -0
- /package/{lib → dist}/style/components/activity-indicator.scss +0 -0
- /package/{lib → dist}/style/components/article.scss +0 -0
- /package/{lib → dist}/style/components/button.scss +0 -0
- /package/{lib → dist}/style/components/card.scss +0 -0
- /package/{lib → dist}/style/components/checkbox.scss +0 -0
- /package/{lib → dist}/style/components/curtain.scss +0 -0
- /package/{lib → dist}/style/components/divider.scss +0 -0
- /package/{lib → dist}/style/components/drawer.scss +0 -0
- /package/{lib → dist}/style/components/fab.scss +0 -0
- /package/{lib → dist}/style/components/float-layout.scss +0 -0
- /package/{lib → dist}/style/components/form.scss +0 -0
- /package/{lib → dist}/style/components/image-picker.scss +0 -0
- /package/{lib → dist}/style/components/index.scss +0 -0
- /package/{lib → dist}/style/components/indexes.scss +0 -0
- /package/{lib → dist}/style/components/input-number.scss +0 -0
- /package/{lib → dist}/style/components/list.scss +0 -0
- /package/{lib → dist}/style/components/load-more.scss +0 -0
- /package/{lib → dist}/style/components/loading.scss +0 -0
- /package/{lib → dist}/style/components/message.scss +0 -0
- /package/{lib → dist}/style/components/modal.scss +0 -0
- /package/{lib → dist}/style/components/nav-bar.scss +0 -0
- /package/{lib → dist}/style/components/noticebar.scss +0 -0
- /package/{lib → dist}/style/components/pagination.scss +0 -0
- /package/{lib → dist}/style/components/radio.scss +0 -0
- /package/{lib → dist}/style/components/range.scss +0 -0
- /package/{lib → dist}/style/components/rate.scss +0 -0
- /package/{lib → dist}/style/components/segmented-control.scss +0 -0
- /package/{lib → dist}/style/components/slider.scss +0 -0
- /package/{lib → dist}/style/components/swipe-action.scss +0 -0
- /package/{lib → dist}/style/components/switch.scss +0 -0
- /package/{lib → dist}/style/components/tab-bar.scss +0 -0
- /package/{lib → dist}/style/components/textarea.scss +0 -0
- /package/{lib → dist}/style/index.scss +0 -0
- /package/{lib → dist}/style/mixins/index.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/absolute-center.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/active.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/alignhack.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/border.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/clearfix.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/disabled.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/flex.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/line.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/overlay.scss +0 -0
- /package/{lib → dist}/style/mixins/libs/placeholder.scss +0 -0
|
@@ -1,289 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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YAC3C;AAAA,YACN;AAAA;AAAA,UAEA,oCAAC,QAAK,WAAU,oCACd,oCAAC,sBAAmB,MAAM,UAAU,CAAC,EAAE,MAAM,CAC/C;AAAA,UACA,oCAAC,QAAK,WAAU,oCACd;AAAA,YAAC;AAAA;AAAA,cACC,MAAM,UAAU,CAAC,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":[]}
|
|
@@ -1,5 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import classnames from "classnames";
|
|
2
|
-
import dayjs from "dayjs";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { View } from "@tarojs/components";
|
|
5
|
-
import AtCalendarBody from "./body/index";
|
|
6
|
-
import AtCalendarController from "./controller/index";
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
validDates: [],
|
|
9
|
-
marks: [],
|
|
10
|
-
isSwiper: true,
|
|
11
|
-
hideArrow: false,
|
|
12
|
-
isVertical: false,
|
|
13
|
-
selectedDates: [],
|
|
14
|
-
isMultiSelect: false,
|
|
15
|
-
format: "YYYY-MM-DD",
|
|
16
|
-
currentDate: Date.now(),
|
|
17
|
-
monthFormat: "YYYY\u5E74MM\u6708"
|
|
18
|
-
};
|
|
19
|
-
class AtCalendar extends React.Component {
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
this.getSingleSelectdState = (value) => {
|
|
23
|
-
const { generateDate } = this.state;
|
|
24
|
-
const stateValue = {
|
|
25
|
-
selectedDate: this.getSelectedDate(value.valueOf())
|
|
26
|
-
};
|
|
27
|
-
const dayjsGenerateDate = value.startOf("month");
|
|
28
|
-
const generateDateValue = dayjsGenerateDate.valueOf();
|
|
29
|
-
if (generateDateValue !== generateDate) {
|
|
30
|
-
this.triggerChangeDate(dayjsGenerateDate);
|
|
31
|
-
stateValue.generateDate = generateDateValue;
|
|
32
|
-
}
|
|
33
|
-
return stateValue;
|
|
34
|
-
};
|
|
35
|
-
this.getMultiSelectedState = (value) => {
|
|
36
|
-
const { selectedDate } = this.state;
|
|
37
|
-
const { end, start } = selectedDate;
|
|
38
|
-
const valueUnix = value.valueOf();
|
|
39
|
-
const state = {
|
|
40
|
-
selectedDate
|
|
41
|
-
};
|
|
42
|
-
if (end) {
|
|
43
|
-
state.selectedDate = this.getSelectedDate(valueUnix, 0);
|
|
44
|
-
} else {
|
|
45
|
-
state.selectedDate.end = Math.max(valueUnix, +start);
|
|
46
|
-
state.selectedDate.start = Math.min(valueUnix, +start);
|
|
47
|
-
}
|
|
48
|
-
return state;
|
|
49
|
-
};
|
|
50
|
-
this.getSelectedDate = (start, end) => {
|
|
51
|
-
const stateValue = {
|
|
52
|
-
start,
|
|
53
|
-
end: start
|
|
54
|
-
};
|
|
55
|
-
if (typeof end !== "undefined") {
|
|
56
|
-
stateValue.end = end;
|
|
57
|
-
}
|
|
58
|
-
return stateValue;
|
|
59
|
-
};
|
|
60
|
-
this.triggerChangeDate = (value) => {
|
|
61
|
-
const { format } = this.props;
|
|
62
|
-
if (typeof this.props.onMonthChange !== "function") return;
|
|
63
|
-
this.props.onMonthChange(value.format(format));
|
|
64
|
-
};
|
|
65
|
-
this.setMonth = (vectorCount) => {
|
|
66
|
-
const { format } = this.props;
|
|
67
|
-
const { generateDate } = this.state;
|
|
68
|
-
const _generateDate = dayjs(generateDate).add(vectorCount, "month");
|
|
69
|
-
this.setState({
|
|
70
|
-
generateDate: _generateDate.valueOf()
|
|
71
|
-
});
|
|
72
|
-
if (vectorCount && typeof this.props.onMonthChange === "function") {
|
|
73
|
-
this.props.onMonthChange(_generateDate.format(format));
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
this.handleClickPreMonth = (isMinMonth) => {
|
|
77
|
-
if (isMinMonth === true) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.setMonth(-1);
|
|
81
|
-
if (typeof this.props.onClickPreMonth === "function") {
|
|
82
|
-
this.props.onClickPreMonth();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
this.handleClickNextMonth = (isMaxMonth) => {
|
|
86
|
-
if (isMaxMonth === true) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.setMonth(1);
|
|
90
|
-
if (typeof this.props.onClickNextMonth === "function") {
|
|
91
|
-
this.props.onClickNextMonth();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
// picker 选择时间改变时触发
|
|
95
|
-
this.handleSelectDate = (e) => {
|
|
96
|
-
const { value } = e.detail;
|
|
97
|
-
const _generateDate = dayjs(value);
|
|
98
|
-
const _generateDateValue = _generateDate.valueOf();
|
|
99
|
-
if (this.state.generateDate === _generateDateValue) return;
|
|
100
|
-
this.triggerChangeDate(_generateDate);
|
|
101
|
-
this.setState({
|
|
102
|
-
generateDate: _generateDateValue
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
this.handleDayClick = (item) => {
|
|
106
|
-
const { isMultiSelect } = this.props;
|
|
107
|
-
const { isDisabled, value } = item;
|
|
108
|
-
if (isDisabled) return;
|
|
109
|
-
const dayjsDate = dayjs(value);
|
|
110
|
-
let stateValue = {};
|
|
111
|
-
if (isMultiSelect) {
|
|
112
|
-
stateValue = this.getMultiSelectedState(dayjsDate);
|
|
113
|
-
} else {
|
|
114
|
-
stateValue = this.getSingleSelectdState(dayjsDate);
|
|
115
|
-
}
|
|
116
|
-
this.setState(stateValue, () => {
|
|
117
|
-
this.handleSelectedDate();
|
|
118
|
-
});
|
|
119
|
-
if (typeof this.props.onDayClick === "function") {
|
|
120
|
-
this.props.onDayClick({ value: item.value });
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
this.handleSelectedDate = () => {
|
|
124
|
-
const selectDate = this.state.selectedDate;
|
|
125
|
-
if (typeof this.props.onSelectDate === "function") {
|
|
126
|
-
const info = {
|
|
127
|
-
start: dayjs(selectDate.start).format(this.props.format)
|
|
128
|
-
};
|
|
129
|
-
if (selectDate.end) {
|
|
130
|
-
info.end = dayjs(selectDate.end).format(this.props.format);
|
|
131
|
-
}
|
|
132
|
-
this.props.onSelectDate({
|
|
133
|
-
value: info
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
this.handleDayLongClick = (item) => {
|
|
138
|
-
if (typeof this.props.onDayLongClick === "function") {
|
|
139
|
-
this.props.onDayLongClick({ value: item.value });
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const { currentDate, isMultiSelect } = props;
|
|
143
|
-
this.state = this.getInitializeState(currentDate, isMultiSelect);
|
|
144
|
-
}
|
|
145
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
146
|
-
const { currentDate, isMultiSelect } = nextProps;
|
|
147
|
-
if (!currentDate || currentDate === this.props.currentDate) return;
|
|
148
|
-
if (isMultiSelect && this.props.isMultiSelect) {
|
|
149
|
-
const { start, end } = currentDate;
|
|
150
|
-
const { start: preStart, end: preEnd } = this.props.currentDate;
|
|
151
|
-
if (start === preStart && preEnd === end) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
const stateValue = this.getInitializeState(
|
|
156
|
-
currentDate,
|
|
157
|
-
isMultiSelect
|
|
158
|
-
);
|
|
159
|
-
this.setState(stateValue);
|
|
160
|
-
}
|
|
161
|
-
getInitializeState(currentDate, isMultiSelect) {
|
|
162
|
-
let end;
|
|
163
|
-
let start;
|
|
164
|
-
let generateDateValue;
|
|
165
|
-
if (!currentDate) {
|
|
166
|
-
const dayjsStart = dayjs();
|
|
167
|
-
start = dayjsStart.startOf("day").valueOf();
|
|
168
|
-
generateDateValue = dayjsStart.startOf("month").valueOf();
|
|
169
|
-
return {
|
|
170
|
-
generateDate: generateDateValue,
|
|
171
|
-
selectedDate: {
|
|
172
|
-
start: ""
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
if (isMultiSelect) {
|
|
177
|
-
const { start: cStart, end: cEnd } = currentDate;
|
|
178
|
-
const dayjsStart = dayjs(cStart);
|
|
179
|
-
start = dayjsStart.startOf("day").valueOf();
|
|
180
|
-
generateDateValue = dayjsStart.startOf("month").valueOf();
|
|
181
|
-
end = cEnd ? dayjs(cEnd).startOf("day").valueOf() : start;
|
|
182
|
-
} else {
|
|
183
|
-
const dayjsStart = dayjs(currentDate);
|
|
184
|
-
start = dayjsStart.startOf("day").valueOf();
|
|
185
|
-
generateDateValue = dayjsStart.startOf("month").valueOf();
|
|
186
|
-
end = start;
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
generateDate: generateDateValue,
|
|
190
|
-
selectedDate: this.getSelectedDate(start, end)
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
render() {
|
|
194
|
-
const { generateDate, selectedDate } = this.state;
|
|
195
|
-
const {
|
|
196
|
-
validDates,
|
|
197
|
-
marks,
|
|
198
|
-
format,
|
|
199
|
-
minDate,
|
|
200
|
-
maxDate,
|
|
201
|
-
isSwiper,
|
|
202
|
-
className,
|
|
203
|
-
hideArrow,
|
|
204
|
-
isVertical,
|
|
205
|
-
monthFormat,
|
|
206
|
-
selectedDates
|
|
207
|
-
} = this.props;
|
|
208
|
-
return /* @__PURE__ */ React.createElement(View, { className: classnames("at-calendar", className) }, /* @__PURE__ */ React.createElement(
|
|
209
|
-
AtCalendarController,
|
|
210
|
-
{
|
|
211
|
-
minDate,
|
|
212
|
-
maxDate,
|
|
213
|
-
hideArrow,
|
|
214
|
-
monthFormat,
|
|
215
|
-
generateDate,
|
|
216
|
-
onPreMonth: this.handleClickPreMonth,
|
|
217
|
-
onNextMonth: this.handleClickNextMonth,
|
|
218
|
-
onSelectDate: this.handleSelectDate
|
|
219
|
-
}
|
|
220
|
-
), /* @__PURE__ */ React.createElement(
|
|
221
|
-
AtCalendarBody,
|
|
222
|
-
{
|
|
223
|
-
validDates,
|
|
224
|
-
marks,
|
|
225
|
-
format,
|
|
226
|
-
minDate,
|
|
227
|
-
maxDate,
|
|
228
|
-
isSwiper,
|
|
229
|
-
isVertical,
|
|
230
|
-
selectedDate,
|
|
231
|
-
selectedDates,
|
|
232
|
-
generateDate,
|
|
233
|
-
onDayClick: this.handleDayClick,
|
|
234
|
-
onSwipeMonth: this.setMonth,
|
|
235
|
-
onLongClick: this.handleDayLongClick
|
|
236
|
-
}
|
|
237
|
-
));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
AtCalendar.defaultProps = defaultProps;
|
|
241
|
-
export {
|
|
242
|
-
AtCalendar as default
|
|
243
|
-
};
|
|
244
|
-
//# sourceMappingURL=index.js.map
|