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,121 +1,176 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { Input, Text, 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Input, Text, View } from "@tarojs/components";
|
|
5
|
+
class AtSearchBar extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.handleFocus = (event) => {
|
|
9
|
+
this.setState({
|
|
10
|
+
isFocus: true
|
|
11
|
+
});
|
|
12
|
+
this.props.onFocus && this.props.onFocus(event);
|
|
13
|
+
};
|
|
14
|
+
this.handleBlur = (event) => {
|
|
15
|
+
this.setState({
|
|
16
|
+
isFocus: false
|
|
17
|
+
});
|
|
18
|
+
this.props.onBlur && this.props.onBlur(event);
|
|
19
|
+
};
|
|
20
|
+
this.handleChange = (e) => {
|
|
21
|
+
this.props.onChange(e.detail.value, e);
|
|
22
|
+
};
|
|
23
|
+
this.handleClear = (event) => {
|
|
24
|
+
if (this.props.onClear) {
|
|
25
|
+
this.props.onClear(event);
|
|
26
|
+
} else {
|
|
27
|
+
this.props.onChange("", event);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
this.handleConfirm = (event) => {
|
|
31
|
+
this.props.onConfirm && this.props.onConfirm(event);
|
|
32
|
+
};
|
|
33
|
+
this.handleActionClick = (event) => {
|
|
34
|
+
this.props.onActionClick && this.props.onActionClick(event);
|
|
35
|
+
};
|
|
36
|
+
this.state = {
|
|
37
|
+
isFocus: !!props.focus
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
41
|
+
if (nextProps.focus !== this.props.focus) {
|
|
42
|
+
this.setState({ isFocus: !!nextProps.focus });
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const {
|
|
47
|
+
value,
|
|
48
|
+
placeholder,
|
|
49
|
+
maxLength,
|
|
50
|
+
fixed,
|
|
51
|
+
disabled,
|
|
52
|
+
showActionButton,
|
|
53
|
+
actionName = "\u641C\u7D22",
|
|
54
|
+
inputType,
|
|
55
|
+
// 处理issue#464
|
|
56
|
+
className,
|
|
57
|
+
customStyle,
|
|
58
|
+
enableNative
|
|
59
|
+
} = this.props;
|
|
60
|
+
const { isFocus } = this.state;
|
|
61
|
+
const fontSize = 14;
|
|
62
|
+
const rootCls = classNames(
|
|
63
|
+
"at-search-bar",
|
|
64
|
+
{
|
|
65
|
+
"at-search-bar--fixed": fixed
|
|
66
|
+
},
|
|
67
|
+
className
|
|
68
|
+
);
|
|
69
|
+
const placeholderWrapStyle = {};
|
|
70
|
+
const actionStyle = {};
|
|
71
|
+
if (isFocus || !isFocus && value) {
|
|
72
|
+
actionStyle.opacity = 1;
|
|
73
|
+
actionStyle.marginRight = `0`;
|
|
74
|
+
placeholderWrapStyle.flexGrow = 0;
|
|
75
|
+
} else if (!isFocus && !value) {
|
|
76
|
+
placeholderWrapStyle.flexGrow = 1;
|
|
77
|
+
actionStyle.opacity = 0;
|
|
78
|
+
actionStyle.marginRight = `-${(actionName.length + 1) * fontSize + fontSize / 2 + 10}px`;
|
|
45
79
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const { isFocus } = this.state;
|
|
50
|
-
const fontSize = 14;
|
|
51
|
-
const rootCls = classNames('at-search-bar', {
|
|
52
|
-
'at-search-bar--fixed': fixed
|
|
53
|
-
}, className);
|
|
54
|
-
const placeholderWrapStyle = {};
|
|
55
|
-
const actionStyle = {};
|
|
56
|
-
if (isFocus || (!isFocus && value)) {
|
|
57
|
-
actionStyle.opacity = 1;
|
|
58
|
-
actionStyle.marginRight = `0`;
|
|
59
|
-
placeholderWrapStyle.flexGrow = 0;
|
|
60
|
-
}
|
|
61
|
-
else if (!isFocus && !value) {
|
|
62
|
-
placeholderWrapStyle.flexGrow = 1;
|
|
63
|
-
actionStyle.opacity = 0;
|
|
64
|
-
actionStyle.marginRight = `-${(actionName.length + 1) * fontSize + fontSize / 2 + 10}px`;
|
|
65
|
-
}
|
|
66
|
-
if (showActionButton) {
|
|
67
|
-
actionStyle.opacity = 1;
|
|
68
|
-
actionStyle.marginRight = `0`;
|
|
69
|
-
}
|
|
70
|
-
const clearIconStyle = { display: 'flex' };
|
|
71
|
-
const placeholderStyle = { visibility: 'hidden' };
|
|
72
|
-
if (!value.length) {
|
|
73
|
-
clearIconStyle.display = 'none';
|
|
74
|
-
placeholderStyle.visibility = 'visible';
|
|
75
|
-
}
|
|
76
|
-
return (React.createElement(View, { className: rootCls, style: customStyle },
|
|
77
|
-
React.createElement(View, { className: 'at-search-bar__input-cnt' },
|
|
78
|
-
React.createElement(View, { className: 'at-search-bar__placeholder-wrap', style: placeholderWrapStyle },
|
|
79
|
-
React.createElement(Text, { className: 'at-icon at-icon-search' }),
|
|
80
|
-
React.createElement(Text, { className: 'at-search-bar__placeholder', style: placeholderStyle }, isFocus ? '' : placeholder)),
|
|
81
|
-
React.createElement(Input, { className: 'at-search-bar__input', type: inputType, confirmType: 'search', value: value, focus: isFocus, disabled: disabled, maxlength: maxLength,
|
|
82
|
-
// @ts-ignore ci 上面这个检查不通过, 暂时跳过ts检查
|
|
83
|
-
enableNative: enableNative, onInput: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur, onConfirm: this.handleConfirm }),
|
|
84
|
-
React.createElement(View, { className: 'at-search-bar__clear', style: clearIconStyle, onTouchStart: this.handleClear },
|
|
85
|
-
React.createElement(Text, { className: 'at-icon at-icon-close-circle' }))),
|
|
86
|
-
React.createElement(View, { className: 'at-search-bar__action', style: actionStyle, onClick: this.handleActionClick }, actionName)));
|
|
80
|
+
if (showActionButton) {
|
|
81
|
+
actionStyle.opacity = 1;
|
|
82
|
+
actionStyle.marginRight = `0`;
|
|
87
83
|
}
|
|
84
|
+
const clearIconStyle = { display: "flex" };
|
|
85
|
+
const placeholderStyle = { visibility: "hidden" };
|
|
86
|
+
if (!value.length) {
|
|
87
|
+
clearIconStyle.display = "none";
|
|
88
|
+
placeholderStyle.visibility = "visible";
|
|
89
|
+
}
|
|
90
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootCls, style: customStyle }, /* @__PURE__ */ React.createElement(View, { className: "at-search-bar__input-cnt" }, /* @__PURE__ */ React.createElement(
|
|
91
|
+
View,
|
|
92
|
+
{
|
|
93
|
+
className: "at-search-bar__placeholder-wrap",
|
|
94
|
+
style: placeholderWrapStyle
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-search" }),
|
|
97
|
+
/* @__PURE__ */ React.createElement(
|
|
98
|
+
Text,
|
|
99
|
+
{
|
|
100
|
+
className: "at-search-bar__placeholder",
|
|
101
|
+
style: placeholderStyle
|
|
102
|
+
},
|
|
103
|
+
isFocus ? "" : placeholder
|
|
104
|
+
)
|
|
105
|
+
), /* @__PURE__ */ React.createElement(
|
|
106
|
+
Input,
|
|
107
|
+
{
|
|
108
|
+
className: "at-search-bar__input",
|
|
109
|
+
type: inputType,
|
|
110
|
+
confirmType: "search",
|
|
111
|
+
value,
|
|
112
|
+
focus: isFocus,
|
|
113
|
+
disabled,
|
|
114
|
+
maxlength: maxLength,
|
|
115
|
+
enableNative,
|
|
116
|
+
onInput: this.handleChange,
|
|
117
|
+
onFocus: this.handleFocus,
|
|
118
|
+
onBlur: this.handleBlur,
|
|
119
|
+
onConfirm: this.handleConfirm
|
|
120
|
+
}
|
|
121
|
+
), /* @__PURE__ */ React.createElement(
|
|
122
|
+
View,
|
|
123
|
+
{
|
|
124
|
+
className: "at-search-bar__clear",
|
|
125
|
+
style: clearIconStyle,
|
|
126
|
+
onTouchStart: this.handleClear
|
|
127
|
+
},
|
|
128
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-close-circle" })
|
|
129
|
+
)), /* @__PURE__ */ React.createElement(
|
|
130
|
+
View,
|
|
131
|
+
{
|
|
132
|
+
className: "at-search-bar__action",
|
|
133
|
+
style: actionStyle,
|
|
134
|
+
onClick: this.handleActionClick
|
|
135
|
+
},
|
|
136
|
+
actionName
|
|
137
|
+
));
|
|
138
|
+
}
|
|
88
139
|
}
|
|
89
140
|
AtSearchBar.defaultProps = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
141
|
+
value: "",
|
|
142
|
+
placeholder: "\u641C\u7D22",
|
|
143
|
+
maxLength: 140,
|
|
144
|
+
fixed: false,
|
|
145
|
+
focus: false,
|
|
146
|
+
disabled: false,
|
|
147
|
+
showActionButton: false,
|
|
148
|
+
actionName: "\u641C\u7D22",
|
|
149
|
+
inputType: "text",
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
151
|
+
onChange: () => {
|
|
152
|
+
},
|
|
153
|
+
enableNative: true
|
|
102
154
|
};
|
|
103
155
|
AtSearchBar.propTypes = {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
156
|
+
value: PropTypes.string,
|
|
157
|
+
placeholder: PropTypes.string,
|
|
158
|
+
maxLength: PropTypes.number,
|
|
159
|
+
fixed: PropTypes.bool,
|
|
160
|
+
focus: PropTypes.bool,
|
|
161
|
+
disabled: PropTypes.bool,
|
|
162
|
+
showActionButton: PropTypes.bool,
|
|
163
|
+
actionName: PropTypes.string,
|
|
164
|
+
inputType: PropTypes.oneOf(["text", "number", "idcard", "digit"]),
|
|
165
|
+
onChange: PropTypes.func,
|
|
166
|
+
onFocus: PropTypes.func,
|
|
167
|
+
onBlur: PropTypes.func,
|
|
168
|
+
onConfirm: PropTypes.func,
|
|
169
|
+
onActionClick: PropTypes.func,
|
|
170
|
+
onClear: PropTypes.func,
|
|
171
|
+
enableNative: PropTypes.bool
|
|
172
|
+
};
|
|
173
|
+
export {
|
|
174
|
+
AtSearchBar as default
|
|
120
175
|
};
|
|
121
176
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/search-bar/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Input, Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtSearchBarProps, AtSearchBarState } from '../../../types/search-bar'\n\ntype ExtendEvent = {\n target: {\n value: string\n }\n}\n\nexport default class AtSearchBar extends React.Component<\n AtSearchBarProps,\n AtSearchBarState\n> {\n public static defaultProps: AtSearchBarProps\n public static propTypes: InferProps<AtSearchBarProps>\n\n public constructor(props: AtSearchBarProps) {\n super(props)\n this.state = {\n isFocus: !!props.focus\n }\n }\n\n private handleFocus = (event: CommonEvent): void => {\n this.setState({\n isFocus: true\n })\n this.props.onFocus && this.props.onFocus(event)\n }\n\n private handleBlur = (event: CommonEvent): void => {\n this.setState({\n isFocus: false\n })\n this.props.onBlur && this.props.onBlur(event)\n }\n\n private handleChange = (e: CommonEvent & ExtendEvent): void => {\n this.props.onChange(e.detail.value, e)\n }\n\n private handleClear = (event: CommonEvent): void => {\n if (this.props.onClear) {\n this.props.onClear(event)\n } else {\n this.props.onChange('', event)\n }\n }\n\n private handleConfirm = (event: CommonEvent): void => {\n this.props.onConfirm && this.props.onConfirm(event)\n }\n\n private handleActionClick = (event: CommonEvent): void => {\n this.props.onActionClick && this.props.onActionClick(event)\n }\n\n public UNSAFE_componentWillReceiveProps(nextProps: AtSearchBarProps): void {\n if (nextProps.focus !== this.props.focus) {\n this.setState({ isFocus: !!nextProps.focus })\n }\n }\n\n public render(): JSX.Element {\n const {\n value,\n placeholder,\n maxLength,\n fixed,\n disabled,\n showActionButton,\n actionName = '搜索',\n inputType, // 处理issue#464\n className,\n customStyle,\n enableNative\n } = this.props\n const { isFocus } = this.state\n const fontSize = 14\n const rootCls = classNames(\n 'at-search-bar',\n {\n 'at-search-bar--fixed': fixed\n },\n className\n )\n const placeholderWrapStyle: React.CSSProperties = {}\n const actionStyle: React.CSSProperties = {}\n if (isFocus || (!isFocus && value)) {\n actionStyle.opacity = 1\n actionStyle.marginRight = `0`\n placeholderWrapStyle.flexGrow = 0\n } else if (!isFocus && !value) {\n placeholderWrapStyle.flexGrow = 1\n actionStyle.opacity = 0\n actionStyle.marginRight = `-${\n (actionName.length + 1) * fontSize + fontSize / 2 + 10\n }px`\n }\n if (showActionButton) {\n actionStyle.opacity = 1\n actionStyle.marginRight = `0`\n }\n\n const clearIconStyle: React.CSSProperties = { display: 'flex' }\n const placeholderStyle: React.CSSProperties = { visibility: 'hidden' }\n if (!value.length) {\n clearIconStyle.display = 'none'\n placeholderStyle.visibility = 'visible'\n }\n\n return (\n <View className={rootCls} style={customStyle}>\n <View className='at-search-bar__input-cnt'>\n <View\n className='at-search-bar__placeholder-wrap'\n style={placeholderWrapStyle}\n >\n <Text className='at-icon at-icon-search'></Text>\n <Text\n className='at-search-bar__placeholder'\n style={placeholderStyle}\n >\n {isFocus ? '' : placeholder}\n </Text>\n </View>\n <Input\n className='at-search-bar__input'\n type={inputType}\n confirmType='search'\n value={value}\n focus={isFocus}\n disabled={disabled}\n maxlength={maxLength}\n // @ts-ignore ci 上面这个检查不通过, 暂时跳过ts检查\n enableNative={enableNative}\n onInput={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n onConfirm={this.handleConfirm}\n />\n <View\n className='at-search-bar__clear'\n style={clearIconStyle}\n onTouchStart={this.handleClear}\n >\n <Text className='at-icon at-icon-close-circle'></Text>\n </View>\n </View>\n <View\n className='at-search-bar__action'\n style={actionStyle}\n onClick={this.handleActionClick}\n >\n {actionName}\n </View>\n </View>\n )\n }\n}\n\nAtSearchBar.defaultProps = {\n value: '',\n placeholder: '搜索',\n maxLength: 140,\n fixed: false,\n focus: false,\n disabled: false,\n showActionButton: false,\n actionName: '搜索',\n inputType: 'text',\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange: (): void => {},\n enableNative: true\n}\n\nAtSearchBar.propTypes = {\n value: PropTypes.string,\n placeholder: PropTypes.string,\n maxLength: PropTypes.number,\n fixed: PropTypes.bool,\n focus: PropTypes.bool,\n disabled: PropTypes.bool,\n showActionButton: PropTypes.bool,\n actionName: PropTypes.string,\n inputType: PropTypes.oneOf(['text', 'number', 'idcard', 'digit']),\n onChange: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onConfirm: PropTypes.func,\n onActionClick: PropTypes.func,\n onClear: PropTypes.func,\n enableNative: PropTypes.bool\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 { AtSegmentedControlProps } from '../../../types/segmented-control';
|
|
4
|
+
export default class AtSegmentedControl extends React.Component<AtSegmentedControlProps> {
|
|
5
|
+
static defaultProps: AtSegmentedControlProps;
|
|
6
|
+
static propTypes: InferProps<AtSegmentedControlProps>;
|
|
7
|
+
private handleClick;
|
|
8
|
+
render(): JSX.Element;
|
|
9
|
+
}
|
|
@@ -1,59 +1,84 @@
|
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 AtSegmentedControl extends React.Component {
|
|
7
|
+
handleClick(index, event) {
|
|
8
|
+
if (this.props.disabled) return;
|
|
9
|
+
this.props.onClick(index, event);
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
const {
|
|
13
|
+
customStyle = "",
|
|
14
|
+
className,
|
|
15
|
+
disabled,
|
|
16
|
+
values,
|
|
17
|
+
selectedColor,
|
|
18
|
+
current,
|
|
19
|
+
color,
|
|
20
|
+
fontSize = 28
|
|
21
|
+
} = this.props;
|
|
22
|
+
const rootStyle = {
|
|
23
|
+
borderColor: selectedColor
|
|
24
|
+
};
|
|
25
|
+
const itemStyle = {
|
|
26
|
+
color: selectedColor,
|
|
27
|
+
fontSize: pxTransform(fontSize),
|
|
28
|
+
borderColor: selectedColor,
|
|
29
|
+
backgroundColor: color
|
|
30
|
+
};
|
|
31
|
+
const selectedItemStyle = {
|
|
32
|
+
color,
|
|
33
|
+
fontSize: pxTransform(fontSize),
|
|
34
|
+
borderColor: selectedColor,
|
|
35
|
+
backgroundColor: selectedColor
|
|
36
|
+
};
|
|
37
|
+
const rootCls = classNames(
|
|
38
|
+
"at-segmented-control",
|
|
39
|
+
{
|
|
40
|
+
"at-segmented-control--disabled": disabled
|
|
41
|
+
},
|
|
42
|
+
className
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootCls, style: mergeStyle(rootStyle, customStyle) }, values.map((value, i) => /* @__PURE__ */ React.createElement(
|
|
45
|
+
View,
|
|
46
|
+
{
|
|
47
|
+
className: classNames("at-segmented-control__item", {
|
|
48
|
+
"at-segmented-control__item--active": current === i
|
|
49
|
+
}),
|
|
50
|
+
style: current === i ? selectedItemStyle : itemStyle,
|
|
51
|
+
key: value,
|
|
52
|
+
onClick: this.handleClick.bind(this, i)
|
|
53
|
+
},
|
|
54
|
+
value
|
|
55
|
+
)));
|
|
56
|
+
}
|
|
36
57
|
}
|
|
37
58
|
AtSegmentedControl.defaultProps = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
customStyle: "",
|
|
60
|
+
className: "",
|
|
61
|
+
current: 0,
|
|
62
|
+
color: "",
|
|
63
|
+
fontSize: 28,
|
|
64
|
+
disabled: false,
|
|
65
|
+
selectedColor: "",
|
|
66
|
+
values: [],
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
68
|
+
onClick: () => {
|
|
69
|
+
}
|
|
48
70
|
};
|
|
49
71
|
AtSegmentedControl.propTypes = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
73
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
74
|
+
current: PropTypes.number,
|
|
75
|
+
color: PropTypes.string,
|
|
76
|
+
fontSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
77
|
+
disabled: PropTypes.bool,
|
|
78
|
+
values: PropTypes.array,
|
|
79
|
+
onClick: PropTypes.func
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
AtSegmentedControl as default
|
|
58
83
|
};
|
|
59
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/segmented-control/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 { AtSegmentedControlProps } from '../../../types/segmented-control'\nimport { mergeStyle, pxTransform } from '../../common/utils'\n\nexport default class AtSegmentedControl extends React.Component<AtSegmentedControlProps> {\n public static defaultProps: AtSegmentedControlProps\n public static propTypes: InferProps<AtSegmentedControlProps>\n\n private handleClick(index: number, event: CommonEvent): void {\n if (this.props.disabled) return\n this.props.onClick(index, event)\n }\n\n public render(): JSX.Element {\n const {\n customStyle = '',\n className,\n disabled,\n values,\n selectedColor,\n current,\n color,\n fontSize = 28\n } = this.props\n\n const rootStyle = {\n borderColor: selectedColor\n }\n const itemStyle = {\n color: selectedColor,\n fontSize: pxTransform(fontSize),\n borderColor: selectedColor,\n backgroundColor: color\n }\n const selectedItemStyle = {\n color,\n fontSize: pxTransform(fontSize),\n borderColor: selectedColor,\n backgroundColor: selectedColor\n }\n const rootCls = classNames(\n 'at-segmented-control',\n {\n 'at-segmented-control--disabled': disabled\n },\n className\n )\n\n return (\n <View className={rootCls} style={mergeStyle(rootStyle, customStyle)}>\n {values.map((value, i) => (\n <View\n className={classNames('at-segmented-control__item', {\n 'at-segmented-control__item--active': current === i\n })}\n style={current === i ? selectedItemStyle : itemStyle}\n key={value}\n onClick={this.handleClick.bind(this, i)}\n >\n {value}\n </View>\n ))}\n </View>\n )\n }\n}\n\nAtSegmentedControl.defaultProps = {\n customStyle: '',\n className: '',\n current: 0,\n color: '',\n fontSize: 28,\n disabled: false,\n selectedColor: '',\n values: [],\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClick: (): void => {}\n}\n\nAtSegmentedControl.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n current: PropTypes.number,\n color: PropTypes.string,\n fontSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n values: PropTypes.array,\n onClick: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,SAAS,YAAY,mBAAmB;AAExC,MAAO,2BAAyC,MAAM,UAAmC;AAAA,EAI/E,YAAY,OAAe,OAA0B;AAC3D,QAAI,KAAK,MAAM,SAAU;AACzB,SAAK,MAAM,QAAQ,OAAO,KAAK;AAAA,EACjC;AAAA,EAEO,SAAsB;AAC3B,UAAM;AAAA,MACJ,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,IACb,IAAI,KAAK;AAET,UAAM,YAAY;AAAA,MAChB,aAAa;AAAA,IACf;AACA,UAAM,YAAY;AAAA,MAChB,OAAO;AAAA,MACP,UAAU,YAAY,QAAQ;AAAA,MAC9B,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AACA,UAAM,oBAAoB;AAAA,MACxB;AAAA,MACA,UAAU,YAAY,QAAQ;AAAA,MAC9B,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AACA,UAAM,UAAU;AAAA,MACd;AAAA,MACA;AAAA,QACE,kCAAkC;AAAA,MACpC;AAAA,MACA;AAAA,IACF;AAEA,WACE,oCAAC,QAAK,WAAW,SAAS,OAAO,WAAW,WAAW,WAAW,KAC/D,OAAO,IAAI,CAAC,OAAO,MAClB;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,WAAW,8BAA8B;AAAA,UAClD,sCAAsC,YAAY;AAAA,QACpD,CAAC;AAAA,QACD,OAAO,YAAY,IAAI,oBAAoB;AAAA,QAC3C,KAAK;AAAA,QACL,SAAS,KAAK,YAAY,KAAK,MAAM,CAAC;AAAA;AAAA,MAErC;AAAA,IACH,CACD,CACH;AAAA,EAEJ;AACF;AAEA,mBAAmB,eAAe;AAAA,EAChC,aAAa;AAAA,EACb,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AAAA,EACf,QAAQ,CAAC;AAAA;AAAA,EAET,SAAS,MAAY;AAAA,EAAC;AACxB;AAEA,mBAAmB,YAAY;AAAA,EAC7B,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,SAAS,UAAU;AAAA,EACnB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EAClE,UAAU,UAAU;AAAA,EACpB,QAAQ,UAAU;AAAA,EAClB,SAAS,UAAU;AACrB;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtSliderProps, AtSliderState } from '../../../types/slider';
|
|
4
|
+
export default class AtSlider extends React.Component<AtSliderProps, AtSliderState> {
|
|
5
|
+
static defaultProps: AtSliderProps;
|
|
6
|
+
static propTypes: InferProps<AtSliderProps>;
|
|
7
|
+
constructor(props: AtSliderProps);
|
|
8
|
+
protected static clampNumber(value: number, lower: number, upper: number): number;
|
|
9
|
+
private handleChanging;
|
|
10
|
+
private handleChange;
|
|
11
|
+
UNSAFE_componentWillReceiveProps(props: AtSliderProps): void;
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|