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,76 +1,104 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { ScrollView, Text, View } from
|
|
5
|
-
import { handleTouchScroll } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { ScrollView, Text, View } from "@tarojs/components";
|
|
5
|
+
import { handleTouchScroll } from "../../common/utils";
|
|
6
|
+
class AtFloatLayout extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.handleClose = (e) => {
|
|
10
|
+
if (typeof this.props.onClose === "function") {
|
|
11
|
+
this.props.onClose(e);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.close = (e) => {
|
|
15
|
+
this.setState(
|
|
16
|
+
{
|
|
17
|
+
_isOpened: false
|
|
18
|
+
},
|
|
19
|
+
() => this.handleClose(e)
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
this.handleTouchMove = (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
};
|
|
25
|
+
const { isOpened } = props;
|
|
26
|
+
this.state = {
|
|
27
|
+
_isOpened: isOpened
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
31
|
+
const { isOpened } = nextProps;
|
|
32
|
+
if (this.props.isOpened !== isOpened) {
|
|
33
|
+
handleTouchScroll(isOpened);
|
|
26
34
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
if (isOpened !== this.state._isOpened) {
|
|
33
|
-
this.setState({
|
|
34
|
-
_isOpened: isOpened
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
render() {
|
|
39
|
-
const { _isOpened } = this.state;
|
|
40
|
-
const { title, scrollY, scrollX, scrollTop, scrollLeft, upperThreshold, lowerThreshold, scrollWithAnimation } = this.props;
|
|
41
|
-
const rootClass = classNames('at-float-layout', {
|
|
42
|
-
'at-float-layout--active': _isOpened
|
|
43
|
-
}, this.props.className);
|
|
44
|
-
return (React.createElement(View, { className: rootClass, onTouchMove: this.handleTouchMove },
|
|
45
|
-
React.createElement(View, { onClick: this.close, className: 'at-float-layout__overlay' }),
|
|
46
|
-
React.createElement(View, { className: 'at-float-layout__container layout' },
|
|
47
|
-
title ? (React.createElement(View, { className: 'layout-header' },
|
|
48
|
-
React.createElement(Text, { className: 'layout-header__title' }, title),
|
|
49
|
-
React.createElement(View, { className: 'layout-header__btn-close', onClick: this.close }))) : null,
|
|
50
|
-
React.createElement(View, { className: 'layout-body' },
|
|
51
|
-
React.createElement(ScrollView, { scrollY: scrollY, scrollX: scrollX, scrollTop: scrollTop, scrollLeft: scrollLeft, upperThreshold: upperThreshold, lowerThreshold: lowerThreshold, scrollWithAnimation: scrollWithAnimation, onScroll: this.props.onScroll, onScrollToLower: this.props.onScrollToLower, onScrollToUpper: this.props.onScrollToUpper, className: 'layout-body__content' }, this.props.children)))));
|
|
35
|
+
if (isOpened !== this.state._isOpened) {
|
|
36
|
+
this.setState({
|
|
37
|
+
_isOpened: isOpened
|
|
38
|
+
});
|
|
52
39
|
}
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const { _isOpened } = this.state;
|
|
43
|
+
const {
|
|
44
|
+
title,
|
|
45
|
+
scrollY,
|
|
46
|
+
scrollX,
|
|
47
|
+
scrollTop,
|
|
48
|
+
scrollLeft,
|
|
49
|
+
upperThreshold,
|
|
50
|
+
lowerThreshold,
|
|
51
|
+
scrollWithAnimation
|
|
52
|
+
} = this.props;
|
|
53
|
+
const rootClass = classNames(
|
|
54
|
+
"at-float-layout",
|
|
55
|
+
{
|
|
56
|
+
"at-float-layout--active": _isOpened
|
|
57
|
+
},
|
|
58
|
+
this.props.className
|
|
59
|
+
);
|
|
60
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootClass, onTouchMove: this.handleTouchMove }, /* @__PURE__ */ React.createElement(View, { onClick: this.close, className: "at-float-layout__overlay" }), /* @__PURE__ */ React.createElement(View, { className: "at-float-layout__container layout" }, title ? /* @__PURE__ */ React.createElement(View, { className: "layout-header" }, /* @__PURE__ */ React.createElement(Text, { className: "layout-header__title" }, title), /* @__PURE__ */ React.createElement(View, { className: "layout-header__btn-close", onClick: this.close })) : null, /* @__PURE__ */ React.createElement(View, { className: "layout-body" }, /* @__PURE__ */ React.createElement(
|
|
61
|
+
ScrollView,
|
|
62
|
+
{
|
|
63
|
+
scrollY,
|
|
64
|
+
scrollX,
|
|
65
|
+
scrollTop,
|
|
66
|
+
scrollLeft,
|
|
67
|
+
upperThreshold,
|
|
68
|
+
lowerThreshold,
|
|
69
|
+
scrollWithAnimation,
|
|
70
|
+
onScroll: this.props.onScroll,
|
|
71
|
+
onScrollToLower: this.props.onScrollToLower,
|
|
72
|
+
onScrollToUpper: this.props.onScrollToUpper,
|
|
73
|
+
className: "layout-body__content"
|
|
74
|
+
},
|
|
75
|
+
this.props.children
|
|
76
|
+
))));
|
|
77
|
+
}
|
|
53
78
|
}
|
|
54
79
|
AtFloatLayout.defaultProps = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
80
|
+
title: "",
|
|
81
|
+
isOpened: false,
|
|
82
|
+
scrollY: true,
|
|
83
|
+
scrollX: false,
|
|
84
|
+
scrollWithAnimation: false
|
|
60
85
|
};
|
|
61
86
|
AtFloatLayout.propTypes = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
title: PropTypes.string,
|
|
88
|
+
isOpened: PropTypes.bool,
|
|
89
|
+
scrollY: PropTypes.bool,
|
|
90
|
+
scrollX: PropTypes.bool,
|
|
91
|
+
scrollTop: PropTypes.number,
|
|
92
|
+
scrollLeft: PropTypes.number,
|
|
93
|
+
upperThreshold: PropTypes.number,
|
|
94
|
+
lowerThreshold: PropTypes.number,
|
|
95
|
+
scrollWithAnimation: PropTypes.bool,
|
|
96
|
+
onClose: PropTypes.func,
|
|
97
|
+
onScroll: PropTypes.func,
|
|
98
|
+
onScrollToLower: PropTypes.func,
|
|
99
|
+
onScrollToUpper: PropTypes.func
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
AtFloatLayout as default
|
|
75
103
|
};
|
|
76
104
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/float-layout/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { ScrollView, Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport {\n AtFloatLayoutProps,\n AtFloatLayoutState\n} from '../../../types/float-layout'\nimport { handleTouchScroll } from '../../common/utils'\n\nexport default class AtFloatLayout extends React.Component<\n AtFloatLayoutProps,\n AtFloatLayoutState\n> {\n public static defaultProps: AtFloatLayoutProps\n public static propTypes: InferProps<AtFloatLayoutProps>\n\n public constructor(props: AtFloatLayoutProps) {\n super(props)\n\n const { isOpened } = props\n this.state = {\n _isOpened: isOpened\n }\n }\n\n public UNSAFE_componentWillReceiveProps(nextProps: AtFloatLayoutProps): void {\n const { isOpened } = nextProps\n\n if (this.props.isOpened !== isOpened) {\n handleTouchScroll(isOpened)\n }\n\n if (isOpened !== this.state._isOpened) {\n this.setState({\n _isOpened: isOpened\n })\n }\n }\n\n private handleClose = (e): void => {\n if (typeof this.props.onClose === 'function') {\n this.props.onClose(e)\n }\n }\n\n private close = (e): void => {\n this.setState(\n {\n _isOpened: false\n },\n () => this.handleClose(e)\n )\n }\n\n private handleTouchMove = (e: CommonEvent): void => {\n e.stopPropagation()\n }\n\n public render(): JSX.Element {\n const { _isOpened } = this.state\n const {\n title,\n\n scrollY,\n scrollX,\n scrollTop,\n scrollLeft,\n upperThreshold,\n lowerThreshold,\n scrollWithAnimation\n } = this.props\n\n const rootClass = classNames(\n 'at-float-layout',\n {\n 'at-float-layout--active': _isOpened\n },\n this.props.className\n )\n\n return (\n <View className={rootClass} onTouchMove={this.handleTouchMove}>\n <View onClick={this.close} className='at-float-layout__overlay' />\n <View className='at-float-layout__container layout'>\n {title ? (\n <View className='layout-header'>\n <Text className='layout-header__title'>{title}</Text>\n <View className='layout-header__btn-close' onClick={this.close} />\n </View>\n ) : null}\n <View className='layout-body'>\n <ScrollView\n scrollY={scrollY}\n scrollX={scrollX}\n scrollTop={scrollTop}\n scrollLeft={scrollLeft}\n upperThreshold={upperThreshold}\n lowerThreshold={lowerThreshold}\n scrollWithAnimation={scrollWithAnimation}\n onScroll={this.props.onScroll}\n onScrollToLower={this.props.onScrollToLower}\n onScrollToUpper={this.props.onScrollToUpper}\n className='layout-body__content'\n >\n {this.props.children}\n </ScrollView>\n </View>\n </View>\n </View>\n )\n }\n}\n\nAtFloatLayout.defaultProps = {\n title: '',\n isOpened: false,\n\n scrollY: true,\n scrollX: false,\n scrollWithAnimation: false\n}\n\nAtFloatLayout.propTypes = {\n title: PropTypes.string,\n isOpened: PropTypes.bool,\n scrollY: PropTypes.bool,\n scrollX: PropTypes.bool,\n scrollTop: PropTypes.number,\n scrollLeft: PropTypes.number,\n upperThreshold: PropTypes.number,\n lowerThreshold: PropTypes.number,\n scrollWithAnimation: PropTypes.bool,\n onClose: PropTypes.func,\n onScroll: PropTypes.func,\n onScrollToLower: PropTypes.func,\n onScrollToUpper: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY,MAAM,YAAY;AAMvC,SAAS,yBAAyB;AAElC,MAAO,sBAAoC,MAAM,UAG/C;AAAA,EAIO,YAAY,OAA2B;AAC5C,UAAM,KAAK;AAsBb,SAAQ,cAAc,CAAC,MAAY;AACjC,UAAI,OAAO,KAAK,MAAM,YAAY,YAAY;AAC5C,aAAK,MAAM,QAAQ,CAAC;AAAA,MACtB;AAAA,IACF;AAEA,SAAQ,QAAQ,CAAC,MAAY;AAC3B,WAAK;AAAA,QACH;AAAA,UACE,WAAW;AAAA,QACb;AAAA,QACA,MAAM,KAAK,YAAY,CAAC;AAAA,MAC1B;AAAA,IACF;AAEA,SAAQ,kBAAkB,CAAC,MAAyB;AAClD,QAAE,gBAAgB;AAAA,IACpB;AArCE,UAAM,EAAE,SAAS,IAAI;AACrB,SAAK,QAAQ;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EAEO,iCAAiC,WAAqC;AAC3E,UAAM,EAAE,SAAS,IAAI;AAErB,QAAI,KAAK,MAAM,aAAa,UAAU;AACpC,wBAAkB,QAAQ;AAAA,IAC5B;AAEA,QAAI,aAAa,KAAK,MAAM,WAAW;AACrC,WAAK,SAAS;AAAA,QACZ,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAqBO,SAAsB;AAC3B,UAAM,EAAE,UAAU,IAAI,KAAK;AAC3B,UAAM;AAAA,MACJ;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI,KAAK;AAET,UAAM,YAAY;AAAA,MAChB;AAAA,MACA;AAAA,QACE,2BAA2B;AAAA,MAC7B;AAAA,MACA,KAAK,MAAM;AAAA,IACb;AAEA,WACE,oCAAC,QAAK,WAAW,WAAW,aAAa,KAAK,mBAC5C,oCAAC,QAAK,SAAS,KAAK,OAAO,WAAU,4BAA2B,GAChE,oCAAC,QAAK,WAAU,uCACb,QACC,oCAAC,QAAK,WAAU,mBACd,oCAAC,QAAK,WAAU,0BAAwB,KAAM,GAC9C,oCAAC,QAAK,WAAU,4BAA2B,SAAS,KAAK,OAAO,CAClE,IACE,MACJ,oCAAC,QAAK,WAAU,iBACd;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,KAAK,MAAM;AAAA,QACrB,iBAAiB,KAAK,MAAM;AAAA,QAC5B,iBAAiB,KAAK,MAAM;AAAA,QAC5B,WAAU;AAAA;AAAA,MAET,KAAK,MAAM;AAAA,IACd,CACF,CACF,CACF;AAAA,EAEJ;AACF;AAEA,cAAc,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,UAAU;AAAA,EAEV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,qBAAqB;AACvB;AAEA,cAAc,YAAY;AAAA,EACxB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AAAA,EACpB,SAAS,UAAU;AAAA,EACnB,SAAS,UAAU;AAAA,EACnB,WAAW,UAAU;AAAA,EACrB,YAAY,UAAU;AAAA,EACtB,gBAAgB,UAAU;AAAA,EAC1B,gBAAgB,UAAU;AAAA,EAC1B,qBAAqB,UAAU;AAAA,EAC/B,SAAS,UAAU;AAAA,EACnB,UAAU,UAAU;AAAA,EACpB,iBAAiB,UAAU;AAAA,EAC3B,iBAAiB,UAAU;AAC7B;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtFormProps } from '../../../types/form';
|
|
4
|
+
export default class AtForm extends React.Component<AtFormProps> {
|
|
5
|
+
static defaultProps: AtFormProps;
|
|
6
|
+
static propTypes: InferProps<AtFormProps>;
|
|
7
|
+
private onSubmit;
|
|
8
|
+
private onReset;
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
|
@@ -1,30 +1,43 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { Form } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Form } from "@tarojs/components";
|
|
5
|
+
class AtForm extends React.Component {
|
|
6
|
+
onSubmit() {
|
|
7
|
+
this.props.onSubmit && this.props.onSubmit(arguments);
|
|
8
|
+
}
|
|
9
|
+
onReset() {
|
|
10
|
+
this.props.onReset && this.props.onReset(arguments);
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
const { customStyle, className, reportSubmit } = this.props;
|
|
14
|
+
const rootCls = classNames("at-form", className);
|
|
15
|
+
return /* @__PURE__ */ React.createElement(
|
|
16
|
+
Form,
|
|
17
|
+
{
|
|
18
|
+
className: rootCls,
|
|
19
|
+
style: customStyle,
|
|
20
|
+
onSubmit: this.onSubmit.bind(this),
|
|
21
|
+
reportSubmit,
|
|
22
|
+
onReset: this.onReset.bind(this)
|
|
23
|
+
},
|
|
24
|
+
this.props.children
|
|
25
|
+
);
|
|
26
|
+
}
|
|
17
27
|
}
|
|
18
28
|
AtForm.defaultProps = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
customStyle: "",
|
|
30
|
+
className: "",
|
|
31
|
+
reportSubmit: false
|
|
22
32
|
};
|
|
23
33
|
AtForm.propTypes = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
35
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
36
|
+
reportSubmit: PropTypes.bool,
|
|
37
|
+
onSubmit: PropTypes.func,
|
|
38
|
+
onReset: PropTypes.func
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
AtForm as default
|
|
29
42
|
};
|
|
30
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/form/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Form } from '@tarojs/components'\nimport { AtFormProps } from '../../../types/form'\n\nexport default class AtForm extends React.Component<AtFormProps> {\n public static defaultProps: AtFormProps\n public static propTypes: InferProps<AtFormProps>\n\n private onSubmit(): void {\n this.props.onSubmit && this.props.onSubmit(arguments as any)\n }\n\n private onReset(): void {\n this.props.onReset && this.props.onReset(arguments as any)\n }\n\n public render(): JSX.Element {\n const { customStyle, className, reportSubmit } = this.props\n const rootCls = classNames('at-form', className)\n\n return (\n <Form\n className={rootCls}\n style={customStyle}\n onSubmit={this.onSubmit.bind(this)}\n reportSubmit={reportSubmit}\n onReset={this.onReset.bind(this)}\n >\n {this.props.children}\n </Form>\n )\n }\n}\n\nAtForm.defaultProps = {\n customStyle: '',\n className: '',\n reportSubmit: false\n}\n\nAtForm.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n reportSubmit: PropTypes.bool,\n onSubmit: PropTypes.func,\n onReset: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,MAAO,eAA6B,MAAM,UAAuB;AAAA,EAIvD,WAAiB;AACvB,SAAK,MAAM,YAAY,KAAK,MAAM,SAAS,SAAgB;AAAA,EAC7D;AAAA,EAEQ,UAAgB;AACtB,SAAK,MAAM,WAAW,KAAK,MAAM,QAAQ,SAAgB;AAAA,EAC3D;AAAA,EAEO,SAAsB;AAC3B,UAAM,EAAE,aAAa,WAAW,aAAa,IAAI,KAAK;AACtD,UAAM,UAAU,WAAW,WAAW,SAAS;AAE/C,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU,KAAK,SAAS,KAAK,IAAI;AAAA,QACjC;AAAA,QACA,SAAS,KAAK,QAAQ,KAAK,IAAI;AAAA;AAAA,MAE9B,KAAK,MAAM;AAAA,IACd;AAAA,EAEJ;AACF;AAEA,OAAO,eAAe;AAAA,EACpB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAChB;AAEA,OAAO,YAAY;AAAA,EACjB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,cAAc,UAAU;AAAA,EACxB,UAAU,UAAU;AAAA,EACpB,SAAS,UAAU;AACrB;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtGridProps } from '../../../types/grid';
|
|
4
|
+
export default class AtGrid extends React.Component<AtGridProps> {
|
|
5
|
+
static defaultProps: AtGridProps;
|
|
6
|
+
static propTypes: InferProps<AtGridProps>;
|
|
7
|
+
private handleClick;
|
|
8
|
+
render(): JSX.Element | null;
|
|
9
|
+
}
|
|
@@ -1,71 +1,101 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import _chunk from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import React from
|
|
5
|
-
import { Image, Text, View } from
|
|
6
|
-
import { mergeStyle } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import _chunk from "lodash/chunk";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Image, Text, View } from "@tarojs/components";
|
|
6
|
+
import { mergeStyle } from "../../common/utils";
|
|
7
|
+
class AtGrid extends React.Component {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.handleClick = (item, index, row, event) => {
|
|
11
|
+
const { onClick, columnNum = 3 } = this.props;
|
|
12
|
+
if (typeof onClick === "function") {
|
|
13
|
+
const clickIndex = row * columnNum + index;
|
|
14
|
+
onClick(item, clickIndex, event);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
const { data, mode, columnNum = 3, hasBorder } = this.props;
|
|
20
|
+
if (Array.isArray(data) && data.length === 0) {
|
|
21
|
+
return null;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
const gridGroup = _chunk(data, columnNum);
|
|
24
|
+
const bodyClass = classNames(
|
|
25
|
+
["at-grid__flex-item", "at-grid-item", `at-grid-item--${mode}`],
|
|
26
|
+
{
|
|
27
|
+
"at-grid-item--no-border": !hasBorder
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames("at-grid", this.props.className) }, gridGroup.map((item, i) => /* @__PURE__ */ React.createElement(View, { className: "at-grid__flex", key: `at-grid-group-${i}` }, item.map((childItem, index) => /* @__PURE__ */ React.createElement(
|
|
31
|
+
View,
|
|
32
|
+
{
|
|
33
|
+
key: `at-grid-item-${index}`,
|
|
34
|
+
className: classNames(bodyClass, {
|
|
35
|
+
"at-grid-item--last": index === columnNum - 1
|
|
36
|
+
}),
|
|
37
|
+
onClick: this.handleClick.bind(this, childItem, index, i),
|
|
38
|
+
style: {
|
|
39
|
+
flex: `0 0 ${100 / columnNum}%`
|
|
22
40
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
},
|
|
42
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-grid-item__content" }, /* @__PURE__ */ React.createElement(View, { className: "at-grid-item__content-inner" }, /* @__PURE__ */ React.createElement(View, { className: "content-inner__icon" }, childItem.image && /* @__PURE__ */ React.createElement(
|
|
43
|
+
Image,
|
|
44
|
+
{
|
|
45
|
+
className: "content-inner__img",
|
|
46
|
+
src: childItem.image,
|
|
47
|
+
mode: "scaleToFill"
|
|
48
|
+
}
|
|
49
|
+
), childItem.iconInfo && !childItem.image && /* @__PURE__ */ React.createElement(
|
|
50
|
+
Text,
|
|
51
|
+
{
|
|
52
|
+
className: classNames(
|
|
53
|
+
childItem.iconInfo.prefixClass || "at-icon",
|
|
54
|
+
{
|
|
55
|
+
[`${childItem.iconInfo.prefixClass || "at-icon"}-${childItem.iconInfo.value}`]: childItem.iconInfo.value
|
|
56
|
+
},
|
|
57
|
+
childItem.iconInfo.className
|
|
58
|
+
),
|
|
59
|
+
style: mergeStyle(
|
|
60
|
+
{
|
|
61
|
+
color: childItem.iconInfo.color,
|
|
62
|
+
fontSize: `${childItem.iconInfo.size || 24}px`
|
|
63
|
+
},
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
65
|
+
childItem.iconInfo.customStyle
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)), /* @__PURE__ */ React.createElement(Text, { className: "content-inner__text" }, childItem.value)))
|
|
69
|
+
)))));
|
|
70
|
+
}
|
|
46
71
|
}
|
|
47
72
|
AtGrid.defaultProps = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
73
|
+
data: [],
|
|
74
|
+
columnNum: 3,
|
|
75
|
+
mode: "square",
|
|
76
|
+
hasBorder: true
|
|
52
77
|
};
|
|
53
78
|
AtGrid.propTypes = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
mode: PropTypes.string,
|
|
80
|
+
onClick: PropTypes.func,
|
|
81
|
+
hasBorder: PropTypes.bool,
|
|
82
|
+
columnNum: PropTypes.number,
|
|
83
|
+
data: PropTypes.arrayOf(
|
|
84
|
+
PropTypes.shape({
|
|
85
|
+
image: PropTypes.string,
|
|
86
|
+
value: PropTypes.string,
|
|
87
|
+
iconInfo: PropTypes.shape({
|
|
88
|
+
size: PropTypes.number,
|
|
60
89
|
value: PropTypes.string,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
color: PropTypes.string,
|
|
91
|
+
prefixClass: PropTypes.string,
|
|
92
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
93
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string])
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
)
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
AtGrid as default
|
|
70
100
|
};
|
|
71
101
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/grid/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport _chunk from 'lodash/chunk'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Image, Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtGridItem, AtGridProps } from '../../../types/grid'\nimport { mergeStyle } from '../../common/utils'\n\nexport default class AtGrid extends React.Component<AtGridProps> {\n public static defaultProps: AtGridProps\n public static propTypes: InferProps<AtGridProps>\n\n private handleClick = (\n item: AtGridItem,\n index: number,\n row: number,\n event: CommonEvent\n ): void => {\n const { onClick, columnNum = 3 } = this.props\n if (typeof onClick === 'function') {\n const clickIndex = row * columnNum + index\n onClick(item, clickIndex, event)\n }\n }\n\n public render(): JSX.Element | null {\n const { data, mode, columnNum = 3, hasBorder } = this.props\n\n if (Array.isArray(data) && data.length === 0) {\n return null\n }\n\n const gridGroup = _chunk(data, columnNum)\n\n const bodyClass = classNames(\n ['at-grid__flex-item', 'at-grid-item', `at-grid-item--${mode}`],\n {\n 'at-grid-item--no-border': !hasBorder\n }\n )\n\n return (\n <View className={classNames('at-grid', this.props.className)}>\n {gridGroup.map((item, i) => (\n <View className='at-grid__flex' key={`at-grid-group-${i}`}>\n {item.map((childItem, index) => (\n <View\n key={`at-grid-item-${index}`}\n className={classNames(bodyClass, {\n 'at-grid-item--last': index === columnNum - 1\n })}\n onClick={this.handleClick.bind(this, childItem, index, i)}\n style={{\n flex: `0 0 ${100 / columnNum}%`\n }}\n >\n <View className='at-grid-item__content'>\n <View className='at-grid-item__content-inner'>\n <View className='content-inner__icon'>\n {childItem.image && (\n <Image\n className='content-inner__img'\n src={childItem.image}\n mode='scaleToFill'\n />\n )}\n {childItem.iconInfo && !childItem.image && (\n <Text\n className={classNames(\n childItem.iconInfo.prefixClass || 'at-icon',\n {\n [`${\n childItem.iconInfo.prefixClass || 'at-icon'\n }-${childItem.iconInfo.value}`]:\n childItem.iconInfo.value\n },\n childItem.iconInfo.className\n )}\n style={mergeStyle(\n {\n color: childItem.iconInfo.color,\n fontSize: `${childItem.iconInfo.size || 24}px`\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n childItem.iconInfo!.customStyle!\n )}\n />\n )}\n </View>\n <Text className='content-inner__text'>\n {childItem.value}\n </Text>\n </View>\n </View>\n </View>\n ))}\n </View>\n ))}\n </View>\n )\n }\n}\n\nAtGrid.defaultProps = {\n data: [],\n columnNum: 3,\n mode: 'square',\n hasBorder: true\n}\n\nAtGrid.propTypes = {\n mode: PropTypes.string,\n onClick: PropTypes.func,\n hasBorder: PropTypes.bool,\n columnNum: PropTypes.number,\n data: PropTypes.arrayOf(\n PropTypes.shape({\n image: PropTypes.string,\n value: PropTypes.string,\n iconInfo: PropTypes.shape({\n size: PropTypes.number,\n value: PropTypes.string,\n color: PropTypes.string,\n prefixClass: PropTypes.string,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string])\n })\n })\n )\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 { AtIconProps } from '../../../types/icon';
|
|
4
|
+
export default class AtIcon extends React.Component<AtIconProps> {
|
|
5
|
+
static defaultProps: AtIconProps;
|
|
6
|
+
static propTypes: InferProps<AtIconProps>;
|
|
7
|
+
private handleClick;
|
|
8
|
+
render(): JSX.Element;
|
|
9
|
+
}
|
|
@@ -1,37 +1,54 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { Text } from
|
|
5
|
-
import { mergeStyle, pxTransform } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Text } from "@tarojs/components";
|
|
5
|
+
import { mergeStyle, pxTransform } from "../../common/utils";
|
|
6
|
+
class AtIcon extends React.Component {
|
|
7
|
+
handleClick() {
|
|
8
|
+
this.props.onClick && this.props.onClick(arguments);
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
const {
|
|
12
|
+
customStyle = {},
|
|
13
|
+
className,
|
|
14
|
+
prefixClass,
|
|
15
|
+
value,
|
|
16
|
+
size,
|
|
17
|
+
color
|
|
18
|
+
} = this.props;
|
|
19
|
+
const rootStyle = {
|
|
20
|
+
fontSize: `${pxTransform(parseInt(String(size)) * 2)}`,
|
|
21
|
+
color
|
|
22
|
+
};
|
|
23
|
+
const iconName = value ? `${prefixClass}-${value}` : "";
|
|
24
|
+
return /* @__PURE__ */ React.createElement(
|
|
25
|
+
Text,
|
|
26
|
+
{
|
|
27
|
+
className: classNames(prefixClass, iconName, className),
|
|
28
|
+
style: mergeStyle(rootStyle, customStyle),
|
|
29
|
+
onClick: this.handleClick.bind(this)
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
19
33
|
}
|
|
20
34
|
AtIcon.defaultProps = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
customStyle: "",
|
|
36
|
+
className: "",
|
|
37
|
+
prefixClass: "at-icon",
|
|
38
|
+
value: "",
|
|
39
|
+
color: "",
|
|
40
|
+
size: 24
|
|
27
41
|
};
|
|
28
42
|
AtIcon.propTypes = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
44
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
45
|
+
prefixClass: PropTypes.string,
|
|
46
|
+
value: PropTypes.string,
|
|
47
|
+
color: PropTypes.string,
|
|
48
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
49
|
+
onClick: PropTypes.func
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
AtIcon as default
|
|
36
53
|
};
|
|
37
54
|
//# sourceMappingURL=index.js.map
|