taro-ui 3.3.1 → 3.3.3
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/dist/common/component.d.ts +10 -0
- package/dist/common/component.js +32 -0
- package/dist/common/component.js.map +1 -0
- package/dist/common/utils.d.ts +41 -0
- package/dist/common/utils.js +203 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +121 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/action-sheet/body/index.d.ts +5 -0
- package/dist/components/action-sheet/body/index.js +13 -0
- package/dist/components/action-sheet/body/index.js.map +1 -0
- package/dist/components/action-sheet/body/item/index.d.ts +9 -0
- package/dist/components/action-sheet/body/item/index.js +25 -0
- package/dist/components/action-sheet/body/item/index.js.map +1 -0
- package/dist/components/action-sheet/footer/index.d.ts +9 -0
- package/dist/components/action-sheet/footer/index.js +28 -0
- package/dist/components/action-sheet/footer/index.js.map +1 -0
- package/dist/components/action-sheet/header/index.d.ts +5 -0
- package/dist/components/action-sheet/header/index.js +16 -0
- package/dist/components/action-sheet/header/index.js.map +1 -0
- package/dist/components/action-sheet/index.d.ts +14 -0
- package/dist/components/action-sheet/index.js +76 -0
- package/dist/components/action-sheet/index.js.map +1 -0
- package/dist/components/activity-indicator/index.d.ts +8 -0
- package/dist/components/activity-indicator/index.js +39 -0
- package/dist/components/activity-indicator/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +9 -0
- package/dist/components/avatar/index.js +68 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +10 -0
- package/dist/components/badge/index.js +51 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/button/index.d.ts +15 -0
- package/dist/components/button/index.js +177 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/calendar/body/index.d.ts +26 -0
- package/dist/components/calendar/body/index.js +289 -0
- package/dist/components/calendar/body/index.js.map +1 -0
- package/dist/components/calendar/common/constant.d.ts +3 -0
- package/dist/components/calendar/common/constant.js +9 -0
- package/dist/components/calendar/common/constant.js.map +1 -0
- package/dist/components/calendar/common/helper.d.ts +4 -0
- package/dist/components/calendar/common/helper.js +84 -0
- package/dist/components/calendar/common/helper.js.map +1 -0
- package/dist/components/calendar/common/plugins.d.ts +11 -0
- package/dist/components/calendar/common/plugins.js +55 -0
- package/dist/components/calendar/common/plugins.js.map +1 -0
- package/dist/components/calendar/controller/index.d.ts +5 -0
- package/dist/components/calendar/controller/index.js +51 -0
- package/dist/components/calendar/controller/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +20 -0
- package/dist/components/calendar/index.js +244 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/calendar/ui/date-list/index.d.ts +12 -0
- package/dist/components/calendar/ui/date-list/index.js +54 -0
- package/dist/components/calendar/ui/date-list/index.js.map +1 -0
- package/dist/components/calendar/ui/day-list/index.d.ts +4 -0
- package/dist/components/calendar/ui/day-list/index.js +11 -0
- package/dist/components/calendar/ui/day-list/index.js.map +1 -0
- package/dist/components/card/index.d.ts +9 -0
- package/dist/components/card/index.js +80 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +9 -0
- package/dist/components/checkbox/index.js +59 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/countdown/index.d.ts +20 -0
- package/dist/components/countdown/index.js +152 -0
- package/dist/components/countdown/index.js.map +1 -0
- package/dist/components/countdown/item/index.d.ts +9 -0
- package/dist/components/countdown/item/index.js +24 -0
- package/dist/components/countdown/item/index.js.map +1 -0
- package/dist/components/curtain/index.d.ts +10 -0
- package/dist/components/curtain/index.js +62 -0
- package/dist/components/curtain/index.js.map +1 -0
- package/dist/components/divider/index.d.ts +8 -0
- package/dist/components/divider/index.js +57 -0
- package/dist/components/divider/index.js.map +1 -0
- package/dist/components/drawer/index.d.ts +16 -0
- package/dist/components/drawer/index.js +114 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +9 -0
- package/dist/components/fab/index.js +29 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/flex/index.d.ts +7 -0
- package/dist/components/flex/index.js +41 -0
- package/dist/components/flex/index.js.map +1 -0
- package/dist/components/flex/item/index.d.ts +7 -0
- package/dist/components/flex/item/index.js +34 -0
- package/dist/components/flex/item/index.js.map +1 -0
- package/dist/components/float-layout/index.d.ts +13 -0
- package/dist/components/float-layout/index.js +104 -0
- package/dist/components/float-layout/index.js.map +1 -0
- package/dist/components/form/index.d.ts +10 -0
- package/dist/components/form/index.js +43 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/grid/index.d.ts +9 -0
- package/dist/components/grid/index.js +101 -0
- package/dist/components/grid/index.js.map +1 -0
- package/dist/components/icon/index.d.ts +9 -0
- package/dist/components/icon/index.js +54 -0
- package/dist/components/icon/index.js.map +1 -0
- package/dist/components/image-picker/index.d.ts +11 -0
- package/dist/components/image-picker/index.js +164 -0
- package/dist/components/image-picker/index.js.map +1 -0
- package/dist/components/indexes/index.d.ts +29 -0
- package/dist/components/indexes/index.js +272 -0
- package/dist/components/indexes/index.js.map +1 -0
- package/dist/components/input/index.d.ts +17 -0
- package/dist/components/input/index.js +232 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input-number/index.d.ts +13 -0
- package/dist/components/input-number/index.js +193 -0
- package/dist/components/input-number/index.js.map +1 -0
- package/dist/components/list/index.d.ts +8 -0
- package/dist/components/list/index.js +26 -0
- package/dist/components/list/index.js.map +1 -0
- package/dist/components/list/item/index.d.ts +11 -0
- package/dist/components/list/item/index.js +152 -0
- package/dist/components/list/item/index.js.map +1 -0
- package/dist/components/load-more/index.d.ts +9 -0
- package/dist/components/load-more/index.js +72 -0
- package/dist/components/load-more/index.js.map +1 -0
- package/dist/components/loading/index.d.ts +12 -0
- package/dist/components/loading/index.js +32 -0
- package/dist/components/loading/index.js.map +1 -0
- package/dist/components/message/index.d.ts +15 -0
- package/dist/components/message/index.js +78 -0
- package/dist/components/message/index.js.map +1 -0
- package/dist/components/modal/action/index.d.ts +8 -0
- package/dist/components/modal/action/index.js +26 -0
- package/dist/components/modal/action/index.js.map +1 -0
- package/dist/components/modal/content/index.d.ts +5 -0
- package/dist/components/modal/content/index.js +13 -0
- package/dist/components/modal/content/index.js.map +1 -0
- package/dist/components/modal/header/index.d.ts +5 -0
- package/dist/components/modal/header/index.js +13 -0
- package/dist/components/modal/header/index.js.map +1 -0
- package/dist/components/modal/index.d.ts +15 -0
- package/dist/components/modal/index.js +106 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/nav-bar/index.d.ts +12 -0
- package/dist/components/nav-bar/index.js +217 -0
- package/dist/components/nav-bar/index.js.map +1 -0
- package/dist/components/noticebar/index.d.ts +16 -0
- package/dist/components/noticebar/index.js +186 -0
- package/dist/components/noticebar/index.js.map +1 -0
- package/dist/components/pagination/index.d.ts +12 -0
- package/dist/components/pagination/index.js +146 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/progress/index.d.ts +7 -0
- package/dist/components/progress/index.js +53 -0
- package/dist/components/progress/index.js.map +1 -0
- package/dist/components/radio/index.d.ts +9 -0
- package/dist/components/radio/index.js +54 -0
- package/dist/components/radio/index.js.map +1 -0
- package/dist/components/range/index.d.ts +22 -0
- package/dist/components/range/index.js +207 -0
- package/dist/components/range/index.js.map +1 -0
- package/dist/components/rate/index.d.ts +9 -0
- package/dist/components/rate/index.js +82 -0
- package/dist/components/rate/index.js.map +1 -0
- package/dist/components/search-bar/index.d.ts +16 -0
- package/dist/components/search-bar/index.js +176 -0
- package/dist/components/search-bar/index.js.map +1 -0
- package/dist/components/segmented-control/index.d.ts +9 -0
- package/dist/components/segmented-control/index.js +84 -0
- package/dist/components/segmented-control/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +13 -0
- package/dist/components/slider/index.js +115 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/steps/index.d.ts +9 -0
- package/dist/components/steps/index.js +67 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/swipe-action/index.d.ts +27 -0
- package/dist/components/swipe-action/index.js +220 -0
- package/dist/components/swipe-action/index.js.map +1 -0
- package/dist/components/swipe-action/options/index.d.ts +5 -0
- package/dist/components/swipe-action/options/index.js +24 -0
- package/dist/components/swipe-action/options/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +9 -0
- package/dist/components/switch/index.js +59 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/tab-bar/index.d.ts +9 -0
- package/dist/components/tab-bar/index.js +170 -0
- package/dist/components/tab-bar/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +24 -0
- package/dist/components/tabs/index.js +219 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs-pane/index.d.ts +8 -0
- package/dist/components/tabs-pane/index.js +43 -0
- package/dist/components/tabs-pane/index.js.map +1 -0
- package/dist/components/tag/index.d.ts +9 -0
- package/dist/components/tag/index.js +75 -0
- package/dist/components/tag/index.js.map +1 -0
- package/dist/components/textarea/index.d.ts +13 -0
- package/dist/components/textarea/index.js +141 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/timeline/index.d.ts +8 -0
- package/dist/components/timeline/index.js +76 -0
- package/dist/components/timeline/index.js.map +1 -0
- package/dist/components/toast/img.json +8 -0
- package/dist/components/toast/index.d.ts +16 -0
- package/dist/components/toast/index.js +124 -0
- package/dist/components/toast/index.js.map +1 -0
- package/{lib/index.js → dist/index.d.ts} +0 -2
- package/dist/index.esm.js +6020 -8272
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6104 -8332
- package/dist/index.js.map +1 -1
- package/dist/style/components/grid.scss +2 -2
- package/dist/style/components/index.scss +48 -48
- package/dist/style/components/list.scss +2 -2
- package/dist/style/index.css +11754 -0
- package/dist/style/index.css.map +1 -0
- package/dist/style/mixins/index.scss +13 -13
- package/dist/style/mixins/libs/shade.scss +4 -2
- package/dist/style/mixins/libs/tint.scss +4 -2
- package/dist/style/variables/default.scss +1 -1
- package/package.json +56 -33
- 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/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/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/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/lib/common/component.js +0 -33
- package/lib/common/component.js.map +0 -1
- package/lib/common/utils.js +0 -226
- package/lib/common/utils.js.map +0 -1
- package/lib/components/accordion/index.js +0 -116
- package/lib/components/accordion/index.js.map +0 -1
- package/lib/components/action-sheet/body/index.js +0 -10
- package/lib/components/action-sheet/body/index.js.map +0 -1
- package/lib/components/action-sheet/body/item/index.js +0 -22
- package/lib/components/action-sheet/body/item/index.js.map +0 -1
- package/lib/components/action-sheet/footer/index.js +0 -22
- package/lib/components/action-sheet/footer/index.js.map +0 -1
- package/lib/components/action-sheet/header/index.js +0 -10
- package/lib/components/action-sheet/header/index.js.map +0 -1
- package/lib/components/action-sheet/index.js +0 -71
- package/lib/components/action-sheet/index.js.map +0 -1
- package/lib/components/activity-indicator/index.js +0 -35
- package/lib/components/activity-indicator/index.js.map +0 -1
- package/lib/components/avatar/index.js +0 -64
- package/lib/components/avatar/index.js.map +0 -1
- package/lib/components/badge/index.js +0 -42
- package/lib/components/badge/index.js.map +0 -1
- package/lib/components/button/index.js +0 -125
- package/lib/components/button/index.js.map +0 -1
- package/lib/components/calendar/body/index.js +0 -193
- package/lib/components/calendar/body/index.js.map +0 -1
- package/lib/components/calendar/common/constant.js +0 -4
- package/lib/components/calendar/common/constant.js.map +0 -1
- package/lib/components/calendar/common/helper.js +0 -83
- package/lib/components/calendar/common/helper.js.map +0 -1
- package/lib/components/calendar/common/plugins.js +0 -71
- package/lib/components/calendar/common/plugins.js.map +0 -1
- package/lib/components/calendar/controller/index.js +0 -30
- package/lib/components/calendar/controller/index.js.map +0 -1
- package/lib/components/calendar/index.js +0 -207
- package/lib/components/calendar/index.js.map +0 -1
- package/lib/components/calendar/ui/date-list/index.js +0 -43
- package/lib/components/calendar/ui/date-list/index.js.map +0 -1
- package/lib/components/calendar/ui/day-list/index.js +0 -16
- package/lib/components/calendar/ui/day-list/index.js.map +0 -1
- package/lib/components/card/index.js +0 -59
- package/lib/components/card/index.js.map +0 -1
- package/lib/components/checkbox/index.js +0 -55
- package/lib/components/checkbox/index.js.map +0 -1
- package/lib/components/countdown/index.js +0 -137
- package/lib/components/countdown/index.js.map +0 -1
- package/lib/components/countdown/item/index.js +0 -24
- package/lib/components/countdown/item/index.js.map +0 -1
- package/lib/components/curtain/index.js +0 -45
- package/lib/components/curtain/index.js.map +0 -1
- package/lib/components/divider/index.js +0 -40
- package/lib/components/divider/index.js.map +0 -1
- package/lib/components/drawer/index.js +0 -93
- package/lib/components/drawer/index.js.map +0 -1
- package/lib/components/fab/index.js +0 -26
- package/lib/components/fab/index.js.map +0 -1
- package/lib/components/flex/index.js +0 -38
- package/lib/components/flex/index.js.map +0 -1
- package/lib/components/flex/item/index.js +0 -31
- package/lib/components/flex/item/index.js.map +0 -1
- package/lib/components/float-layout/index.js +0 -76
- package/lib/components/float-layout/index.js.map +0 -1
- package/lib/components/form/index.js +0 -30
- package/lib/components/form/index.js.map +0 -1
- package/lib/components/grid/index.js +0 -71
- package/lib/components/grid/index.js.map +0 -1
- package/lib/components/icon/index.js +0 -37
- package/lib/components/icon/index.js.map +0 -1
- package/lib/components/image-picker/index.js +0 -138
- package/lib/components/image-picker/index.js.map +0 -1
- package/lib/components/indexes/index.js +0 -215
- package/lib/components/indexes/index.js.map +0 -1
- package/lib/components/input/index.js +0 -168
- package/lib/components/input/index.js.map +0 -1
- package/lib/components/input-number/index.js +0 -165
- package/lib/components/input-number/index.js.map +0 -1
- package/lib/components/list/index.js +0 -19
- package/lib/components/list/index.js.map +0 -1
- package/lib/components/list/item/index.js +0 -105
- package/lib/components/list/item/index.js.map +0 -1
- package/lib/components/load-more/index.js +0 -48
- package/lib/components/load-more/index.js.map +0 -1
- package/lib/components/loading/index.js +0 -32
- package/lib/components/loading/index.js.map +0 -1
- package/lib/components/message/index.js +0 -69
- package/lib/components/message/index.js.map +0 -1
- package/lib/components/modal/action/index.js +0 -20
- package/lib/components/modal/action/index.js.map +0 -1
- package/lib/components/modal/content/index.js +0 -10
- package/lib/components/modal/content/index.js.map +0 -1
- package/lib/components/modal/header/index.js +0 -10
- package/lib/components/modal/header/index.js.map +0 -1
- package/lib/components/modal/index.js +0 -97
- package/lib/components/modal/index.js.map +0 -1
- package/lib/components/nav-bar/index.js +0 -105
- package/lib/components/nav-bar/index.js.map +0 -1
- package/lib/components/noticebar/index.js +0 -163
- package/lib/components/noticebar/index.js.map +0 -1
- package/lib/components/pagination/index.js +0 -115
- package/lib/components/pagination/index.js.map +0 -1
- package/lib/components/progress/index.js +0 -45
- package/lib/components/progress/index.js.map +0 -1
- package/lib/components/radio/index.js +0 -43
- package/lib/components/radio/index.js.map +0 -1
- package/lib/components/range/index.js +0 -152
- package/lib/components/range/index.js.map +0 -1
- package/lib/components/rate/index.js +0 -56
- package/lib/components/rate/index.js.map +0 -1
- package/lib/components/search-bar/index.js +0 -121
- package/lib/components/search-bar/index.js.map +0 -1
- package/lib/components/segmented-control/index.js +0 -59
- package/lib/components/segmented-control/index.js.map +0 -1
- package/lib/components/slider/index.js +0 -77
- package/lib/components/slider/index.js.map +0 -1
- package/lib/components/steps/index.js +0 -50
- package/lib/components/steps/index.js.map +0 -1
- package/lib/components/swipe-action/index.js +0 -171
- package/lib/components/swipe-action/index.js.map +0 -1
- package/lib/components/swipe-action/options/index.js +0 -10
- package/lib/components/swipe-action/options/index.js.map +0 -1
- package/lib/components/switch/index.js +0 -48
- package/lib/components/switch/index.js.map +0 -1
- package/lib/components/tab-bar/index.js +0 -96
- package/lib/components/tab-bar/index.js.map +0 -1
- package/lib/components/tabs/index.js +0 -190
- package/lib/components/tabs/index.js.map +0 -1
- package/lib/components/tabs-pane/index.js +0 -30
- package/lib/components/tabs-pane/index.js.map +0 -1
- package/lib/components/tag/index.js +0 -55
- package/lib/components/tag/index.js.map +0 -1
- package/lib/components/textarea/index.js +0 -95
- package/lib/components/textarea/index.js.map +0 -1
- package/lib/components/timeline/index.js +0 -53
- package/lib/components/timeline/index.js.map +0 -1
- package/lib/components/toast/img.json +0 -5
- package/lib/components/toast/index.js +0 -117
- package/lib/components/toast/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- 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
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Text, View } from "@tarojs/components";
|
|
5
|
+
import Taro from "@tarojs/taro";
|
|
6
|
+
class AtNoticebar extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
const animElemId = `J_${Math.ceil(Math.random() * 1e6).toString(36)}`;
|
|
10
|
+
this.state = {
|
|
11
|
+
show: true,
|
|
12
|
+
animElemId,
|
|
13
|
+
animationData: {
|
|
14
|
+
actions: [{}]
|
|
15
|
+
},
|
|
16
|
+
dura: 0,
|
|
17
|
+
isWEAPP: Taro.getEnv() === Taro.ENV_TYPE.WEAPP,
|
|
18
|
+
isALIPAY: Taro.getEnv() === Taro.ENV_TYPE.ALIPAY,
|
|
19
|
+
isWEB: Taro.getEnv() === Taro.ENV_TYPE.WEB
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
onClose(event) {
|
|
23
|
+
this.setState({
|
|
24
|
+
show: false
|
|
25
|
+
});
|
|
26
|
+
this.props.onClose && this.props.onClose(event);
|
|
27
|
+
}
|
|
28
|
+
onGotoMore(event) {
|
|
29
|
+
this.props.onGotoMore && this.props.onGotoMore(event);
|
|
30
|
+
}
|
|
31
|
+
UNSAFE_componentWillReceiveProps() {
|
|
32
|
+
if (!this.timeout) {
|
|
33
|
+
this.interval && clearInterval(this.interval);
|
|
34
|
+
this.initAnimation();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
componentDidMount() {
|
|
38
|
+
if (!this.props.marquee) return;
|
|
39
|
+
this.initAnimation();
|
|
40
|
+
}
|
|
41
|
+
initAnimation() {
|
|
42
|
+
const { isWEAPP, isALIPAY } = this.state;
|
|
43
|
+
this.timeout = setTimeout(() => {
|
|
44
|
+
this.timeout = null;
|
|
45
|
+
if (this.state.isWEB) {
|
|
46
|
+
const { speed = 100 } = this.props;
|
|
47
|
+
const elem = document.querySelector(`.${this.state.animElemId}`);
|
|
48
|
+
if (!elem) return;
|
|
49
|
+
const width = elem.getBoundingClientRect().width;
|
|
50
|
+
const dura = width / +speed;
|
|
51
|
+
this.setState({ dura });
|
|
52
|
+
} else if (isWEAPP || isALIPAY) {
|
|
53
|
+
const query = Taro.createSelectorQuery();
|
|
54
|
+
query.select(`.${this.state.animElemId}`).boundingClientRect().exec((res) => {
|
|
55
|
+
const queryRes = res[0];
|
|
56
|
+
if (!queryRes) return;
|
|
57
|
+
const { width } = queryRes;
|
|
58
|
+
const { speed = 100 } = this.props;
|
|
59
|
+
const dura = width / +speed;
|
|
60
|
+
const animation = Taro.createAnimation({
|
|
61
|
+
duration: dura * 1e3,
|
|
62
|
+
timingFunction: "linear"
|
|
63
|
+
});
|
|
64
|
+
const resetAnimation = Taro.createAnimation({
|
|
65
|
+
duration: 0,
|
|
66
|
+
timingFunction: "linear"
|
|
67
|
+
});
|
|
68
|
+
const resetOpacityAnimation = Taro.createAnimation({
|
|
69
|
+
duration: 0,
|
|
70
|
+
timingFunction: "linear"
|
|
71
|
+
});
|
|
72
|
+
const animBody = () => {
|
|
73
|
+
resetOpacityAnimation.opacity(0).step();
|
|
74
|
+
this.setState({ animationData: resetOpacityAnimation.export() });
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
resetAnimation.translateX(0).step();
|
|
77
|
+
this.setState({ animationData: resetAnimation.export() });
|
|
78
|
+
}, 300);
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
resetOpacityAnimation.opacity(1).step();
|
|
81
|
+
this.setState({ animationData: resetOpacityAnimation.export() });
|
|
82
|
+
}, 600);
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
animation.translateX(-width).step();
|
|
85
|
+
this.setState({ animationData: animation.export() });
|
|
86
|
+
}, 900);
|
|
87
|
+
};
|
|
88
|
+
animBody();
|
|
89
|
+
this.interval = setInterval(animBody, dura * 1e3 + 1e3);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}, 1e3);
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
const {
|
|
96
|
+
single,
|
|
97
|
+
icon,
|
|
98
|
+
marquee,
|
|
99
|
+
customStyle,
|
|
100
|
+
className,
|
|
101
|
+
moreText = "\u67E5\u770B\u8BE6\u60C5"
|
|
102
|
+
} = this.props;
|
|
103
|
+
let { showMore, close } = this.props;
|
|
104
|
+
const { dura, show, animElemId, animationData, isWEAPP, isALIPAY } = this.state;
|
|
105
|
+
const rootClassName = ["at-noticebar"];
|
|
106
|
+
if (!single) showMore = false;
|
|
107
|
+
const style = {};
|
|
108
|
+
const innerClassName = ["at-noticebar__content-inner"];
|
|
109
|
+
if (marquee) {
|
|
110
|
+
close = false;
|
|
111
|
+
innerClassName.push(animElemId);
|
|
112
|
+
style["animation-delay"] = "3s";
|
|
113
|
+
if (dura > 0) {
|
|
114
|
+
style["animation-duration"] = `${dura}s`;
|
|
115
|
+
style["animation-delay"] = "1s";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const classObject = {
|
|
119
|
+
"at-noticebar--marquee": marquee,
|
|
120
|
+
"at-noticebar--weapp": marquee && (isWEAPP || isALIPAY),
|
|
121
|
+
"at-noticebar--single": !marquee && single
|
|
122
|
+
};
|
|
123
|
+
const iconClass = ["at-icon"];
|
|
124
|
+
if (icon) iconClass.push(`at-icon-${icon}`);
|
|
125
|
+
return show && /* @__PURE__ */ React.createElement(
|
|
126
|
+
View,
|
|
127
|
+
{
|
|
128
|
+
className: classNames(rootClassName, classObject, className),
|
|
129
|
+
style: customStyle
|
|
130
|
+
},
|
|
131
|
+
close && /* @__PURE__ */ React.createElement(
|
|
132
|
+
View,
|
|
133
|
+
{
|
|
134
|
+
className: "at-noticebar__close",
|
|
135
|
+
onClick: this.onClose.bind(this)
|
|
136
|
+
},
|
|
137
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-close" })
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-noticebar__content" }, icon && /* @__PURE__ */ React.createElement(View, { className: "at-noticebar__content-icon" }, /* @__PURE__ */ React.createElement(Text, { className: classNames(iconClass, iconClass) })), /* @__PURE__ */ React.createElement(View, { className: "at-noticebar__content-text" }, /* @__PURE__ */ React.createElement(
|
|
140
|
+
View,
|
|
141
|
+
{
|
|
142
|
+
id: animElemId,
|
|
143
|
+
animation: animationData,
|
|
144
|
+
className: classNames(innerClassName),
|
|
145
|
+
style
|
|
146
|
+
},
|
|
147
|
+
this.props.children
|
|
148
|
+
))),
|
|
149
|
+
showMore && /* @__PURE__ */ React.createElement(
|
|
150
|
+
View,
|
|
151
|
+
{
|
|
152
|
+
className: "at-noticebar__more",
|
|
153
|
+
onClick: this.onGotoMore.bind(this)
|
|
154
|
+
},
|
|
155
|
+
/* @__PURE__ */ React.createElement(Text, { className: "text" }, moreText),
|
|
156
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-noticebar__more-icon" }, /* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-chevron-right" }))
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
AtNoticebar.defaultProps = {
|
|
162
|
+
close: false,
|
|
163
|
+
single: false,
|
|
164
|
+
marquee: false,
|
|
165
|
+
speed: 100,
|
|
166
|
+
moreText: "\u67E5\u770B\u8BE6\u60C5",
|
|
167
|
+
showMore: false,
|
|
168
|
+
icon: "",
|
|
169
|
+
customStyle: {}
|
|
170
|
+
};
|
|
171
|
+
AtNoticebar.propTypes = {
|
|
172
|
+
close: PropTypes.bool,
|
|
173
|
+
single: PropTypes.bool,
|
|
174
|
+
marquee: PropTypes.bool,
|
|
175
|
+
speed: PropTypes.number,
|
|
176
|
+
moreText: PropTypes.string,
|
|
177
|
+
showMore: PropTypes.bool,
|
|
178
|
+
icon: PropTypes.string,
|
|
179
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
180
|
+
onClose: PropTypes.func,
|
|
181
|
+
onGotoMore: PropTypes.func
|
|
182
|
+
};
|
|
183
|
+
export {
|
|
184
|
+
AtNoticebar as default
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/noticebar/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport Taro from '@tarojs/taro'\nimport { AtNoticeBarProps, AtNoticeBarState } from '../../../types/noticebar'\n\nexport default class AtNoticebar extends React.Component<\n AtNoticeBarProps,\n AtNoticeBarState\n> {\n public static defaultProps: AtNoticeBarProps\n public static propTypes: InferProps<AtNoticeBarProps>\n\n private timeout: ReturnType<typeof setTimeout> | null\n private interval: ReturnType<typeof setInterval> | null\n\n public constructor(props: AtNoticeBarProps) {\n super(props)\n const animElemId = `J_${Math.ceil(Math.random() * 10e5).toString(36)}`\n this.state = {\n show: true,\n animElemId,\n animationData: {\n actions: [{}]\n },\n dura: 0,\n isWEAPP: Taro.getEnv() === Taro.ENV_TYPE.WEAPP,\n isALIPAY: Taro.getEnv() === Taro.ENV_TYPE.ALIPAY,\n isWEB: Taro.getEnv() === Taro.ENV_TYPE.WEB\n }\n }\n\n private onClose(event: CommonEvent): void {\n this.setState({\n show: false\n })\n this.props.onClose && this.props.onClose(event)\n }\n\n private onGotoMore(event: CommonEvent): void {\n this.props.onGotoMore && this.props.onGotoMore(event)\n }\n\n public UNSAFE_componentWillReceiveProps(): void {\n if (!this.timeout) {\n this.interval && clearInterval(this.interval)\n this.initAnimation()\n }\n }\n\n public componentDidMount(): void {\n if (!this.props.marquee) return\n this.initAnimation()\n }\n\n private initAnimation(): void {\n const { isWEAPP, isALIPAY } = this.state\n this.timeout = setTimeout(() => {\n this.timeout = null\n if (this.state.isWEB) {\n const { speed = 100 } = this.props\n const elem = document.querySelector(`.${this.state.animElemId}`)\n if (!elem) return\n const width = elem.getBoundingClientRect().width\n const dura = width / +speed\n this.setState({ dura })\n } else if (isWEAPP || isALIPAY) {\n const query = Taro.createSelectorQuery()\n query\n .select(`.${this.state.animElemId}`)\n .boundingClientRect()\n .exec(res => {\n const queryRes = res[0]\n if (!queryRes) return\n const { width } = queryRes\n const { speed = 100 } = this.props\n const dura = width / +speed\n const animation = Taro.createAnimation({\n duration: dura * 1000,\n timingFunction: 'linear'\n })\n const resetAnimation = Taro.createAnimation({\n duration: 0,\n timingFunction: 'linear'\n })\n const resetOpacityAnimation = Taro.createAnimation({\n duration: 0,\n timingFunction: 'linear'\n })\n const animBody = (): void => {\n resetOpacityAnimation.opacity(0).step()\n this.setState({ animationData: resetOpacityAnimation.export() })\n\n setTimeout(() => {\n resetAnimation.translateX(0).step()\n this.setState({ animationData: resetAnimation.export() })\n }, 300)\n\n setTimeout(() => {\n resetOpacityAnimation.opacity(1).step()\n this.setState({ animationData: resetOpacityAnimation.export() })\n }, 600)\n\n setTimeout(() => {\n animation.translateX(-width).step()\n this.setState({ animationData: animation.export() })\n }, 900)\n }\n animBody()\n this.interval = setInterval(animBody, dura * 1000 + 1000)\n })\n }\n }, 1000)\n }\n\n public render(): JSX.Element | boolean {\n const {\n single,\n icon,\n marquee,\n customStyle,\n className,\n moreText = '查看详情'\n } = this.props\n let { showMore, close } = this.props\n const { dura, show, animElemId, animationData, isWEAPP, isALIPAY } =\n this.state\n const rootClassName = ['at-noticebar']\n\n if (!single) showMore = false\n\n const style = {}\n const innerClassName = ['at-noticebar__content-inner']\n if (marquee) {\n close = false\n innerClassName.push(animElemId)\n style['animation-delay'] = '3s'\n\n if (dura > 0) {\n style['animation-duration'] = `${dura}s`\n style['animation-delay'] = '1s'\n }\n }\n\n const classObject = {\n 'at-noticebar--marquee': marquee,\n 'at-noticebar--weapp': marquee && (isWEAPP || isALIPAY),\n 'at-noticebar--single': !marquee && single\n }\n\n const iconClass = ['at-icon']\n if (icon) iconClass.push(`at-icon-${icon}`)\n\n return (\n show && (\n <View\n className={classNames(rootClassName, classObject, className)}\n style={customStyle}\n >\n {close && (\n <View\n className='at-noticebar__close'\n onClick={this.onClose.bind(this)}\n >\n <Text className='at-icon at-icon-close'></Text>\n </View>\n )}\n <View className='at-noticebar__content'>\n {icon && (\n <View className='at-noticebar__content-icon'>\n {/* start hack 百度小程序 */}\n <Text className={classNames(iconClass, iconClass)}></Text>\n </View>\n )}\n <View className='at-noticebar__content-text'>\n <View\n id={animElemId}\n animation={animationData}\n className={classNames(innerClassName)}\n style={style}\n >\n {this.props.children}\n </View>\n </View>\n </View>\n {showMore && (\n <View\n className='at-noticebar__more'\n onClick={this.onGotoMore.bind(this)}\n >\n <Text className='text'>{moreText}</Text>\n <View className='at-noticebar__more-icon'>\n <Text className='at-icon at-icon-chevron-right'></Text>\n </View>\n </View>\n )}\n </View>\n )\n )\n }\n}\n\nAtNoticebar.defaultProps = {\n close: false,\n single: false,\n marquee: false,\n speed: 100,\n moreText: '查看详情',\n showMore: false,\n icon: '',\n customStyle: {}\n}\n\nAtNoticebar.propTypes = {\n close: PropTypes.bool,\n single: PropTypes.bool,\n marquee: PropTypes.bool,\n speed: PropTypes.number,\n moreText: PropTypes.string,\n showMore: PropTypes.bool,\n icon: PropTypes.string,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n onClose: PropTypes.func,\n onGotoMore: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAE3B,OAAO,UAAU;AAGjB,MAAO,oBAAkC,MAAM,UAG7C;AAAA,EAOO,YAAY,OAAyB;AAC1C,UAAM,KAAK;AACX,UAAM,aAAa,KAAK,KAAK,KAAK,KAAK,OAAO,IAAI,GAAI,EAAE,SAAS,EAAE,CAAC;AACpE,SAAK,QAAQ;AAAA,MACX,MAAM;AAAA,MACN;AAAA,MACA,eAAe;AAAA,QACb,SAAS,CAAC,CAAC,CAAC;A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AAK,WAAU,UAAQ,QAAS;AAAA,QACjC,oCAAC,QAAK,WAAU,6BACd,oCAAC,QAAK,WAAU,iCAAgC,CAClD;AAAA,MACF;AAAA,IAEJ;AAAA,EAGN;AACF;AAEA,YAAY,eAAe;AAAA,EACzB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,aAAa,CAAC;AAChB;AAEA,YAAY,YAAY;AAAA,EACtB,OAAO,UAAU;AAAA,EACjB,QAAQ,UAAU;AAAA,EAClB,SAAS,UAAU;AAAA,EACnB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU;AAAA,EACpB,MAAM,UAAU;AAAA,EAChB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,SAAS,UAAU;AAAA,EACnB,YAAY,UAAU;AACxB;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtPaginationProps, AtPaginationState } from '../../../types/pagination';
|
|
4
|
+
export default class AtPagination extends React.Component<AtPaginationProps, AtPaginationState> {
|
|
5
|
+
static defaultProps: AtPaginationProps;
|
|
6
|
+
static propTypes: InferProps<AtPaginationProps>;
|
|
7
|
+
constructor(props: AtPaginationProps);
|
|
8
|
+
private onPrev;
|
|
9
|
+
private onNext;
|
|
10
|
+
UNSAFE_componentWillReceiveProps(props: AtPaginationProps): void;
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Text, View } from "@tarojs/components";
|
|
5
|
+
import AtButton from "../button/index";
|
|
6
|
+
const MIN_MAXPAGE = 1;
|
|
7
|
+
const getMaxPage = (maxPage = 0) => {
|
|
8
|
+
if (maxPage <= 0) return MIN_MAXPAGE;
|
|
9
|
+
return maxPage;
|
|
10
|
+
};
|
|
11
|
+
const createPickerRange = (max) => {
|
|
12
|
+
const range = new Array(max).fill(0).map((_val, index) => index + 1);
|
|
13
|
+
return range;
|
|
14
|
+
};
|
|
15
|
+
class AtPagination extends React.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
const { current, pageSize = 20, total } = this.props;
|
|
19
|
+
const maxPage = getMaxPage(Math.ceil(total / pageSize));
|
|
20
|
+
this.state = {
|
|
21
|
+
currentPage: current || 1,
|
|
22
|
+
maxPage,
|
|
23
|
+
pickerRange: createPickerRange(maxPage)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
onPrev() {
|
|
27
|
+
let { currentPage } = this.state;
|
|
28
|
+
const originCur = currentPage;
|
|
29
|
+
currentPage -= 1;
|
|
30
|
+
currentPage = Math.max(1, currentPage);
|
|
31
|
+
if (originCur === currentPage) return;
|
|
32
|
+
this.props.onPageChange && this.props.onPageChange({ type: "prev", current: currentPage });
|
|
33
|
+
this.setState({ currentPage });
|
|
34
|
+
}
|
|
35
|
+
onNext() {
|
|
36
|
+
let { currentPage } = this.state;
|
|
37
|
+
const originCur = currentPage;
|
|
38
|
+
const { maxPage } = this.state;
|
|
39
|
+
currentPage += 1;
|
|
40
|
+
currentPage = Math.min(maxPage, currentPage);
|
|
41
|
+
if (originCur === currentPage) return;
|
|
42
|
+
this.props.onPageChange && this.props.onPageChange({ type: "next", current: currentPage });
|
|
43
|
+
this.setState({ currentPage });
|
|
44
|
+
}
|
|
45
|
+
UNSAFE_componentWillReceiveProps(props) {
|
|
46
|
+
const { total, pageSize = 20, current } = props;
|
|
47
|
+
const maxPage = getMaxPage(Math.ceil(total / pageSize));
|
|
48
|
+
if (maxPage !== this.state.maxPage) {
|
|
49
|
+
this.setState({
|
|
50
|
+
maxPage,
|
|
51
|
+
pickerRange: createPickerRange(maxPage)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (typeof current === "number" && current !== this.state.currentPage) {
|
|
55
|
+
this.setState({ currentPage: current });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// onPickerChange (evt) {
|
|
59
|
+
// const { value } = evt.detail
|
|
60
|
+
// const current = +value + 1
|
|
61
|
+
// if (current === this.state.currentPage) return
|
|
62
|
+
// this.props.onPageChange && this.props.onPageChange({ type: 'pick', current })
|
|
63
|
+
// this.setState({
|
|
64
|
+
// currentPage: current,
|
|
65
|
+
// })
|
|
66
|
+
// }
|
|
67
|
+
render() {
|
|
68
|
+
const {
|
|
69
|
+
icon,
|
|
70
|
+
// pickerSelect,
|
|
71
|
+
customStyle
|
|
72
|
+
} = this.props;
|
|
73
|
+
const {
|
|
74
|
+
currentPage,
|
|
75
|
+
maxPage
|
|
76
|
+
// pickerRange,
|
|
77
|
+
} = this.state;
|
|
78
|
+
const rootClassName = ["at-pagination"];
|
|
79
|
+
const prevDisabled = maxPage === MIN_MAXPAGE || currentPage === 1;
|
|
80
|
+
const nextDisabled = maxPage === MIN_MAXPAGE || currentPage === maxPage;
|
|
81
|
+
const classObject = {
|
|
82
|
+
"at-pagination--icon": icon
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ React.createElement(
|
|
85
|
+
View,
|
|
86
|
+
{
|
|
87
|
+
className: classNames(rootClassName, classObject, this.props.className),
|
|
88
|
+
style: customStyle
|
|
89
|
+
},
|
|
90
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-pagination__btn-prev" }, icon && /* @__PURE__ */ React.createElement(
|
|
91
|
+
AtButton,
|
|
92
|
+
{
|
|
93
|
+
onClick: this.onPrev.bind(this),
|
|
94
|
+
size: "small",
|
|
95
|
+
disabled: prevDisabled
|
|
96
|
+
},
|
|
97
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-chevron-left" })
|
|
98
|
+
), !icon && /* @__PURE__ */ React.createElement(
|
|
99
|
+
AtButton,
|
|
100
|
+
{
|
|
101
|
+
onClick: this.onPrev.bind(this),
|
|
102
|
+
size: "small",
|
|
103
|
+
disabled: prevDisabled
|
|
104
|
+
},
|
|
105
|
+
"\u4E0A\u4E00\u9875"
|
|
106
|
+
)),
|
|
107
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-pagination__number" }, /* @__PURE__ */ React.createElement(Text, { className: "at-pagination__number-current" }, currentPage), "/", maxPage),
|
|
108
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-pagination__btn-next" }, icon && /* @__PURE__ */ React.createElement(
|
|
109
|
+
AtButton,
|
|
110
|
+
{
|
|
111
|
+
onClick: this.onNext.bind(this),
|
|
112
|
+
size: "small",
|
|
113
|
+
disabled: nextDisabled
|
|
114
|
+
},
|
|
115
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-chevron-right" })
|
|
116
|
+
), !icon && /* @__PURE__ */ React.createElement(
|
|
117
|
+
AtButton,
|
|
118
|
+
{
|
|
119
|
+
onClick: this.onNext.bind(this),
|
|
120
|
+
size: "small",
|
|
121
|
+
disabled: nextDisabled
|
|
122
|
+
},
|
|
123
|
+
"\u4E0B\u4E00\u9875"
|
|
124
|
+
))
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
AtPagination.defaultProps = {
|
|
129
|
+
current: 1,
|
|
130
|
+
total: 0,
|
|
131
|
+
pageSize: 20,
|
|
132
|
+
icon: false,
|
|
133
|
+
customStyle: {}
|
|
134
|
+
};
|
|
135
|
+
AtPagination.propTypes = {
|
|
136
|
+
current: PropTypes.number,
|
|
137
|
+
total: PropTypes.number,
|
|
138
|
+
pageSize: PropTypes.number,
|
|
139
|
+
icon: PropTypes.bool,
|
|
140
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
141
|
+
onPageChange: PropTypes.func
|
|
142
|
+
};
|
|
143
|
+
export {
|
|
144
|
+
AtPagination as default
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/pagination/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtPaginationProps, AtPaginationState } from '../../../types/pagination'\nimport AtButton from '../button/index'\n\nconst MIN_MAXPAGE = 1\nconst getMaxPage = (maxPage = 0): number => {\n if (maxPage <= 0) return MIN_MAXPAGE\n return maxPage\n}\n\nconst createPickerRange = (max: number): number[] => {\n const range = new Array(max).fill(0).map((_val, index) => index + 1)\n return range\n}\n\nexport default class AtPagination extends React.Component<\n AtPaginationProps,\n AtPaginationState\n> {\n public static defaultProps: AtPaginationProps\n public static propTypes: InferProps<AtPaginationProps>\n\n public constructor(props: AtPaginationProps) {\n super(props)\n const { current, pageSize = 20, total } = this.props\n const maxPage = getMaxPage(Math.ceil(total / pageSize))\n this.state = {\n currentPage: current || 1,\n maxPage,\n pickerRange: createPickerRange(maxPage)\n }\n }\n\n private onPrev(): void {\n let { currentPage } = this.state\n const originCur = currentPage\n currentPage -= 1\n currentPage = Math.max(1, currentPage)\n if (originCur === currentPage) return\n this.props.onPageChange &&\n this.props.onPageChange({ type: 'prev', current: currentPage })\n this.setState({ currentPage })\n }\n\n private onNext(): void {\n let { currentPage } = this.state\n const originCur = currentPage\n const { maxPage } = this.state\n currentPage += 1\n currentPage = Math.min(maxPage, currentPage)\n if (originCur === currentPage) return\n this.props.onPageChange &&\n this.props.onPageChange({ type: 'next', current: currentPage })\n this.setState({ currentPage })\n }\n\n public UNSAFE_componentWillReceiveProps(props: AtPaginationProps): void {\n const { total, pageSize = 20, current } = props\n const maxPage = getMaxPage(Math.ceil(total / pageSize))\n if (maxPage !== this.state.maxPage) {\n this.setState({\n maxPage,\n pickerRange: createPickerRange(maxPage)\n })\n }\n if (typeof current === 'number' && current !== this.state.currentPage) {\n this.setState({ currentPage: current })\n }\n }\n\n // onPickerChange (evt) {\n // const { value } = evt.detail\n // const current = +value + 1\n // if (current === this.state.currentPage) return\n // this.props.onPageChange && this.props.onPageChange({ type: 'pick', current })\n // this.setState({\n // currentPage: current,\n // })\n // }\n\n public render(): JSX.Element {\n const {\n icon,\n // pickerSelect,\n customStyle\n } = this.props\n const {\n currentPage,\n maxPage\n // pickerRange,\n } = this.state\n\n const rootClassName = ['at-pagination']\n\n const prevDisabled = maxPage === MIN_MAXPAGE || currentPage === 1\n const nextDisabled = maxPage === MIN_MAXPAGE || currentPage === maxPage\n\n const classObject = {\n 'at-pagination--icon': icon\n }\n\n return (\n <View\n className={classNames(rootClassName, classObject, this.props.className)}\n style={customStyle}\n >\n <View className='at-pagination__btn-prev'>\n {icon && (\n <AtButton\n onClick={this.onPrev.bind(this)}\n size='small'\n disabled={prevDisabled}\n >\n <Text className='at-icon at-icon-chevron-left'></Text>\n </AtButton>\n )}\n {!icon && (\n <AtButton\n onClick={this.onPrev.bind(this)}\n size='small'\n disabled={prevDisabled}\n >\n 上一页\n </AtButton>\n )}\n </View>\n <View className='at-pagination__number'>\n <Text className='at-pagination__number-current'>{currentPage}</Text>/\n {maxPage}\n </View>\n <View className='at-pagination__btn-next'>\n {icon && (\n <AtButton\n onClick={this.onNext.bind(this)}\n size='small'\n disabled={nextDisabled}\n >\n <Text className='at-icon at-icon-chevron-right'></Text>\n </AtButton>\n )}\n {!icon && (\n <AtButton\n onClick={this.onNext.bind(this)}\n size='small'\n disabled={nextDisabled}\n >\n 下一页\n </AtButton>\n )}\n </View>\n {/* {pickerSelect && <View className='at-pagination__number'>\n {<Picker mode='selector' range={pickerRange} value={currentPage - 1} onChange={this.onPickerChange.bind(this)}>\n <Text className='at-pagination__number-current'>{currentPage}</Text>/{ maxPage }\n </Picker>}\n </View>} */}\n {/* {!pickerSelect && <View className='at-pagination__number'>\n <Text className='at-pagination__number-current'>{currentPage}</Text>/{ maxPage }\n </View>} */}\n </View>\n )\n }\n}\n\nAtPagination.defaultProps = {\n current: 1,\n total: 0,\n pageSize: 20,\n icon: false,\n customStyle: {}\n}\n\nAtPagination.propTypes = {\n current: PropTypes.number,\n total: PropTypes.number,\n pageSize: PropTypes.number,\n icon: PropTypes.bool,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n onPageChange: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAE3B,OAAO,cAAc;AAErB,MAAM,cAAc;AACpB,MAAM,aAAa,CAAC,UAAU,MAAc;AAC1C,MAAI,WAAW,EAAG,QAAO;AACzB,SAAO;AACT;AAEA,MAAM,oBAAoB,CAAC,QAA0B;AACnD,QAAM,QAAQ,IAAI,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,UAAU,QAAQ,CAAC;AACnE,SAAO;AACT;AAEA,MAAO,qBAAmC,MAAM,UAG9C;AAAA,EAIO,YAAY,OAA0B;AAC3C,UAAM,KAAK;AACX,UAAM,EAAE,SAAS,WAAW,IAAI,MAAM,IAAI,KAAK;AAC/C,UAAM,UAAU,WAAW,KAAK,KAAK,QAAQ,QAAQ,CAAC;AACtD,SAAK,QAAQ;AAAA,MACX,aAAa,WAAW;AAAA,MACxB;AAAA,MACA,aAAa,kBAAkB,OAAO;AAAA,IACxC;AAAA,EACF;AAAA,EAEQ,SAAe;AACrB,QAAI,EAAE,YAAY,IAAI,KAAK;AAC3B,UAAM,YAAY;AAClB,mBAAe;AACf,kBAAc,KAAK,IAAI,GAAG,WAAW;AACrC,QAAI,cAAc,YAAa;AAC/B,SAAK,MAAM,gBACT,KAAK,MAAM,aAAa,EAAE,MAAM,QAAQ,SAAS,YAAY,CAAC;AAChE,SAAK,SAAS,EAAE,YAAY,CAAC;AAAA,EAC/B;AAAA,EAEQ,SAAe;AACrB,QAAI,EAAE,YAAY,IAAI,KAAK;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AAAA,UACL,UAAU;AAAA;AAAA,QAEV,oCAAC,QAAK,WAAU,gCAA+B;AAAA,MACjD,GAED,CAAC,QACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,UAC9B,MAAK;AAAA,UACL,UAAU;AAAA;AAAA,QACX;AAAA,MAED,CAEJ;AAAA,MACA,oCAAC,QAAK,WAAU,2BACd,oCAAC,QAAK,WAAU,mCAAiC,WAAY,GAAO,KACnE,OACH;AAAA,MACA,oCAAC,QAAK,WAAU,6BACb,QACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,UAC9B,MAAK;AAAA,UACL,UAAU;AAAA;AAAA,QAEV,oCAAC,QAAK,WAAU,iCAAgC;AAAA,MAClD,GAED,CAAC,QACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,UAC9B,MAAK;AAAA,UACL,UAAU;AAAA;AAAA,QACX;AAAA,MAED,CAEJ;AAAA,IASF;AAAA,EAEJ;AACF;AAEA,aAAa,eAAe;AAAA,EAC1B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,aAAa,CAAC;AAChB;AAEA,aAAa,YAAY;AAAA,EACvB,SAAS,UAAU;AAAA,EACnB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AAAA,EACpB,MAAM,UAAU;AAAA,EAChB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,cAAc,UAAU;AAC1B;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtProgressProps } from '../../../types/progress';
|
|
4
|
+
export default class AtProgress extends React.Component<AtProgressProps> {
|
|
5
|
+
static propTypes: InferProps<AtProgressProps>;
|
|
6
|
+
render(): JSX.Element;
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 AtProgress extends React.Component {
|
|
6
|
+
render() {
|
|
7
|
+
const { color } = this.props;
|
|
8
|
+
let { percent } = this.props;
|
|
9
|
+
const { strokeWidth, status, isHidePercent } = this.props;
|
|
10
|
+
if (typeof percent !== "number") {
|
|
11
|
+
percent = 0;
|
|
12
|
+
}
|
|
13
|
+
if (percent < 0) {
|
|
14
|
+
percent = 0;
|
|
15
|
+
} else if (percent > 100) {
|
|
16
|
+
percent = 100;
|
|
17
|
+
}
|
|
18
|
+
const rootClass = classNames(
|
|
19
|
+
"at-progress",
|
|
20
|
+
{
|
|
21
|
+
[`at-progress--${status}`]: !!status
|
|
22
|
+
},
|
|
23
|
+
this.props.className
|
|
24
|
+
);
|
|
25
|
+
const iconClass = classNames("at-icon", {
|
|
26
|
+
"at-icon-close-circle": status === "error",
|
|
27
|
+
"at-icon-check-circle": status === "success"
|
|
28
|
+
});
|
|
29
|
+
const progressStyle = {
|
|
30
|
+
width: percent && `${+percent}%`,
|
|
31
|
+
height: strokeWidth && `${+strokeWidth}px`,
|
|
32
|
+
backgroundColor: color
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootClass }, /* @__PURE__ */ React.createElement(View, { className: "at-progress__outer" }, /* @__PURE__ */ React.createElement(View, { className: "at-progress__outer-inner" }, /* @__PURE__ */ React.createElement(
|
|
35
|
+
View,
|
|
36
|
+
{
|
|
37
|
+
className: "at-progress__outer-inner-background",
|
|
38
|
+
style: progressStyle
|
|
39
|
+
}
|
|
40
|
+
))), !isHidePercent && /* @__PURE__ */ React.createElement(View, { className: "at-progress__content" }, !status || status === "progress" ? `${percent}%` : /* @__PURE__ */ React.createElement(Text, { className: iconClass })));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
AtProgress.propTypes = {
|
|
44
|
+
color: PropTypes.string,
|
|
45
|
+
status: PropTypes.string,
|
|
46
|
+
percent: PropTypes.number,
|
|
47
|
+
strokeWidth: PropTypes.number,
|
|
48
|
+
isHidePercent: PropTypes.bool
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
AtProgress as default
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/progress/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtProgressProps } from '../../../types/progress'\n\nexport default class AtProgress extends React.Component<AtProgressProps> {\n public static propTypes: InferProps<AtProgressProps>\n\n public render(): JSX.Element {\n const { color } = this.props\n let { percent } = this.props\n const { strokeWidth, status, isHidePercent } = this.props\n\n if (typeof percent !== 'number') {\n percent = 0\n }\n\n if (percent < 0) {\n percent = 0\n } else if (percent > 100) {\n percent = 100\n }\n\n const rootClass = classNames(\n 'at-progress',\n {\n [`at-progress--${status}`]: !!status\n },\n this.props.className\n )\n const iconClass = classNames('at-icon', {\n 'at-icon-close-circle': status === 'error',\n 'at-icon-check-circle': status === 'success'\n })\n\n const progressStyle = {\n width: percent && `${+percent}%`,\n height: strokeWidth && `${+strokeWidth}px`,\n backgroundColor: color\n }\n\n return (\n <View className={rootClass}>\n <View className='at-progress__outer'>\n <View className='at-progress__outer-inner'>\n <View\n className='at-progress__outer-inner-background'\n style={progressStyle}\n />\n </View>\n </View>\n\n {!isHidePercent && (\n <View className='at-progress__content'>\n {!status || status === 'progress' ? (\n `${percent}%`\n ) : (\n <Text className={iconClass}></Text>\n )}\n </View>\n )}\n </View>\n )\n }\n}\n\nAtProgress.propTypes = {\n color: PropTypes.string,\n status: PropTypes.string,\n percent: PropTypes.number,\n strokeWidth: PropTypes.number,\n isHidePercent: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UAAU;AAAA,EACvB,eAAe,UAAU;AAC3B;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtRadioProps } from '../../../types/radio';
|
|
4
|
+
export default class AtRadio extends React.Component<AtRadioProps<any>> {
|
|
5
|
+
static defaultProps: AtRadioProps<any>;
|
|
6
|
+
static propTypes: InferProps<AtRadioProps<any>>;
|
|
7
|
+
private handleClick;
|
|
8
|
+
render(): JSX.Element;
|
|
9
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 AtRadio extends React.Component {
|
|
6
|
+
handleClick(option, event) {
|
|
7
|
+
if (option.disabled) return;
|
|
8
|
+
this.props.onClick(option.value, event);
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
const { customStyle, className, options, value } = this.props;
|
|
12
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames("at-radio", className), style: customStyle }, options.map((option) => /* @__PURE__ */ React.createElement(
|
|
13
|
+
View,
|
|
14
|
+
{
|
|
15
|
+
key: option.value,
|
|
16
|
+
onClick: this.handleClick.bind(this, option),
|
|
17
|
+
className: classNames({
|
|
18
|
+
"at-radio__option": true,
|
|
19
|
+
"at-radio__option--disabled": option.disabled
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-radio__option-wrap" }, /* @__PURE__ */ React.createElement(View, { className: "at-radio__option-container" }, /* @__PURE__ */ React.createElement(View, { className: "at-radio__title" }, option.label), /* @__PURE__ */ React.createElement(
|
|
23
|
+
View,
|
|
24
|
+
{
|
|
25
|
+
className: classNames({
|
|
26
|
+
"at-radio__icon": true,
|
|
27
|
+
"at-radio__icon--checked": value === option.value
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-check" })
|
|
31
|
+
)), option.desc && /* @__PURE__ */ React.createElement(View, { className: "at-radio__desc" }, option.desc))
|
|
32
|
+
)));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
AtRadio.defaultProps = {
|
|
36
|
+
customStyle: "",
|
|
37
|
+
className: "",
|
|
38
|
+
value: "",
|
|
39
|
+
options: [],
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
41
|
+
onClick: () => {
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
AtRadio.propTypes = {
|
|
45
|
+
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
46
|
+
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
47
|
+
value: PropTypes.string,
|
|
48
|
+
options: PropTypes.array,
|
|
49
|
+
onClick: PropTypes.func
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
AtRadio as default
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtRadioProps, RadioOption } from '../../../types/radio'\n\nexport default class AtRadio extends React.Component<AtRadioProps<any>> {\n public static defaultProps: AtRadioProps<any>\n public static propTypes: InferProps<AtRadioProps<any>>\n\n private handleClick(option: RadioOption<any>, event: CommonEvent): void {\n if (option.disabled) return\n this.props.onClick(option.value, event)\n }\n\n public render(): JSX.Element {\n const { customStyle, className, options, value } = this.props\n\n return (\n <View className={classNames('at-radio', className)} style={customStyle}>\n {options.map(option => (\n <View\n key={option.value}\n onClick={this.handleClick.bind(this, option)}\n className={classNames({\n 'at-radio__option': true,\n 'at-radio__option--disabled': option.disabled\n })}\n >\n <View className='at-radio__option-wrap'>\n <View className='at-radio__option-container'>\n <View className='at-radio__title'>{option.label}</View>\n <View\n className={classNames({\n 'at-radio__icon': true,\n 'at-radio__icon--checked': value === option.value\n })}\n >\n <Text className='at-icon at-icon-check'></Text>\n </View>\n </View>\n {option.desc && (\n <View className='at-radio__desc'>{option.desc}</View>\n )}\n </View>\n </View>\n ))}\n </View>\n )\n }\n}\n\nAtRadio.defaultProps = {\n customStyle: '',\n className: '',\n value: '',\n options: [],\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClick: (): void => {}\n}\n\nAtRadio.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n value: PropTypes.string,\n options: PropTypes.array,\n onClick: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAI3B,MAAO,gBAA8B,MAAM,UAA6B;AAAA,EAI9D,YAAY,QAA0B,OAA0B;AACtE,QAAI,OAAO,SAAU;AACrB,SAAK,MAAM,QAAQ,OAAO,OAAO,KAAK;AAAA,EACxC;AAAA,EAEO,SAAsB;AAC3B,UAAM,EAAE,aAAa,WAAW,SAAS,MAAM,IAAI,KAAK;AAExD,WACE,oCAAC,QAAK,WAAW,WAAW,YAAY,SAAS,GAAG,OAAO,eACxD,QAAQ,IAAI,YACX;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,OAAO;AAAA,QACZ,SAAS,KAAK,YAAY,KAAK,MAAM,MAAM;AAAA,QAC3C,WAAW,WAAW;AAAA,UACpB,oBAAoB;AAAA,UACpB,8BAA8B,OAAO;AAAA,QACvC,CAAC;AAAA;AAAA,MAED,oCAAC,QAAK,WAAU,2BACd,oCAAC,QAAK,WAAU,gCACd,oCAAC,QAAK,WAAU,qBAAmB,OAAO,KAAM,GAChD;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,WAAW;AAAA,YACpB,kBAAkB;AAAA,YAClB,2BAA2B,UAAU,OAAO;AAAA,UAC9C,CAAC;AAAA;AAAA,QAED,oCAAC,QAAK,WAAU,yBAAwB;AAAA,MAC1C,CACF,GACC,OAAO,QACN,oCAAC,QAAK,WAAU,oBAAkB,OAAO,IAAK,CAElD;AAAA,IACF,CACD,CACH;AAAA,EAEJ;AACF;AAEA,QAAQ,eAAe;AAAA,EACrB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS,CAAC;AAAA;AAAA,EAEV,SAAS,MAAY;AAAA,EAAC;AACxB;AAEA,QAAQ,YAAY;AAAA,EAClB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,OAAO,UAAU;AAAA,EACjB,SAAS,UAAU;AAAA,EACnB,SAAS,UAAU;AACrB;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InferProps } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AtRangeProps, AtRangeState } from '../../../types/range';
|
|
4
|
+
export default class AtRange extends React.Component<AtRangeProps, AtRangeState> {
|
|
5
|
+
static defaultProps: AtRangeProps;
|
|
6
|
+
static propTypes: InferProps<AtRangeProps>;
|
|
7
|
+
private width;
|
|
8
|
+
private left;
|
|
9
|
+
private deltaValue;
|
|
10
|
+
private currentSlider;
|
|
11
|
+
constructor(props: AtRangeProps);
|
|
12
|
+
private handleClick;
|
|
13
|
+
private handleTouchMove;
|
|
14
|
+
private handleTouchEnd;
|
|
15
|
+
private setSliderValue;
|
|
16
|
+
private setValue;
|
|
17
|
+
private triggerEvent;
|
|
18
|
+
private updatePos;
|
|
19
|
+
UNSAFE_componentWillReceiveProps(nextProps: AtRangeProps): void;
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
render(): JSX.Element;
|
|
22
|
+
}
|