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,55 +1,75 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { View } from
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
5
|
const SIZE_CLASS = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
normal: "normal",
|
|
7
|
+
small: "small"
|
|
8
8
|
};
|
|
9
9
|
const TYPE_CLASS = {
|
|
10
|
-
|
|
10
|
+
primary: "primary"
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
render() {
|
|
24
|
-
const { size = 'normal', type = '', circle = false, disabled = false, active = false, customStyle } = this.props;
|
|
25
|
-
const rootClassName = ['at-tag'];
|
|
26
|
-
const classObject = {
|
|
27
|
-
[`at-tag--${SIZE_CLASS[size]}`]: SIZE_CLASS[size],
|
|
28
|
-
[`at-tag--${type}`]: TYPE_CLASS[type],
|
|
29
|
-
'at-tag--disabled': disabled,
|
|
30
|
-
'at-tag--active': active,
|
|
31
|
-
'at-tag--circle': circle
|
|
32
|
-
};
|
|
33
|
-
return (React.createElement(View, { className: classNames(rootClassName, classObject, this.props.className), style: customStyle, onClick: this.onClick.bind(this) }, this.props.children));
|
|
12
|
+
class AtTag extends React.Component {
|
|
13
|
+
onClick(event) {
|
|
14
|
+
const { name = "", active = false, disabled, onClick } = this.props;
|
|
15
|
+
if (!disabled) {
|
|
16
|
+
typeof onClick === "function" && onClick(
|
|
17
|
+
{
|
|
18
|
+
name,
|
|
19
|
+
active
|
|
20
|
+
},
|
|
21
|
+
event
|
|
22
|
+
);
|
|
34
23
|
}
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const {
|
|
27
|
+
size = "normal",
|
|
28
|
+
type = "",
|
|
29
|
+
circle = false,
|
|
30
|
+
disabled = false,
|
|
31
|
+
active = false,
|
|
32
|
+
customStyle
|
|
33
|
+
} = this.props;
|
|
34
|
+
const rootClassName = ["at-tag"];
|
|
35
|
+
const classObject = {
|
|
36
|
+
[`at-tag--${SIZE_CLASS[size]}`]: SIZE_CLASS[size],
|
|
37
|
+
[`at-tag--${type}`]: TYPE_CLASS[type],
|
|
38
|
+
"at-tag--disabled": disabled,
|
|
39
|
+
"at-tag--active": active,
|
|
40
|
+
"at-tag--circle": circle
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ React.createElement(
|
|
43
|
+
View,
|
|
44
|
+
{
|
|
45
|
+
className: classNames(rootClassName, classObject, this.props.className),
|
|
46
|
+
style: customStyle,
|
|
47
|
+
onClick: this.onClick.bind(this)
|
|
48
|
+
},
|
|
49
|
+
this.props.children
|
|
50
|
+
);
|
|
51
|
+
}
|
|
35
52
|
}
|
|
36
53
|
AtTag.defaultProps = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
size: "normal",
|
|
55
|
+
type: "",
|
|
56
|
+
name: "",
|
|
57
|
+
circle: false,
|
|
58
|
+
active: false,
|
|
59
|
+
disabled: false,
|
|
60
|
+
customStyle: {}
|
|
44
61
|
};
|
|
45
62
|
AtTag.propTypes = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
size: PropTypes.oneOf(["normal", "small"]),
|
|
64
|
+
type: PropTypes.oneOf(["", "primary"]),
|
|
65
|
+
name: PropTypes.string,
|
|
66
|
+
circle: PropTypes.bool,
|
|
67
|
+
active: PropTypes.bool,
|
|
68
|
+
disabled: PropTypes.bool,
|
|
69
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
70
|
+
onClick: PropTypes.func
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
AtTag as default
|
|
54
74
|
};
|
|
55
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tag/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 { AtTagProps } from '../../../types/tag'\n\nconst SIZE_CLASS = {\n normal: 'normal',\n small: 'small'\n}\n\nconst TYPE_CLASS = {\n primary: 'primary'\n}\n\nexport default class AtTag extends React.Component<AtTagProps> {\n public static defaultProps: AtTagProps\n public static propTypes: InferProps<AtTagProps>\n\n private onClick(event: CommonEvent): void {\n const { name = '', active = false, disabled, onClick } = this.props\n if (!disabled) {\n typeof onClick === 'function' &&\n onClick(\n {\n name,\n active\n },\n event\n )\n }\n }\n\n public render(): JSX.Element {\n const {\n size = 'normal',\n type = '',\n circle = false,\n disabled = false,\n active = false,\n customStyle\n } = this.props\n const rootClassName = ['at-tag']\n\n const classObject = {\n [`at-tag--${SIZE_CLASS[size]}`]: SIZE_CLASS[size],\n [`at-tag--${type}`]: TYPE_CLASS[type],\n 'at-tag--disabled': disabled,\n 'at-tag--active': active,\n 'at-tag--circle': circle\n }\n\n return (\n <View\n className={classNames(rootClassName, classObject, this.props.className)}\n style={customStyle}\n onClick={this.onClick.bind(this)}\n >\n {this.props.children}\n </View>\n )\n }\n}\n\nAtTag.defaultProps = {\n size: 'normal',\n type: '',\n name: '',\n circle: false,\n active: false,\n disabled: false,\n customStyle: {}\n}\n\nAtTag.propTypes = {\n size: PropTypes.oneOf(['normal', 'small']),\n type: PropTypes.oneOf(['', 'primary']),\n name: PropTypes.string,\n circle: PropTypes.bool,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n onClick: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY;AAIrB,MAAM,aAAa;AAAA,EACjB,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,MAAM,aAAa;AAAA,EACjB,SAAS;AACX;AAEA,MAAO,cAA4B,MAAM,UAAsB;AAAA,EAIrD,QAAQ,OAA0B;AACxC,UAAM,EAAE,OAAO,IAAI,SAAS,OAAO,UAAU,QAAQ,IAAI,KAAK;AAC9D,QAAI,CAAC,UAAU;AACb,aAAO,YAAY,cACjB;AAAA,QACE;AAAA,UACE;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA,IACJ;AAAA,EACF;AAAA,EAEO,SAAsB;AAC3B,UAAM;AAAA,MACJ,OAAO;AAAA,MACP,OAAO;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,MACT;AAAA,IACF,IAAI,KAAK;AACT,UAAM,gBAAgB,CAAC,QAAQ;AAE/B,UAAM,cAAc;AAAA,MAClB,CAAC,WAAW,WAAW,IAAI,CAAC,EAAE,GAAG,WAAW,IAAI;AAAA,MAChD,CAAC,WAAW,IAAI,EAAE,GAAG,WAAW,IAAI;AAAA,MACpC,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,IACpB;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,WAAW,eAAe,aAAa,KAAK,MAAM,SAAS;AAAA,QACtE,OAAO;AAAA,QACP,SAAS,KAAK,QAAQ,KAAK,IAAI;AAAA;AAAA,MAE9B,KAAK,MAAM;AAAA,IACd;AAAA,EAEJ;AACF;AAEA,MAAM,eAAe;AAAA,EACnB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa,CAAC;AAChB;AAEA,MAAM,YAAY;AAAA,EAChB,MAAM,UAAU,MAAM,CAAC,UAAU,OAAO,CAAC;AAAA,EACzC,MAAM,UAAU,MAAM,CAAC,IAAI,SAAS,CAAC;AAAA,EACrC,MAAM,UAAU;AAAA,EAChB,QAAQ,UAAU;AAAA,EAClB,QAAQ,UAAU;AAAA,EAClB,UAAU,UAAU;AAAA,EACpB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,SAAS,UAAU;AACrB;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtTextareaProps } from '../../../types/textarea';
|
|
4
|
+
export default class AtTextarea extends React.Component<AtTextareaProps> {
|
|
5
|
+
static defaultProps: AtTextareaProps;
|
|
6
|
+
static propTypes: InferProps<AtTextareaProps>;
|
|
7
|
+
private handleInput;
|
|
8
|
+
private handleFocus;
|
|
9
|
+
private handleBlur;
|
|
10
|
+
private handleConfirm;
|
|
11
|
+
private handleLinechange;
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
@@ -1,95 +1,141 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { Textarea, View } from
|
|
5
|
-
import Taro from
|
|
6
|
-
import { pxTransform } from
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Textarea, View } from "@tarojs/components";
|
|
5
|
+
import Taro from "@tarojs/taro";
|
|
6
|
+
import { pxTransform } from "../../common/utils";
|
|
7
7
|
function getMaxLength(maxLength, textOverflowForbidden) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (!textOverflowForbidden) {
|
|
9
|
+
return maxLength + 500;
|
|
10
|
+
}
|
|
11
|
+
return maxLength;
|
|
12
12
|
}
|
|
13
13
|
const ENV = Taro.getEnv();
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
14
|
+
class AtTextarea extends React.Component {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.handleInput = (event) => {
|
|
18
|
+
this.props.onChange(event.detail.value, event);
|
|
19
|
+
};
|
|
20
|
+
this.handleFocus = (event) => {
|
|
21
|
+
this.props.onFocus && this.props.onFocus(event);
|
|
22
|
+
};
|
|
23
|
+
this.handleBlur = (event) => {
|
|
24
|
+
this.props.onBlur && this.props.onBlur(event);
|
|
25
|
+
};
|
|
26
|
+
this.handleConfirm = (event) => {
|
|
27
|
+
this.props.onConfirm && this.props.onConfirm(event);
|
|
28
|
+
};
|
|
29
|
+
this.handleLinechange = (event) => {
|
|
30
|
+
this.props.onLinechange && this.props.onLinechange(event);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
const {
|
|
35
|
+
customStyle,
|
|
36
|
+
className,
|
|
37
|
+
value,
|
|
38
|
+
cursorSpacing,
|
|
39
|
+
placeholder,
|
|
40
|
+
placeholderStyle,
|
|
41
|
+
placeholderClass,
|
|
42
|
+
maxLength = 200,
|
|
43
|
+
count,
|
|
44
|
+
disabled,
|
|
45
|
+
autoFocus,
|
|
46
|
+
focus,
|
|
47
|
+
showConfirmBar,
|
|
48
|
+
selectionStart,
|
|
49
|
+
selectionEnd,
|
|
50
|
+
fixed,
|
|
51
|
+
textOverflowForbidden = true,
|
|
52
|
+
height
|
|
53
|
+
} = this.props;
|
|
54
|
+
const _maxLength = parseInt(maxLength.toString());
|
|
55
|
+
const actualMaxLength = getMaxLength(_maxLength, textOverflowForbidden);
|
|
56
|
+
const textareaStyle = height ? `height:${pxTransform(Number(height))}` : "";
|
|
57
|
+
const rootCls = classNames(
|
|
58
|
+
"at-textarea",
|
|
59
|
+
`at-textarea--${ENV}`,
|
|
60
|
+
{
|
|
61
|
+
"at-textarea--error": _maxLength < (value || "").length
|
|
62
|
+
},
|
|
63
|
+
className
|
|
64
|
+
);
|
|
65
|
+
const placeholderCls = classNames("placeholder", placeholderClass);
|
|
66
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootCls, style: customStyle }, /* @__PURE__ */ React.createElement(
|
|
67
|
+
Textarea,
|
|
68
|
+
{
|
|
69
|
+
className: "at-textarea__textarea",
|
|
70
|
+
style: textareaStyle,
|
|
71
|
+
placeholderStyle,
|
|
72
|
+
placeholderClass: placeholderCls,
|
|
73
|
+
cursorSpacing,
|
|
74
|
+
value: value || "",
|
|
75
|
+
maxlength: actualMaxLength,
|
|
76
|
+
placeholder,
|
|
77
|
+
disabled,
|
|
78
|
+
autoFocus,
|
|
79
|
+
focus,
|
|
80
|
+
showConfirmBar,
|
|
81
|
+
selectionStart,
|
|
82
|
+
selectionEnd,
|
|
83
|
+
fixed,
|
|
84
|
+
onInput: this.handleInput,
|
|
85
|
+
onFocus: this.handleFocus,
|
|
86
|
+
onBlur: this.handleBlur,
|
|
87
|
+
onConfirm: this.handleConfirm,
|
|
88
|
+
onLineChange: this.handleLinechange
|
|
89
|
+
}
|
|
90
|
+
), count && /* @__PURE__ */ React.createElement(View, { className: "at-textarea__counter" }, (value || "").length, "/", _maxLength));
|
|
91
|
+
}
|
|
49
92
|
}
|
|
50
93
|
AtTextarea.defaultProps = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
customStyle: "",
|
|
95
|
+
className: "",
|
|
96
|
+
cursorSpacing: 100,
|
|
97
|
+
maxLength: 200,
|
|
98
|
+
placeholder: "",
|
|
99
|
+
disabled: false,
|
|
100
|
+
autoFocus: false,
|
|
101
|
+
focus: false,
|
|
102
|
+
showConfirmBar: false,
|
|
103
|
+
selectionStart: -1,
|
|
104
|
+
selectionEnd: -1,
|
|
105
|
+
count: true,
|
|
106
|
+
fixed: false,
|
|
107
|
+
height: "",
|
|
108
|
+
textOverflowForbidden: true,
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
110
|
+
onChange: () => {
|
|
111
|
+
}
|
|
69
112
|
};
|
|
70
113
|
AtTextarea.propTypes = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
114
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
115
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
116
|
+
value: PropTypes.string,
|
|
117
|
+
cursorSpacing: PropTypes.number,
|
|
118
|
+
maxLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
119
|
+
placeholderClass: PropTypes.string,
|
|
120
|
+
placeholderStyle: PropTypes.string,
|
|
121
|
+
placeholder: PropTypes.string,
|
|
122
|
+
disabled: PropTypes.bool,
|
|
123
|
+
autoFocus: PropTypes.bool,
|
|
124
|
+
focus: PropTypes.bool,
|
|
125
|
+
showConfirmBar: PropTypes.bool,
|
|
126
|
+
selectionStart: PropTypes.number,
|
|
127
|
+
selectionEnd: PropTypes.number,
|
|
128
|
+
count: PropTypes.bool,
|
|
129
|
+
textOverflowForbidden: PropTypes.bool,
|
|
130
|
+
fixed: PropTypes.bool,
|
|
131
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
132
|
+
onLinechange: PropTypes.func,
|
|
133
|
+
onChange: PropTypes.func.isRequired,
|
|
134
|
+
onFocus: PropTypes.func,
|
|
135
|
+
onBlur: PropTypes.func,
|
|
136
|
+
onConfirm: PropTypes.func
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
AtTextarea as default
|
|
94
140
|
};
|
|
95
141
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/textarea/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Textarea, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport Taro from '@tarojs/taro'\nimport { AtTextareaProps } from '../../../types/textarea'\nimport { pxTransform } from '../../common/utils'\n\ntype ExtendEvent = {\n target: {\n value: string\n }\n}\n\nfunction getMaxLength(\n maxLength: number,\n textOverflowForbidden: boolean\n): number {\n if (!textOverflowForbidden) {\n return maxLength + 500\n }\n return maxLength\n}\n\nconst ENV = Taro.getEnv()\n\nexport default class AtTextarea extends React.Component<AtTextareaProps> {\n public static defaultProps: AtTextareaProps\n public static propTypes: InferProps<AtTextareaProps>\n\n private handleInput = (event: CommonEvent & ExtendEvent): void => {\n this.props.onChange(event.detail.value, event)\n }\n\n private handleFocus = (event: CommonEvent): void => {\n this.props.onFocus && this.props.onFocus(event)\n }\n\n private handleBlur = (event: CommonEvent): void => {\n this.props.onBlur && this.props.onBlur(event)\n }\n\n private handleConfirm = (event: CommonEvent): void => {\n this.props.onConfirm && this.props.onConfirm(event)\n }\n\n private handleLinechange = (event: CommonEvent): void => {\n this.props.onLinechange && this.props.onLinechange(event)\n }\n\n public render(): JSX.Element {\n const {\n customStyle,\n className,\n value,\n cursorSpacing,\n placeholder,\n placeholderStyle,\n placeholderClass,\n maxLength = 200,\n count,\n disabled,\n autoFocus,\n focus,\n showConfirmBar,\n selectionStart,\n selectionEnd,\n fixed,\n textOverflowForbidden = true,\n height\n } = this.props\n\n const _maxLength = parseInt(maxLength.toString())\n const actualMaxLength = getMaxLength(_maxLength, textOverflowForbidden)\n const textareaStyle = height ? `height:${pxTransform(Number(height))}` : ''\n const rootCls = classNames(\n 'at-textarea',\n `at-textarea--${ENV}`,\n {\n 'at-textarea--error': _maxLength < (value || '').length\n },\n className\n )\n const placeholderCls = classNames('placeholder', placeholderClass)\n\n return (\n <View className={rootCls} style={customStyle}>\n <Textarea\n className='at-textarea__textarea'\n style={textareaStyle}\n placeholderStyle={placeholderStyle}\n placeholderClass={placeholderCls}\n cursorSpacing={cursorSpacing}\n value={value || ''}\n maxlength={actualMaxLength}\n placeholder={placeholder}\n disabled={disabled}\n autoFocus={autoFocus}\n focus={focus}\n showConfirmBar={showConfirmBar}\n selectionStart={selectionStart}\n selectionEnd={selectionEnd}\n fixed={fixed}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n onConfirm={this.handleConfirm}\n onLineChange={this.handleLinechange}\n />\n {count && (\n <View className='at-textarea__counter'>\n {(value || '').length}/{_maxLength}\n </View>\n )}\n </View>\n )\n }\n}\n\nAtTextarea.defaultProps = {\n customStyle: '',\n className: '',\n cursorSpacing: 100,\n maxLength: 200,\n placeholder: '',\n disabled: false,\n autoFocus: false,\n focus: false,\n showConfirmBar: false,\n selectionStart: -1,\n selectionEnd: -1,\n count: true,\n fixed: false,\n height: '',\n textOverflowForbidden: true,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange: (): void => {}\n}\n\nAtTextarea.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n value: PropTypes.string,\n cursorSpacing: PropTypes.number,\n maxLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n placeholderClass: PropTypes.string,\n placeholderStyle: PropTypes.string,\n placeholder: PropTypes.string,\n disabled: PropTypes.bool,\n autoFocus: PropTypes.bool,\n focus: PropTypes.bool,\n showConfirmBar: PropTypes.bool,\n selectionStart: PropTypes.number,\n selectionEnd: PropTypes.number,\n count: PropTypes.bool,\n textOverflowForbidden: PropTypes.bool,\n fixed: PropTypes.bool,\n height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onLinechange: PropTypes.func,\n onChange: PropTypes.func.isRequired,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onConfirm: PropTypes.func\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtTimelineProps } from '../../../types/timeline';
|
|
4
|
+
export default class AtTimeline extends React.Component<AtTimelineProps> {
|
|
5
|
+
static defaultProps: AtTimelineProps;
|
|
6
|
+
static propTypes: InferProps<AtTimelineProps>;
|
|
7
|
+
render(): JSX.Element;
|
|
8
|
+
}
|
|
@@ -1,53 +1,76 @@
|
|
|
1
|
-
import classNames from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { 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
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Text, View } from "@tarojs/components";
|
|
5
|
+
class AtTimeline extends React.Component {
|
|
6
|
+
render() {
|
|
7
|
+
const { pending, items, customStyle, onClickItem } = this.props;
|
|
8
|
+
const rootClassName = ["at-timeline"];
|
|
9
|
+
if (pending) rootClassName.push("at-timeline--pending");
|
|
10
|
+
const rootClassObject = {
|
|
11
|
+
"at-timeline--pending": pending
|
|
12
|
+
};
|
|
13
|
+
const itemElems = items.map((item, index) => {
|
|
14
|
+
const { title = "", color, icon, content = [] } = item;
|
|
15
|
+
const iconClass = classNames({
|
|
16
|
+
"at-icon": true,
|
|
17
|
+
[`at-icon-${icon}`]: icon
|
|
18
|
+
});
|
|
19
|
+
const itemRootClassName = ["at-timeline-item"];
|
|
20
|
+
if (color) itemRootClassName.push(`at-timeline-item--${color}`);
|
|
21
|
+
const dotClass = [];
|
|
22
|
+
if (icon) {
|
|
23
|
+
dotClass.push("at-timeline-item__icon");
|
|
24
|
+
} else {
|
|
25
|
+
dotClass.push("at-timeline-item__dot");
|
|
26
|
+
}
|
|
27
|
+
const handleItemClick = (index2, e) => {
|
|
28
|
+
onClickItem == null ? void 0 : onClickItem(index2, e);
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ React.createElement(
|
|
31
|
+
View,
|
|
32
|
+
{
|
|
33
|
+
className: classNames(itemRootClassName),
|
|
34
|
+
key: `at-timeline-item-${index}`,
|
|
35
|
+
onClick: (e) => handleItemClick(index, e)
|
|
36
|
+
},
|
|
37
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-timeline-item__tail" }),
|
|
38
|
+
/* @__PURE__ */ React.createElement(View, { className: classNames(dotClass) }, icon && /* @__PURE__ */ React.createElement(Text, { className: iconClass })),
|
|
39
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-timeline-item__content" }, /* @__PURE__ */ React.createElement(View, { className: "at-timeline-item__content-item" }, title), content.map((sub, subIndex) => /* @__PURE__ */ React.createElement(
|
|
40
|
+
View,
|
|
41
|
+
{
|
|
42
|
+
className: "at-timeline-item__content-item at-timeline-item__content--sub",
|
|
43
|
+
key: subIndex
|
|
44
|
+
},
|
|
45
|
+
sub
|
|
46
|
+
)))
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ React.createElement(
|
|
50
|
+
View,
|
|
51
|
+
{
|
|
52
|
+
className: classNames(
|
|
53
|
+
rootClassName,
|
|
54
|
+
rootClassObject,
|
|
55
|
+
this.props.className
|
|
56
|
+
),
|
|
57
|
+
style: customStyle
|
|
58
|
+
},
|
|
59
|
+
itemElems
|
|
60
|
+
);
|
|
61
|
+
}
|
|
42
62
|
}
|
|
43
63
|
AtTimeline.defaultProps = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
pending: false,
|
|
65
|
+
items: [],
|
|
66
|
+
customStyle: {}
|
|
47
67
|
};
|
|
48
68
|
AtTimeline.propTypes = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
pending: PropTypes.bool,
|
|
70
|
+
items: PropTypes.arrayOf(PropTypes.object),
|
|
71
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string])
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
AtTimeline as default
|
|
52
75
|
};
|
|
53
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/timeline/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtTimelineProps } from '../../../types/timeline'\n\nexport default class AtTimeline extends React.Component<AtTimelineProps> {\n public static defaultProps: AtTimelineProps\n public static propTypes: InferProps<AtTimelineProps>\n\n public render(): JSX.Element {\n const { pending, items, customStyle, onClickItem } = this.props\n\n const rootClassName = ['at-timeline']\n if (pending) rootClassName.push('at-timeline--pending')\n\n const rootClassObject = {\n 'at-timeline--pending': pending\n }\n\n const itemElems = items.map((item, index) => {\n const { title = '', color, icon, content = [] } = item\n\n const iconClass = classNames({\n 'at-icon': true,\n [`at-icon-${icon}`]: icon\n })\n\n const itemRootClassName = ['at-timeline-item']\n if (color) itemRootClassName.push(`at-timeline-item--${color}`)\n\n const dotClass: string[] = []\n if (icon) {\n dotClass.push('at-timeline-item__icon')\n } else {\n dotClass.push('at-timeline-item__dot')\n }\n\n const handleItemClick = (index, e) => {\n onClickItem?.(index, e)\n }\n\n return (\n <View\n className={classNames(itemRootClassName)}\n key={`at-timeline-item-${index}`}\n onClick={e => handleItemClick(index, e)}\n >\n <View className='at-timeline-item__tail'></View>\n <View className={classNames(dotClass)}>\n {icon && <Text className={iconClass}></Text>}\n </View>\n <View className='at-timeline-item__content'>\n <View className='at-timeline-item__content-item'>{title}</View>\n {content.map((sub, subIndex) => (\n <View\n className='at-timeline-item__content-item at-timeline-item__content--sub'\n key={subIndex}\n >\n {sub}\n </View>\n ))}\n </View>\n </View>\n )\n })\n return (\n <View\n className={classNames(\n rootClassName,\n rootClassObject,\n this.props.className\n )}\n style={customStyle}\n >\n {itemElems}\n </View>\n )\n }\n}\n\nAtTimeline.defaultProps = {\n pending: false,\n items: [],\n customStyle: {}\n}\n\nAtTimeline.propTypes = {\n pending: PropTypes.bool,\n items: PropTypes.arrayOf(PropTypes.object),\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string])\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAG3B,MAAO,mBAAiC,MAAM,UAA2B;AAAA,EAIhE,SAAsB;AAC3B,UAAM,EAAE,SAAS,OAAO,aAAa,YAAY,IAAI,KAAK;AAE1D,UAAM,gBAAgB,CAAC,aAAa;AACpC,QAAI,QAAS,eAAc,KAAK,sBAAsB;AAEtD,UAAM,kBAAkB;AAAA,MACtB,wBAAwB;AAAA,IAC1B;AAEA,UAAM,YAAY,MAAM,IAAI,CAAC,MAAM,UAAU;AAC3C,YAAM,EAAE,QAAQ,IAAI,OAAO,MAAM,UAAU,CAAC,EAAE,IAAI;AAElD,YAAM,YAAY,WAAW;AAAA,QAC3B,WAAW;AAAA,QACX,CAAC,WAAW,IAAI,EAAE,GAAG;AAAA,MACvB,CAAC;AAED,YAAM,oBAAoB,CAAC,kBAAkB;AAC7C,UAAI,MAAO,mBAAkB,KAAK,qBAAqB,KAAK,EAAE;AAE9D,YAAM,WAAqB,CAAC;AAC5B,UAAI,MAAM;AACR,iBAAS,KAAK,wBAAwB;AAAA,MACxC,OAAO;AACL,iBAAS,KAAK,uBAAuB;AAAA,MACvC;AAEA,YAAM,kBAAkB,CAACA,QAAO,MAAM;AACpC,mDAAcA,QAAO;AAAA,MACvB;AAEA,aACE;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,WAAW,iBAAiB;AAAA,UACvC,KAAK,oBAAoB,KAAK;AAAA,UAC9B,SAAS,OAAK,gBAAgB,OAAO,CAAC;AAAA;AAAA,QAEtC,oCAAC,QAAK,WAAU,0BAAyB;AAAA,QACzC,oCAAC,QAAK,WAAW,WAAW,QAAQ,KACjC,QAAQ,oCAAC,QAAK,WAAW,WAAW,CACvC;AAAA,QACA,oCAAC,QAAK,WAAU,+BACd,oCAAC,QAAK,WAAU,oCAAkC,KAAM,GACvD,QAAQ,IAAI,CAAC,KAAK,aACjB;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,KAAK;AAAA;AAAA,UAEJ;AAAA,QACH,CACD,CACH;AAAA,MACF;AAAA,IAEJ,CAAC;AACD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA,KAAK,MAAM;AAAA,QACb;AAAA,QACA,OAAO;AAAA;AAAA,MAEN;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,WAAW,eAAe;AAAA,EACxB,SAAS;AAAA,EACT,OAAO,CAAC;AAAA,EACR,aAAa,CAAC;AAChB;AAEA,WAAW,YAAY;AAAA,EACrB,SAAS,UAAU;AAAA,EACnB,OAAO,UAAU,QAAQ,UAAU,MAAM;AAAA,EACzC,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AACvE;","names":["index"]}
|