taro-ui 3.3.0 → 3.3.2
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 +21 -0
- package/lib/common/component.d.ts +10 -0
- package/lib/common/component.js +27 -28
- package/lib/common/component.js.map +1 -1
- package/lib/common/utils.d.ts +41 -0
- package/lib/common/utils.js +169 -192
- package/lib/common/utils.js.map +1 -1
- package/lib/components/accordion/index.d.ts +14 -0
- package/lib/components/accordion/index.js +111 -106
- package/lib/components/accordion/index.js.map +1 -1
- package/lib/components/action-sheet/body/index.d.ts +5 -0
- package/lib/components/action-sheet/body/index.js +11 -8
- package/lib/components/action-sheet/body/index.js.map +1 -1
- package/lib/components/action-sheet/body/item/index.d.ts +9 -0
- package/lib/components/action-sheet/body/item/index.js +21 -18
- package/lib/components/action-sheet/body/item/index.js.map +1 -1
- package/lib/components/action-sheet/footer/index.d.ts +9 -0
- package/lib/components/action-sheet/footer/index.js +24 -18
- package/lib/components/action-sheet/footer/index.js.map +1 -1
- package/lib/components/action-sheet/header/index.d.ts +5 -0
- package/lib/components/action-sheet/header/index.js +14 -8
- package/lib/components/action-sheet/header/index.js.map +1 -1
- package/lib/components/action-sheet/index.d.ts +14 -0
- package/lib/components/action-sheet/index.js +69 -64
- package/lib/components/action-sheet/index.js.map +1 -1
- package/lib/components/activity-indicator/index.d.ts +8 -0
- package/lib/components/activity-indicator/index.js +33 -29
- package/lib/components/activity-indicator/index.js.map +1 -1
- package/lib/components/avatar/index.d.ts +9 -0
- package/lib/components/avatar/index.js +58 -50
- package/lib/components/avatar/index.js.map +1 -1
- package/lib/components/badge/index.d.ts +10 -0
- package/lib/components/badge/index.js +44 -35
- package/lib/components/badge/index.js.map +1 -1
- package/lib/components/button/index.d.ts +15 -0
- package/lib/components/button/index.js +165 -113
- package/lib/components/button/index.js.map +1 -1
- package/lib/components/calendar/body/index.d.ts +26 -0
- package/lib/components/calendar/body/index.js +279 -183
- package/lib/components/calendar/body/index.js.map +1 -1
- package/lib/components/calendar/common/constant.d.ts +3 -0
- package/lib/components/calendar/common/constant.js +8 -3
- package/lib/components/calendar/common/constant.js.map +1 -1
- package/lib/components/calendar/common/helper.d.ts +4 -0
- package/lib/components/calendar/common/helper.js +77 -76
- package/lib/components/calendar/common/helper.js.map +1 -1
- package/lib/components/calendar/common/plugins.d.ts +11 -0
- package/lib/components/calendar/common/plugins.js +50 -66
- package/lib/components/calendar/common/plugins.js.map +1 -1
- package/lib/components/calendar/controller/index.d.ts +5 -0
- package/lib/components/calendar/controller/index.js +49 -28
- package/lib/components/calendar/controller/index.js.map +1 -1
- package/lib/components/calendar/index.d.ts +20 -0
- package/lib/components/calendar/index.js +233 -196
- package/lib/components/calendar/index.js.map +1 -1
- package/lib/components/calendar/ui/date-list/index.d.ts +12 -0
- package/lib/components/calendar/ui/date-list/index.js +50 -39
- package/lib/components/calendar/ui/date-list/index.js.map +1 -1
- package/lib/components/calendar/ui/day-list/index.d.ts +4 -0
- package/lib/components/calendar/ui/day-list/index.js +9 -14
- package/lib/components/calendar/ui/day-list/index.js.map +1 -1
- package/lib/components/card/index.d.ts +9 -0
- package/lib/components/card/index.js +73 -52
- package/lib/components/card/index.js.map +1 -1
- package/lib/components/checkbox/index.d.ts +9 -0
- package/lib/components/checkbox/index.js +52 -48
- package/lib/components/checkbox/index.js.map +1 -1
- package/lib/components/countdown/index.d.ts +20 -0
- package/lib/components/countdown/index.js +140 -125
- package/lib/components/countdown/index.js.map +1 -1
- package/lib/components/countdown/item/index.d.ts +9 -0
- package/lib/components/countdown/item/index.js +18 -18
- package/lib/components/countdown/item/index.js.map +1 -1
- package/lib/components/curtain/index.d.ts +10 -0
- package/lib/components/curtain/index.js +56 -39
- package/lib/components/curtain/index.js.map +1 -1
- package/lib/components/divider/index.d.ts +8 -0
- package/lib/components/divider/index.js +51 -34
- package/lib/components/divider/index.js.map +1 -1
- package/lib/components/drawer/index.d.ts +16 -0
- package/lib/components/drawer/index.js +106 -85
- package/lib/components/drawer/index.js.map +1 -1
- package/lib/components/fab/index.d.ts +9 -0
- package/lib/components/fab/index.js +22 -19
- package/lib/components/fab/index.js.map +1 -1
- package/lib/components/flex/index.d.ts +7 -0
- package/lib/components/flex/index.js +37 -34
- package/lib/components/flex/index.js.map +1 -1
- package/lib/components/flex/item/index.d.ts +7 -0
- package/lib/components/flex/item/index.js +30 -27
- package/lib/components/flex/item/index.js.map +1 -1
- package/lib/components/float-layout/index.d.ts +13 -0
- package/lib/components/float-layout/index.js +96 -68
- package/lib/components/float-layout/index.js.map +1 -1
- package/lib/components/form/index.d.ts +10 -0
- package/lib/components/form/index.js +37 -24
- package/lib/components/form/index.js.map +1 -1
- package/lib/components/grid/index.d.ts +9 -0
- package/lib/components/grid/index.js +92 -62
- package/lib/components/grid/index.js.map +1 -1
- package/lib/components/icon/index.d.ts +9 -0
- package/lib/components/icon/index.js +48 -31
- package/lib/components/icon/index.js.map +1 -1
- package/lib/components/image-picker/index.d.ts +11 -0
- package/lib/components/image-picker/index.js +152 -126
- package/lib/components/image-picker/index.js.map +1 -1
- package/lib/components/indexes/index.d.ts +29 -0
- package/lib/components/indexes/index.js +255 -198
- package/lib/components/indexes/index.js.map +1 -1
- package/lib/components/input/index.d.ts +17 -0
- package/lib/components/input/index.js +224 -160
- package/lib/components/input/index.js.map +1 -1
- package/lib/components/input-number/index.d.ts +13 -0
- package/lib/components/input-number/index.js +180 -152
- package/lib/components/input-number/index.js.map +1 -1
- package/lib/components/list/index.d.ts +8 -0
- package/lib/components/list/index.js +20 -13
- package/lib/components/list/index.js.map +1 -1
- package/lib/components/list/item/index.d.ts +11 -0
- package/lib/components/list/item/index.js +146 -99
- package/lib/components/list/item/index.js.map +1 -1
- package/lib/components/load-more/index.d.ts +9 -0
- package/lib/components/load-more/index.js +65 -41
- package/lib/components/load-more/index.js.map +1 -1
- package/lib/components/loading/index.d.ts +12 -0
- package/lib/components/loading/index.js +26 -26
- package/lib/components/loading/index.js.map +1 -1
- package/lib/components/message/index.d.ts +15 -0
- package/lib/components/message/index.js +72 -63
- package/lib/components/message/index.js.map +1 -1
- package/lib/components/modal/action/index.d.ts +8 -0
- package/lib/components/modal/action/index.js +20 -14
- package/lib/components/modal/action/index.js.map +1 -1
- package/lib/components/modal/content/index.d.ts +5 -0
- package/lib/components/modal/content/index.js +11 -8
- package/lib/components/modal/content/index.js.map +1 -1
- package/lib/components/modal/header/index.d.ts +5 -0
- package/lib/components/modal/header/index.js +11 -8
- package/lib/components/modal/header/index.js.map +1 -1
- package/lib/components/modal/index.d.ts +15 -0
- package/lib/components/modal/index.js +96 -87
- package/lib/components/modal/index.js.map +1 -1
- package/lib/components/nav-bar/index.d.ts +12 -0
- package/lib/components/nav-bar/index.js +210 -98
- package/lib/components/nav-bar/index.js.map +1 -1
- package/lib/components/noticebar/index.d.ts +16 -0
- package/lib/components/noticebar/index.js +177 -154
- package/lib/components/noticebar/index.js.map +1 -1
- package/lib/components/pagination/index.d.ts +12 -0
- package/lib/components/pagination/index.js +133 -102
- package/lib/components/pagination/index.js.map +1 -1
- package/lib/components/progress/index.d.ts +7 -0
- package/lib/components/progress/index.js +48 -40
- package/lib/components/progress/index.js.map +1 -1
- package/lib/components/radio/index.d.ts +9 -0
- package/lib/components/radio/index.js +48 -37
- package/lib/components/radio/index.js.map +1 -1
- package/lib/components/range/index.d.ts +22 -0
- package/lib/components/range/index.js +197 -142
- package/lib/components/range/index.js.map +1 -1
- package/lib/components/rate/index.d.ts +9 -0
- package/lib/components/rate/index.js +74 -48
- package/lib/components/rate/index.js.map +1 -1
- package/lib/components/search-bar/index.d.ts +16 -0
- package/lib/components/search-bar/index.js +167 -112
- package/lib/components/search-bar/index.js.map +1 -1
- package/lib/components/segmented-control/index.d.ts +9 -0
- package/lib/components/segmented-control/index.js +78 -53
- package/lib/components/segmented-control/index.js.map +1 -1
- package/lib/components/slider/index.d.ts +13 -0
- package/lib/components/slider/index.js +107 -69
- package/lib/components/slider/index.js.map +1 -1
- package/lib/components/steps/index.d.ts +9 -0
- package/lib/components/steps/index.js +61 -44
- package/lib/components/steps/index.js.map +1 -1
- package/lib/components/swipe-action/index.d.ts +27 -0
- package/lib/components/swipe-action/index.js +206 -157
- package/lib/components/swipe-action/index.js.map +1 -1
- package/lib/components/swipe-action/options/index.d.ts +5 -0
- package/lib/components/swipe-action/options/index.js +22 -8
- package/lib/components/swipe-action/options/index.js.map +1 -1
- package/lib/components/switch/index.d.ts +9 -0
- package/lib/components/switch/index.js +53 -42
- package/lib/components/switch/index.js.map +1 -1
- package/lib/components/tab-bar/index.d.ts +9 -0
- package/lib/components/tab-bar/index.js +164 -90
- package/lib/components/tab-bar/index.js.map +1 -1
- package/lib/components/tabs/index.d.ts +24 -0
- package/lib/components/tabs/index.js +203 -174
- package/lib/components/tabs/index.js.map +1 -1
- package/lib/components/tabs-pane/index.d.ts +8 -0
- package/lib/components/tabs-pane/index.js +37 -24
- package/lib/components/tabs-pane/index.js.map +1 -1
- package/lib/components/tag/index.d.ts +9 -0
- package/lib/components/tag/index.js +64 -44
- package/lib/components/tag/index.js.map +1 -1
- package/lib/components/textarea/index.d.ts +13 -0
- package/lib/components/textarea/index.js +132 -86
- package/lib/components/textarea/index.js.map +1 -1
- package/lib/components/timeline/index.d.ts +8 -0
- package/lib/components/timeline/index.js +70 -47
- package/lib/components/timeline/index.js.map +1 -1
- package/lib/components/toast/img.json +6 -3
- package/lib/components/toast/index.d.ts +16 -0
- package/lib/components/toast/index.js +111 -104
- package/lib/components/toast/index.js.map +1 -1
- package/lib/index.d.ts +53 -0
- package/lib/index.js +108 -54
- package/lib/index.js.map +1 -1
- package/{dist → lib}/style/components/curtain.scss +3 -3
- package/{dist → lib}/style/components/grid.scss +2 -2
- package/lib/style/components/index.scss +52 -0
- package/{dist → lib}/style/components/list.scss +2 -2
- package/{dist → lib}/style/components/range.scss +2 -2
- package/{dist → lib}/style/components/toast.scss +1 -1
- package/lib/style/index.css +11754 -0
- package/lib/style/index.css.map +1 -0
- package/lib/style/mixins/index.scss +18 -0
- package/{dist → lib}/style/mixins/libs/shade.scss +4 -2
- package/{dist → lib}/style/mixins/libs/tint.scss +4 -2
- package/{dist → lib}/style/variables/default.scss +1 -1
- package/package.json +45 -48
- 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/README.md +0 -85
- package/dist/index.esm.js +0 -8407
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -8468
- package/dist/index.js.map +0 -1
- 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/index.scss +0 -52
- 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/index.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/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
- /package/{dist → lib}/style/components/accordion.scss +0 -0
- /package/{dist → lib}/style/components/action-sheet.scss +0 -0
- /package/{dist → lib}/style/components/activity-indicator.scss +0 -0
- /package/{dist → lib}/style/components/article.scss +0 -0
- /package/{dist → lib}/style/components/avatar.scss +0 -0
- /package/{dist → lib}/style/components/badge.scss +0 -0
- /package/{dist → lib}/style/components/button.scss +0 -0
- /package/{dist → lib}/style/components/calendar.scss +0 -0
- /package/{dist → lib}/style/components/card.scss +0 -0
- /package/{dist → lib}/style/components/checkbox.scss +0 -0
- /package/{dist → lib}/style/components/countdown.scss +0 -0
- /package/{dist → lib}/style/components/divider.scss +0 -0
- /package/{dist → lib}/style/components/drawer.scss +0 -0
- /package/{dist → lib}/style/components/fab.scss +0 -0
- /package/{dist → lib}/style/components/flex.scss +0 -0
- /package/{dist → lib}/style/components/float-layout.scss +0 -0
- /package/{dist → lib}/style/components/form.scss +0 -0
- /package/{dist → lib}/style/components/icon.scss +0 -0
- /package/{dist → lib}/style/components/image-picker.scss +0 -0
- /package/{dist → lib}/style/components/indexes.scss +0 -0
- /package/{dist → lib}/style/components/input-number.scss +0 -0
- /package/{dist → lib}/style/components/input.scss +0 -0
- /package/{dist → lib}/style/components/load-more.scss +0 -0
- /package/{dist → lib}/style/components/loading.scss +0 -0
- /package/{dist → lib}/style/components/message.scss +0 -0
- /package/{dist → lib}/style/components/modal.scss +0 -0
- /package/{dist → lib}/style/components/nav-bar.scss +0 -0
- /package/{dist → lib}/style/components/noticebar.scss +0 -0
- /package/{dist → lib}/style/components/pagination.scss +0 -0
- /package/{dist → lib}/style/components/progress.scss +0 -0
- /package/{dist → lib}/style/components/radio.scss +0 -0
- /package/{dist → lib}/style/components/rate.scss +0 -0
- /package/{dist → lib}/style/components/search-bar.scss +0 -0
- /package/{dist → lib}/style/components/segmented-control.scss +0 -0
- /package/{dist → lib}/style/components/slider.scss +0 -0
- /package/{dist → lib}/style/components/steps.scss +0 -0
- /package/{dist → lib}/style/components/swipe-action.scss +0 -0
- /package/{dist → lib}/style/components/switch.scss +0 -0
- /package/{dist → lib}/style/components/tab-bar.scss +0 -0
- /package/{dist → lib}/style/components/tabs.scss +0 -0
- /package/{dist → lib}/style/components/tag.scss +0 -0
- /package/{dist → lib}/style/components/textarea.scss +0 -0
- /package/{dist → lib}/style/components/timeline.scss +0 -0
- /package/{dist → lib}/style/index.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/absolute-center.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/active.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/alignhack.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/border.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/clearfix.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/disabled.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/flex.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/hairline.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/line.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/overlay.scss +0 -0
- /package/{dist → lib}/style/mixins/libs/placeholder.scss +0 -0
- /package/{dist → lib}/style/themes/purple.scss +0 -0
- /package/{dist → lib}/style/themes/red.scss +0 -0
|
@@ -1,137 +1,152 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { View } from
|
|
5
|
-
import AtCountdownItem from
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
import AtCountdownItem from "./item";
|
|
6
6
|
const toSeconds = (day, hours, minutes, seconds) => day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds;
|
|
7
7
|
const defaultFormat = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
day: "\u5929",
|
|
9
|
+
hours: "\u65F6",
|
|
10
|
+
minutes: "\u5206",
|
|
11
|
+
seconds: "\u79D2"
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
class AtCountdown extends React.Component {
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
const { day = 0, hours = 0, minutes = 0, seconds = 0 } = this.props;
|
|
17
|
+
this.seconds = toSeconds(day, hours, minutes, seconds);
|
|
18
|
+
const {
|
|
19
|
+
day: _day,
|
|
20
|
+
hours: _hours,
|
|
21
|
+
minutes: _minutes,
|
|
22
|
+
seconds: _seconds
|
|
23
|
+
} = this.calculateTime();
|
|
24
|
+
this.state = {
|
|
25
|
+
_day,
|
|
26
|
+
_hours,
|
|
27
|
+
_minutes,
|
|
28
|
+
_seconds
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
setTimer() {
|
|
32
|
+
if (!this.timer) this.countdonwn();
|
|
33
|
+
}
|
|
34
|
+
clearTimer() {
|
|
35
|
+
if (this.timer) {
|
|
36
|
+
clearTimeout(this.timer);
|
|
37
|
+
this.timer = 0;
|
|
25
38
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
}
|
|
40
|
+
calculateTime() {
|
|
41
|
+
let [day, hours, minutes, seconds] = [0, 0, 0, 0];
|
|
42
|
+
if (this.seconds > 0) {
|
|
43
|
+
day = this.props.isShowDay ? Math.floor(this.seconds / (60 * 60 * 24)) : 0;
|
|
44
|
+
hours = this.props.isShowHour ? Math.floor(this.seconds / (60 * 60)) - day * 24 : 0;
|
|
45
|
+
minutes = this.props.isShowMinute ? Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60 : 0;
|
|
46
|
+
seconds = Math.floor(this.seconds) - day * 24 * 60 * 60 - hours * 60 * 60 - minutes * 60;
|
|
29
47
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
minutes * 60;
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
day,
|
|
54
|
-
hours,
|
|
55
|
-
minutes,
|
|
56
|
-
seconds
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
countdonwn() {
|
|
60
|
-
const { day, hours, minutes, seconds } = this.calculateTime();
|
|
61
|
-
this.setState({
|
|
62
|
-
_day: day,
|
|
63
|
-
_hours: hours,
|
|
64
|
-
_minutes: minutes,
|
|
65
|
-
_seconds: seconds
|
|
66
|
-
});
|
|
67
|
-
this.seconds--;
|
|
68
|
-
if (this.seconds < 0) {
|
|
69
|
-
this.clearTimer();
|
|
70
|
-
this.props.onTimeUp && this.props.onTimeUp();
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.timer = setTimeout(() => {
|
|
74
|
-
this.countdonwn();
|
|
75
|
-
}, 1000);
|
|
76
|
-
}
|
|
77
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
78
|
-
if (JSON.stringify(this.props) === JSON.stringify(nextProps))
|
|
79
|
-
return;
|
|
80
|
-
const { day = 0, hours = 0, minutes = 0, seconds = 0 } = nextProps;
|
|
81
|
-
this.seconds = toSeconds(day, hours, minutes, seconds);
|
|
82
|
-
this.clearTimer();
|
|
83
|
-
this.setTimer();
|
|
84
|
-
}
|
|
85
|
-
componentDidMount() {
|
|
86
|
-
this.setTimer();
|
|
87
|
-
}
|
|
88
|
-
componentWillUnmount() {
|
|
89
|
-
this.clearTimer();
|
|
90
|
-
}
|
|
91
|
-
componentDidHide() {
|
|
92
|
-
this.clearTimer();
|
|
93
|
-
}
|
|
94
|
-
componentDidShow() {
|
|
95
|
-
this.setTimer();
|
|
96
|
-
}
|
|
97
|
-
render() {
|
|
98
|
-
const { className, customStyle, format = defaultFormat, isCard, isShowDay, isShowHour, isShowMinute } = this.props;
|
|
99
|
-
const { _day, _hours, _minutes, _seconds } = this.state;
|
|
100
|
-
return (React.createElement(View, { className: classNames({
|
|
101
|
-
'at-countdown': true,
|
|
102
|
-
'at-countdown--card': isCard
|
|
103
|
-
}, className), style: customStyle },
|
|
104
|
-
isShowDay && (React.createElement(AtCountdownItem, { num: _day, separator: (format === null || format === void 0 ? void 0 : format.day) || '天' })),
|
|
105
|
-
isShowHour && (React.createElement(AtCountdownItem, { num: _hours, separator: (format === null || format === void 0 ? void 0 : format.hours) || '' })),
|
|
106
|
-
isShowMinute && (React.createElement(AtCountdownItem, { num: _minutes, separator: (format === null || format === void 0 ? void 0 : format.minutes) || '' })),
|
|
107
|
-
React.createElement(AtCountdownItem, { num: _seconds, separator: (format === null || format === void 0 ? void 0 : format.seconds) || '' })));
|
|
48
|
+
return {
|
|
49
|
+
day,
|
|
50
|
+
hours,
|
|
51
|
+
minutes,
|
|
52
|
+
seconds
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
countdonwn() {
|
|
56
|
+
const { day, hours, minutes, seconds } = this.calculateTime();
|
|
57
|
+
this.setState({
|
|
58
|
+
_day: day,
|
|
59
|
+
_hours: hours,
|
|
60
|
+
_minutes: minutes,
|
|
61
|
+
_seconds: seconds
|
|
62
|
+
});
|
|
63
|
+
this.seconds--;
|
|
64
|
+
if (this.seconds < 0) {
|
|
65
|
+
this.clearTimer();
|
|
66
|
+
this.props.onTimeUp && this.props.onTimeUp();
|
|
67
|
+
return;
|
|
108
68
|
}
|
|
69
|
+
this.timer = setTimeout(() => {
|
|
70
|
+
this.countdonwn();
|
|
71
|
+
}, 1e3);
|
|
72
|
+
}
|
|
73
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
74
|
+
if (JSON.stringify(this.props) === JSON.stringify(nextProps)) return;
|
|
75
|
+
const { day = 0, hours = 0, minutes = 0, seconds = 0 } = nextProps;
|
|
76
|
+
this.seconds = toSeconds(day, hours, minutes, seconds);
|
|
77
|
+
this.clearTimer();
|
|
78
|
+
this.setTimer();
|
|
79
|
+
}
|
|
80
|
+
componentDidMount() {
|
|
81
|
+
this.setTimer();
|
|
82
|
+
}
|
|
83
|
+
componentWillUnmount() {
|
|
84
|
+
this.clearTimer();
|
|
85
|
+
}
|
|
86
|
+
componentDidHide() {
|
|
87
|
+
this.clearTimer();
|
|
88
|
+
}
|
|
89
|
+
componentDidShow() {
|
|
90
|
+
this.setTimer();
|
|
91
|
+
}
|
|
92
|
+
render() {
|
|
93
|
+
const {
|
|
94
|
+
className,
|
|
95
|
+
customStyle,
|
|
96
|
+
format = defaultFormat,
|
|
97
|
+
isCard,
|
|
98
|
+
isShowDay,
|
|
99
|
+
isShowHour,
|
|
100
|
+
isShowMinute
|
|
101
|
+
} = this.props;
|
|
102
|
+
const { _day, _hours, _minutes, _seconds } = this.state;
|
|
103
|
+
return /* @__PURE__ */ React.createElement(
|
|
104
|
+
View,
|
|
105
|
+
{
|
|
106
|
+
className: classNames(
|
|
107
|
+
{
|
|
108
|
+
"at-countdown": true,
|
|
109
|
+
"at-countdown--card": isCard
|
|
110
|
+
},
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
style: customStyle
|
|
114
|
+
},
|
|
115
|
+
isShowDay && /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _day, separator: (format == null ? void 0 : format.day) || "\u5929" }),
|
|
116
|
+
isShowHour && /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _hours, separator: (format == null ? void 0 : format.hours) || "" }),
|
|
117
|
+
isShowMinute && /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _minutes, separator: (format == null ? void 0 : format.minutes) || "" }),
|
|
118
|
+
/* @__PURE__ */ React.createElement(AtCountdownItem, { num: _seconds, separator: (format == null ? void 0 : format.seconds) || "" })
|
|
119
|
+
);
|
|
120
|
+
}
|
|
109
121
|
}
|
|
110
122
|
AtCountdown.defaultProps = {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
customStyle: "",
|
|
124
|
+
className: "",
|
|
125
|
+
isCard: false,
|
|
126
|
+
isShowDay: false,
|
|
127
|
+
isShowHour: true,
|
|
128
|
+
isShowMinute: true,
|
|
129
|
+
format: defaultFormat,
|
|
130
|
+
day: 0,
|
|
131
|
+
hours: 0,
|
|
132
|
+
minutes: 0,
|
|
133
|
+
seconds: 0
|
|
122
134
|
};
|
|
123
135
|
AtCountdown.propTypes = {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
137
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
138
|
+
isCard: PropTypes.bool,
|
|
139
|
+
isShowDay: PropTypes.bool,
|
|
140
|
+
isShowHour: PropTypes.bool,
|
|
141
|
+
isShowMinute: PropTypes.bool,
|
|
142
|
+
format: PropTypes.object,
|
|
143
|
+
day: PropTypes.number,
|
|
144
|
+
hours: PropTypes.number,
|
|
145
|
+
minutes: PropTypes.number,
|
|
146
|
+
seconds: PropTypes.number,
|
|
147
|
+
onTimeUp: PropTypes.func
|
|
148
|
+
};
|
|
149
|
+
export {
|
|
150
|
+
AtCountdown as default
|
|
136
151
|
};
|
|
137
152
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/countdown/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtCountDownProps, AtCountdownState } from '../../../types/countdown'\nimport AtCountdownItem from './item'\n\ntype TimeObject = {\n day: number\n hours: number\n minutes: number\n seconds: number\n}\n\nconst toSeconds = (\n day: number,\n hours: number,\n minutes: number,\n seconds: number\n): number => day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds\n\nconst defaultFormat = {\n day: '天',\n hours: '时',\n minutes: '分',\n seconds: '秒'\n}\n\nexport default class AtCountdown extends React.Component<\n AtCountDownProps,\n AtCountdownState\n> {\n public static defaultProps: AtCountDownProps\n public static propTypes: InferProps<AtCountDownProps>\n\n private seconds: number\n private timer: NodeJS.Timeout | number | undefined\n\n public constructor(props: AtCountDownProps) {\n super(props)\n const { day = 0, hours = 0, minutes = 0, seconds = 0 } = this.props\n this.seconds = toSeconds(day, hours, minutes, seconds)\n const {\n day: _day,\n hours: _hours,\n minutes: _minutes,\n seconds: _seconds\n } = this.calculateTime()\n\n this.state = {\n _day,\n _hours,\n _minutes,\n _seconds\n }\n }\n\n private setTimer(): void {\n if (!this.timer) this.countdonwn()\n }\n\n private clearTimer(): void {\n if (this.timer) {\n clearTimeout(this.timer as number)\n this.timer = 0\n }\n }\n\n private calculateTime(): TimeObject {\n let [day, hours, minutes, seconds] = [0, 0, 0, 0]\n\n if (this.seconds > 0) {\n day = this.props.isShowDay ? Math.floor(this.seconds / (60 * 60 * 24)) : 0\n hours = this.props.isShowHour\n ? Math.floor(this.seconds / (60 * 60)) - day * 24\n : 0\n minutes = this.props.isShowMinute\n ? Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60\n : 0\n seconds =\n Math.floor(this.seconds) -\n day * 24 * 60 * 60 -\n hours * 60 * 60 -\n minutes * 60\n }\n return {\n day,\n hours,\n minutes,\n seconds\n }\n }\n\n private countdonwn(): void {\n const { day, hours, minutes, seconds } = this.calculateTime()\n\n this.setState({\n _day: day,\n _hours: hours,\n _minutes: minutes,\n _seconds: seconds\n })\n this.seconds--\n\n if (this.seconds < 0) {\n this.clearTimer()\n this.props.onTimeUp && this.props.onTimeUp()\n return\n }\n\n this.timer = setTimeout(() => {\n this.countdonwn()\n }, 1000)\n }\n\n public UNSAFE_componentWillReceiveProps(nextProps: AtCountDownProps): void {\n if (JSON.stringify(this.props) === JSON.stringify(nextProps)) return\n\n const { day = 0, hours = 0, minutes = 0, seconds = 0 } = nextProps\n this.seconds = toSeconds(day, hours, minutes, seconds)\n this.clearTimer()\n this.setTimer()\n }\n\n public componentDidMount(): void {\n this.setTimer()\n }\n\n public componentWillUnmount(): void {\n this.clearTimer()\n }\n\n public componentDidHide(): void {\n this.clearTimer()\n }\n\n public componentDidShow(): void {\n this.setTimer()\n }\n\n public render(): JSX.Element {\n const {\n className,\n customStyle,\n format = defaultFormat,\n isCard,\n isShowDay,\n isShowHour,\n isShowMinute\n } = this.props\n\n const { _day, _hours, _minutes, _seconds } = this.state\n\n return (\n <View\n className={classNames(\n {\n 'at-countdown': true,\n 'at-countdown--card': isCard\n },\n className\n )}\n style={customStyle}\n >\n {isShowDay && (\n <AtCountdownItem num={_day} separator={format?.day || '天'} />\n )}\n {isShowHour && (\n <AtCountdownItem num={_hours} separator={format?.hours || ''} />\n )}\n {isShowMinute && (\n <AtCountdownItem num={_minutes} separator={format?.minutes || ''} />\n )}\n <AtCountdownItem num={_seconds} separator={format?.seconds || ''} />\n </View>\n )\n }\n}\n\nAtCountdown.defaultProps = {\n customStyle: '',\n className: '',\n isCard: false,\n isShowDay: false,\n isShowHour: true,\n isShowMinute: true,\n format: defaultFormat,\n day: 0,\n hours: 0,\n minutes: 0,\n seconds: 0\n}\n\nAtCountdown.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n isCard: PropTypes.bool,\n isShowDay: PropTypes.bool,\n isShowHour: PropTypes.bool,\n isShowMinute: PropTypes.bool,\n format: PropTypes.object,\n day: PropTypes.number,\n hours: PropTypes.number,\n minutes: PropTypes.number,\n seconds: PropTypes.number,\n onTimeUp: PropTypes.func\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtCountdownItemProps } from '../../../../types/countdown';
|
|
4
|
+
export default class AtCountdownItem extends React.Component<AtCountdownItemProps> {
|
|
5
|
+
static defaultProps: AtCountdownItemProps;
|
|
6
|
+
static propTypes: InferProps<AtCountdownItemProps>;
|
|
7
|
+
private formatNum;
|
|
8
|
+
render(): JSX.Element;
|
|
9
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import PropTypes from
|
|
2
|
-
import React from
|
|
3
|
-
import { Text, View } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
React.createElement(Text, { className: 'at-countdown__time' }, this.formatNum(num))),
|
|
13
|
-
React.createElement(Text, { className: 'at-countdown__separator' }, separator)));
|
|
14
|
-
}
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Text, View } from "@tarojs/components";
|
|
4
|
+
class AtCountdownItem extends React.Component {
|
|
5
|
+
formatNum(num) {
|
|
6
|
+
return num <= 9 ? `0${num}` : `${num}`;
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
const { num, separator } = this.props;
|
|
10
|
+
return /* @__PURE__ */ React.createElement(View, { className: "at-countdown__item" }, /* @__PURE__ */ React.createElement(View, { className: "at-countdown__time-box" }, /* @__PURE__ */ React.createElement(Text, { className: "at-countdown__time" }, this.formatNum(num))), /* @__PURE__ */ React.createElement(Text, { className: "at-countdown__separator" }, separator));
|
|
11
|
+
}
|
|
15
12
|
}
|
|
16
13
|
AtCountdownItem.defaultProps = {
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
num: 0,
|
|
15
|
+
separator: ":"
|
|
19
16
|
};
|
|
20
17
|
AtCountdownItem.propTypes = {
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
num: PropTypes.number.isRequired,
|
|
19
|
+
separator: PropTypes.string
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
AtCountdownItem as default
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/countdown/item/index.tsx"],"sourcesContent":["import PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtCountdownItemProps } from '../../../../types/countdown'\n\nexport default class AtCountdownItem extends React.Component<AtCountdownItemProps> {\n public static defaultProps: AtCountdownItemProps\n public static propTypes: InferProps<AtCountdownItemProps>\n\n private formatNum(num: number): string {\n return num <= 9 ? `0${num}` : `${num}`\n }\n\n public render(): JSX.Element {\n const { num, separator } = this.props\n\n return (\n <View className='at-countdown__item'>\n <View className='at-countdown__time-box'>\n <Text className='at-countdown__time'>{this.formatNum(num)}</Text>\n </View>\n <Text className='at-countdown__separator'>{separator}</Text>\n </View>\n )\n }\n}\n\nAtCountdownItem.defaultProps = {\n num: 0,\n separator: ':'\n}\n\nAtCountdownItem.propTypes = {\n num: PropTypes.number.isRequired,\n separator: PropTypes.string\n}\n"],"mappings":"AAAA,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAG3B,MAAO,wBAAsC,MAAM,UAAgC;AAAA,EAIzE,UAAU,KAAqB;AACrC,WAAO,OAAO,IAAI,IAAI,GAAG,KAAK,GAAG,GAAG;AAAA,EACtC;AAAA,EAEO,SAAsB;AAC3B,UAAM,EAAE,KAAK,UAAU,IAAI,KAAK;AAEhC,WACE,oCAAC,QAAK,WAAU,wBACd,oCAAC,QAAK,WAAU,4BACd,oCAAC,QAAK,WAAU,wBAAsB,KAAK,UAAU,GAAG,CAAE,CAC5D,GACA,oCAAC,QAAK,WAAU,6BAA2B,SAAU,CACvD;AAAA,EAEJ;AACF;AAEA,gBAAgB,eAAe;AAAA,EAC7B,KAAK;AAAA,EACL,WAAW;AACb;AAEA,gBAAgB,YAAY;AAAA,EAC1B,KAAK,UAAU,OAAO;AAAA,EACtB,WAAW,UAAU;AACvB;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtCurtainProps } from '../../../types/curtain';
|
|
4
|
+
export default class AtCurtain extends React.Component<AtCurtainProps> {
|
|
5
|
+
static defaultProps: AtCurtainProps;
|
|
6
|
+
static propTypes: InferProps<AtCurtainProps>;
|
|
7
|
+
private onClose;
|
|
8
|
+
private _stopPropagation;
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
|
@@ -1,45 +1,62 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { View } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
class AtCurtain extends React.Component {
|
|
6
|
+
onClose(e) {
|
|
7
|
+
e.stopPropagation();
|
|
8
|
+
this.props.onClose(e);
|
|
9
|
+
}
|
|
10
|
+
_stopPropagation(e) {
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const { className, customStyle, isOpened, closeBtnPosition } = this.props;
|
|
15
|
+
const curtainClass = classNames(
|
|
16
|
+
{
|
|
17
|
+
"at-curtain": true,
|
|
18
|
+
"at-curtain--closed": !isOpened
|
|
19
|
+
},
|
|
20
|
+
className
|
|
21
|
+
);
|
|
22
|
+
const btnCloseClass = classNames({
|
|
23
|
+
"at-curtain__btn-close": true,
|
|
24
|
+
[`at-curtain__btn-close--${closeBtnPosition}`]: closeBtnPosition
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ React.createElement(
|
|
27
|
+
View,
|
|
28
|
+
{
|
|
29
|
+
className: curtainClass,
|
|
30
|
+
style: customStyle,
|
|
31
|
+
onClick: this._stopPropagation
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-curtain__container" }, /* @__PURE__ */ React.createElement(View, { className: "at-curtain__body" }, this.props.children, /* @__PURE__ */ React.createElement(
|
|
34
|
+
View,
|
|
35
|
+
{
|
|
36
|
+
className: btnCloseClass,
|
|
37
|
+
onClick: this.onClose.bind(this)
|
|
38
|
+
}
|
|
39
|
+
)))
|
|
40
|
+
);
|
|
41
|
+
}
|
|
29
42
|
}
|
|
30
43
|
AtCurtain.defaultProps = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
customStyle: "",
|
|
45
|
+
className: "",
|
|
46
|
+
isOpened: false,
|
|
47
|
+
closeBtnPosition: "bottom",
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
49
|
+
onClose: () => {
|
|
50
|
+
}
|
|
37
51
|
};
|
|
38
52
|
AtCurtain.propTypes = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
54
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
55
|
+
isOpened: PropTypes.bool,
|
|
56
|
+
closeBtnPosition: PropTypes.string,
|
|
57
|
+
onClose: PropTypes.func
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
AtCurtain as default
|
|
44
61
|
};
|
|
45
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/curtain/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtCurtainProps } from '../../../types/curtain'\n\nexport default class AtCurtain extends React.Component<AtCurtainProps> {\n public static defaultProps: AtCurtainProps\n public static propTypes: InferProps<AtCurtainProps>\n\n private onClose(e: CommonEvent): void {\n e.stopPropagation()\n this.props.onClose(e)\n }\n\n private _stopPropagation(e: CommonEvent): void {\n e.stopPropagation()\n }\n\n public render(): JSX.Element {\n const { className, customStyle, isOpened, closeBtnPosition } = this.props\n\n const curtainClass = classNames(\n {\n 'at-curtain': true,\n 'at-curtain--closed': !isOpened\n },\n className\n )\n const btnCloseClass = classNames({\n 'at-curtain__btn-close': true,\n [`at-curtain__btn-close--${closeBtnPosition}`]: closeBtnPosition\n })\n\n return (\n <View\n className={curtainClass}\n style={customStyle}\n onClick={this._stopPropagation}\n >\n <View className='at-curtain__container'>\n <View className='at-curtain__body'>\n {this.props.children}\n <View\n className={btnCloseClass}\n onClick={this.onClose.bind(this)}\n ></View>\n </View>\n </View>\n </View>\n )\n }\n}\n\nAtCurtain.defaultProps = {\n customStyle: '',\n className: '',\n isOpened: false,\n closeBtnPosition: 'bottom',\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClose: (): void => {}\n}\n\nAtCurtain.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n isOpened: PropTypes.bool,\n closeBtnPosition: PropTypes.string,\n onClose: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY;AAIrB,MAAO,kBAAgC,MAAM,UAA0B;AAAA,EAI7D,QAAQ,GAAsB;AACpC,MAAE,gBAAgB;AAClB,SAAK,MAAM,QAAQ,CAAC;AAAA,EACtB;AAAA,EAEQ,iBAAiB,GAAsB;AAC7C,MAAE,gBAAgB;AAAA,EACpB;AAAA,EAEO,SAAsB;AAC3B,UAAM,EAAE,WAAW,aAAa,UAAU,iBAAiB,IAAI,KAAK;AAEpE,UAAM,eAAe;AAAA,MACnB;AAAA,QACE,cAAc;AAAA,QACd,sBAAsB,CAAC;AAAA,MACzB;AAAA,MACA;AAAA,IACF;AACA,UAAM,gBAAgB,WAAW;AAAA,MAC/B,yBAAyB;AAAA,MACzB,CAAC,0BAA0B,gBAAgB,EAAE,GAAG;AAAA,IAClD,CAAC;AAED,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,SAAS,KAAK;AAAA;AAAA,MAEd,oCAAC,QAAK,WAAU,2BACd,oCAAC,QAAK,WAAU,sBACb,KAAK,MAAM,UACZ;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,UACX,SAAS,KAAK,QAAQ,KAAK,IAAI;AAAA;AAAA,MAChC,CACH,CACF;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,UAAU,eAAe;AAAA,EACvB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,kBAAkB;AAAA;AAAA,EAElB,SAAS,MAAY;AAAA,EAAC;AACxB;AAEA,UAAU,YAAY;AAAA,EACpB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,UAAU,UAAU;AAAA,EACpB,kBAAkB,UAAU;AAAA,EAC5B,SAAS,UAAU;AACrB;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtDividerProps } from '../../../types/divider';
|
|
4
|
+
export default class AtDivider extends React.Component<AtDividerProps> {
|
|
5
|
+
static defaultProps: AtDividerProps;
|
|
6
|
+
static propTypes: InferProps<AtDividerProps>;
|
|
7
|
+
render(): JSX.Element;
|
|
8
|
+
}
|
|
@@ -1,40 +1,57 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { View } from
|
|
5
|
-
import { mergeStyle, pxTransform } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
import { mergeStyle, pxTransform } from "../../common/utils";
|
|
6
|
+
class AtDivider extends React.Component {
|
|
7
|
+
render() {
|
|
8
|
+
const {
|
|
9
|
+
className,
|
|
10
|
+
customStyle,
|
|
11
|
+
content,
|
|
12
|
+
height,
|
|
13
|
+
fontColor,
|
|
14
|
+
fontSize,
|
|
15
|
+
lineColor
|
|
16
|
+
} = this.props;
|
|
17
|
+
const rootStyle = {
|
|
18
|
+
height: height ? `${pxTransform(Number(height))}` : ""
|
|
19
|
+
};
|
|
20
|
+
const fontStyle = {
|
|
21
|
+
color: fontColor,
|
|
22
|
+
fontSize: fontSize ? `${pxTransform(Number(fontSize))}` : ""
|
|
23
|
+
};
|
|
24
|
+
const lineStyle = {
|
|
25
|
+
backgroundColor: lineColor
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
View,
|
|
29
|
+
{
|
|
30
|
+
className: classNames("at-divider", className),
|
|
31
|
+
style: mergeStyle(rootStyle, customStyle)
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-divider__content", style: fontStyle }, content === "" ? this.props.children : content),
|
|
34
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-divider__line", style: lineStyle })
|
|
35
|
+
);
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
AtDivider.defaultProps = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
content: "",
|
|
40
|
+
height: 0,
|
|
41
|
+
fontColor: "",
|
|
42
|
+
fontSize: 0,
|
|
43
|
+
lineColor: ""
|
|
30
44
|
};
|
|
31
45
|
AtDivider.propTypes = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
47
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
48
|
+
content: PropTypes.string,
|
|
49
|
+
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
50
|
+
fontColor: PropTypes.string,
|
|
51
|
+
fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
|
+
lineColor: PropTypes.string
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
AtDivider as default
|
|
39
56
|
};
|
|
40
57
|
//# sourceMappingURL=index.js.map
|