taro-ui 3.3.3 → 3.4.0
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 +1 -1
- package/README.md +85 -0
- package/dist/common/utils.d.ts +2 -1
- package/dist/common/utils.js +3 -0
- package/dist/common/utils.js.map +1 -1
- package/dist/components/accordion/index.d.ts +16 -13
- package/dist/components/accordion/index.js +77 -97
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-sheet/body/index.d.ts +2 -4
- package/dist/components/action-sheet/body/index.js +8 -6
- package/dist/components/action-sheet/body/index.js.map +1 -1
- package/dist/components/action-sheet/body/item/index.d.ts +7 -7
- package/dist/components/action-sheet/body/item/index.js +14 -14
- package/dist/components/action-sheet/body/item/index.js.map +1 -1
- package/dist/components/action-sheet/footer/index.d.ts +7 -7
- package/dist/components/action-sheet/footer/index.js +14 -17
- package/dist/components/action-sheet/footer/index.js.map +1 -1
- package/dist/components/action-sheet/header/index.d.ts +2 -4
- package/dist/components/action-sheet/header/index.js +8 -9
- package/dist/components/action-sheet/header/index.js.map +1 -1
- package/dist/components/action-sheet/index.d.ts +12 -13
- package/dist/components/action-sheet/index.js +53 -57
- package/dist/components/action-sheet/index.js.map +1 -1
- package/dist/components/activity-indicator/index.d.ts +12 -6
- package/dist/components/activity-indicator/index.js +19 -22
- package/dist/components/activity-indicator/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +14 -8
- package/dist/components/avatar/index.js +36 -43
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +11 -8
- package/dist/components/badge/index.js +18 -34
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/button/index.d.ts +29 -14
- package/dist/components/button/index.js +97 -112
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/body/index.d.ts +3 -26
- package/dist/components/calendar/body/index.js +215 -235
- package/dist/components/calendar/body/index.js.map +1 -1
- package/dist/components/calendar/controller/index.d.ts +3 -5
- package/dist/components/calendar/controller/index.js +47 -43
- package/dist/components/calendar/controller/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -20
- package/dist/components/calendar/index.js +219 -201
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar/ui/date-list/index.d.ts +2 -6
- package/dist/components/calendar/ui/date-list/index.js +36 -41
- package/dist/components/calendar/ui/date-list/index.js.map +1 -1
- package/dist/components/calendar/ui/day-list/index.d.ts +2 -4
- package/dist/components/calendar/ui/day-list/index.js +6 -5
- package/dist/components/calendar/ui/day-list/index.js.map +1 -1
- package/dist/components/card/index.d.ts +15 -7
- package/dist/components/card/index.js +42 -43
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +11 -7
- package/dist/components/checkbox/index.js +30 -35
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/config-provider/context.d.ts +6 -0
- package/dist/components/config-provider/context.js +13 -0
- package/dist/components/config-provider/context.js.map +1 -0
- package/dist/components/config-provider/index.d.ts +7 -0
- package/dist/components/config-provider/index.js +15 -0
- package/dist/components/config-provider/index.js.map +1 -0
- package/dist/components/countdown/index.d.ts +19 -19
- package/dist/components/countdown/index.js +183 -118
- package/dist/components/countdown/index.js.map +1 -1
- package/dist/components/countdown/item/index.d.ts +8 -7
- package/dist/components/countdown/item/index.js +10 -13
- package/dist/components/countdown/item/index.js.map +1 -1
- package/dist/components/curtain/index.d.ts +11 -8
- package/dist/components/curtain/index.js +36 -45
- package/dist/components/curtain/index.js.map +1 -1
- package/dist/components/divider/index.d.ts +13 -6
- package/dist/components/divider/index.js +29 -38
- package/dist/components/divider/index.js.map +1 -1
- package/dist/components/drawer/index.d.ts +13 -15
- package/dist/components/drawer/index.js +100 -93
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +8 -7
- package/dist/components/fab/index.js +16 -16
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/flex/index.d.ts +11 -5
- package/dist/components/flex/index.js +17 -18
- package/dist/components/flex/index.js.map +1 -1
- package/dist/components/flex/item/index.d.ts +11 -5
- package/dist/components/flex/item/index.js +17 -18
- package/dist/components/flex/item/index.js.map +1 -1
- package/dist/components/float-layout/index.d.ts +20 -12
- package/dist/components/float-layout/index.js +56 -72
- package/dist/components/float-layout/index.js.map +1 -1
- package/dist/components/form/index.d.ts +11 -8
- package/dist/components/form/index.js +28 -28
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/grid/index.d.ts +22 -7
- package/dist/components/grid/index.js +61 -66
- package/dist/components/grid/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +13 -7
- package/dist/components/icon/index.js +24 -34
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image-picker/index.d.ts +19 -9
- package/dist/components/image-picker/index.js +83 -102
- package/dist/components/image-picker/index.js.map +1 -1
- package/dist/components/indexes/index.d.ts +16 -28
- package/dist/components/indexes/index.js +198 -209
- package/dist/components/indexes/index.js.map +1 -1
- package/dist/components/input/index.d.ts +37 -15
- package/dist/components/input/index.js +152 -161
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input-number/index.d.ts +20 -11
- package/dist/components/input-number/index.js +107 -126
- package/dist/components/input-number/index.js.map +1 -1
- package/dist/components/list/index.d.ts +7 -6
- package/dist/components/list/index.js +15 -15
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list/item/index.d.ts +27 -9
- package/dist/components/list/item/index.js +89 -117
- package/dist/components/list/item/index.js.map +1 -1
- package/dist/components/load-more/index.d.ts +15 -7
- package/dist/components/load-more/index.js +29 -50
- package/dist/components/load-more/index.js.map +1 -1
- package/dist/components/loading/index.d.ts +8 -7
- package/dist/components/loading/index.js +14 -20
- package/dist/components/loading/index.js.map +1 -1
- package/dist/components/message/index.d.ts +9 -14
- package/dist/components/message/index.js +45 -59
- package/dist/components/message/index.js.map +1 -1
- package/dist/components/modal/action/index.d.ts +7 -6
- package/dist/components/modal/action/index.js +15 -15
- package/dist/components/modal/action/index.js.map +1 -1
- package/dist/components/modal/content/index.d.ts +2 -4
- package/dist/components/modal/content/index.js +8 -6
- package/dist/components/modal/content/index.js.map +1 -1
- package/dist/components/modal/header/index.d.ts +2 -4
- package/dist/components/modal/header/index.js +8 -6
- package/dist/components/modal/header/index.js.map +1 -1
- package/dist/components/modal/index.d.ts +16 -14
- package/dist/components/modal/index.js +63 -77
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/nav-bar/index.d.ts +20 -10
- package/dist/components/nav-bar/index.js +146 -162
- package/dist/components/nav-bar/index.js.map +1 -1
- package/dist/components/noticebar/index.d.ts +17 -15
- package/dist/components/noticebar/index.js +115 -128
- package/dist/components/noticebar/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +13 -11
- package/dist/components/pagination/index.js +64 -120
- package/dist/components/pagination/index.js.map +1 -1
- package/dist/components/progress/index.d.ts +11 -5
- package/dist/components/progress/index.js +39 -36
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/radio/index.d.ts +11 -7
- package/dist/components/radio/index.js +29 -33
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/range/index.d.ts +19 -21
- package/dist/components/range/index.js +146 -153
- package/dist/components/range/index.js.map +1 -1
- package/dist/components/rate/index.d.ts +13 -7
- package/dist/components/rate/index.js +47 -62
- package/dist/components/rate/index.js.map +1 -1
- package/dist/components/search-bar/index.d.ts +23 -15
- package/dist/components/search-bar/index.js +120 -146
- package/dist/components/search-bar/index.js.map +1 -1
- package/dist/components/segmented-control/index.d.ts +14 -7
- package/dist/components/segmented-control/index.js +52 -66
- package/dist/components/segmented-control/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +21 -12
- package/dist/components/slider/index.js +66 -90
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/steps/index.d.ts +11 -7
- package/dist/components/steps/index.js +43 -48
- package/dist/components/steps/index.js.map +1 -1
- package/dist/components/swipe-action/index.d.ts +12 -25
- package/dist/components/swipe-action/index.js +118 -115
- package/dist/components/swipe-action/index.js.map +1 -1
- package/dist/components/swipe-action/options/index.d.ts +2 -4
- package/dist/components/swipe-action/options/index.js +18 -17
- package/dist/components/swipe-action/options/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +14 -7
- package/dist/components/switch/index.js +36 -41
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tab-bar/index.d.ts +17 -7
- package/dist/components/tab-bar/index.js +108 -135
- package/dist/components/tab-bar/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +17 -23
- package/dist/components/tabs/index.js +185 -174
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs-pane/index.d.ts +11 -6
- package/dist/components/tabs-pane/index.js +26 -28
- package/dist/components/tabs-pane/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +14 -7
- package/dist/components/tag/index.js +31 -40
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/textarea/index.d.ts +29 -11
- package/dist/components/textarea/index.js +72 -92
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/timeline/index.d.ts +9 -6
- package/dist/components/timeline/index.js +50 -56
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/toast/img.json +3 -6
- package/dist/components/toast/index.d.ts +16 -15
- package/dist/components/toast/index.js +85 -94
- package/dist/components/toast/index.js.map +1 -1
- package/dist/hooks/useComponentLocale.d.ts +2 -0
- package/dist/hooks/useComponentLocale.js +12 -0
- package/dist/hooks/useComponentLocale.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +4006 -4404
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4032 -4434
- package/dist/index.js.map +1 -1
- package/dist/locale/en_US.d.ts +3 -0
- package/dist/locale/en_US.js +34 -0
- package/dist/locale/en_US.js.map +1 -0
- package/dist/locale/index.d.ts +4 -0
- package/dist/locale/index.js +10 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/types.d.ts +34 -0
- package/dist/locale/types.js +1 -0
- package/dist/locale/types.js.map +1 -0
- package/dist/locale/zh_CN.d.ts +3 -0
- package/dist/locale/zh_CN.js +34 -0
- package/dist/locale/zh_CN.js.map +1 -0
- package/dist/style/components/avatar.scss +1 -1
- package/dist/style/components/badge.scss +7 -2
- package/dist/style/components/calendar.scss +1 -1
- package/dist/style/components/countdown.scss +2 -1
- package/dist/style/components/flex.scss +1 -1
- package/dist/style/components/grid.scss +2 -2
- package/dist/style/components/icon.scss +302 -101
- package/dist/style/components/input.scss +2 -2
- package/dist/style/components/progress.scss +1 -1
- package/dist/style/components/search-bar.scss +1 -1
- package/dist/style/components/steps.scss +2 -2
- package/dist/style/components/tabs.scss +1 -1
- package/dist/style/components/tag.scss +1 -1
- package/dist/style/components/timeline.scss +1 -1
- package/dist/style/components/toast.scss +7 -3
- package/dist/style/index.css +176 -176
- package/dist/style/index.css.map +1 -1
- package/dist/style/mixins/libs/hairline.scss +4 -19
- package/dist/style/mixins/libs/shade.scss +3 -6
- package/dist/style/mixins/libs/tint.scss +4 -7
- package/dist/style/themes/purple.scss +15 -15
- package/dist/style/themes/red.scss +16 -13
- package/dist/style/variables/default.scss +69 -73
- package/package.json +5 -3
- package/rn/components/accordion/index.tsx +2 -9
- package/rn/components/action-sheet/body/index.tsx +1 -3
- package/rn/components/action-sheet/body/item/index.tsx +1 -3
- package/rn/components/action-sheet/footer/index.tsx +1 -3
- package/rn/components/action-sheet/header/index.tsx +1 -3
- package/rn/components/activity-indicator/index.tsx +1 -3
- package/rn/components/avatar/index.tsx +5 -5
- package/rn/components/calendar/controller/index.tsx +2 -7
- package/rn/components/card/index.tsx +4 -4
- package/rn/components/countdown/index.scss +5 -4
- package/rn/components/countdown/item/index.tsx +1 -3
- package/rn/components/curtain/index.tsx +5 -5
- package/rn/components/flex/index.scss +2 -2
- package/rn/components/flex/item/index.scss +2 -2
- package/rn/components/grid/index.tsx +15 -15
- package/rn/components/icon/index.tsx +4 -4
- package/rn/components/image-picker/index.tsx +7 -7
- package/rn/components/pagination/index.tsx +7 -7
- package/rn/components/progress/index.tsx +5 -5
- package/rn/components/radio/index.tsx +7 -7
- package/rn/components/rate/index.tsx +4 -4
- package/rn/components/segmented-control/index.tsx +8 -8
- package/rn/components/slider/index.tsx +9 -9
- package/rn/components/steps/index.tsx +8 -8
- package/rn/components/swipe-action/options/index.tsx +1 -3
- package/rn/components/switch/index.tsx +2 -9
- package/rn/components/toast/img.json +3 -6
- package/rn/components/toast/index.tsx +8 -8
- package/rn/style/components/accordion.scss +1 -1
- package/rn/style/components/action-sheet.scss +1 -1
- package/rn/style/components/avatar.scss +1 -1
- package/rn/style/components/badge.scss +8 -3
- package/rn/style/components/button.scss +1 -1
- package/rn/style/components/calendar.scss +1 -1
- package/rn/style/components/checkbox.scss +1 -1
- package/rn/style/components/curtain.scss +1 -1
- package/rn/style/components/fab.scss +1 -4
- package/rn/style/components/flex.scss +1 -1
- package/rn/style/components/grid.scss +2 -6
- package/rn/style/components/icon.scss +302 -101
- package/rn/style/components/index.scss +41 -41
- package/rn/style/components/input.scss +1 -1
- package/rn/style/components/list.scss +2 -4
- package/rn/style/components/loading.scss +4 -4
- package/rn/style/components/message.scss +1 -1
- package/rn/style/components/modal.scss +0 -2
- package/rn/style/components/nav-bar.scss +3 -3
- package/rn/style/components/noticebar.scss +0 -4
- package/rn/style/components/progress.scss +1 -1
- package/rn/style/components/radio.scss +2 -2
- package/rn/style/components/range.scss +1 -1
- package/rn/style/components/search-bar.scss +1 -1
- package/rn/style/components/segmented-control.scss +4 -1
- package/rn/style/components/slider.scss +0 -1
- package/rn/style/components/steps.scss +3 -3
- package/rn/style/components/switch.scss +0 -1
- package/rn/style/components/tabs.scss +2 -2
- package/rn/style/components/tag.scss +1 -1
- package/rn/style/components/timeline.scss +0 -2
- package/rn/style/components/toast.scss +5 -2
- package/rn/style/index.scss +1 -1
- package/rn/style/mixins/libs/hairline.scss +4 -22
- package/rn/style/mixins/libs/shade.scss +1 -4
- package/rn/style/mixins/libs/tint.scss +2 -5
- package/rn/style/themes/purple.scss +15 -15
- package/rn/style/themes/red.scss +16 -13
- package/rn/style/variables/default.scss +69 -73
|
@@ -2,72 +2,57 @@ import classNames from "classnames";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { View } from "@tarojs/components";
|
|
5
|
-
import { mergeStyle, pxTransform } from "../../common/utils";
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
)));
|
|
56
|
-
}
|
|
5
|
+
import { mergeStyle, noop, pxTransform } from "../../common/utils";
|
|
6
|
+
function AtSegmentedControl({
|
|
7
|
+
customStyle = "",
|
|
8
|
+
className = "",
|
|
9
|
+
disabled = false,
|
|
10
|
+
values = [],
|
|
11
|
+
selectedColor = "",
|
|
12
|
+
current = 0,
|
|
13
|
+
color = "",
|
|
14
|
+
fontSize = 28,
|
|
15
|
+
onClick = noop
|
|
16
|
+
}) {
|
|
17
|
+
const handleClick = (index, event) => {
|
|
18
|
+
if (disabled) return;
|
|
19
|
+
onClick(index, event);
|
|
20
|
+
};
|
|
21
|
+
const rootStyle = {
|
|
22
|
+
borderColor: selectedColor
|
|
23
|
+
};
|
|
24
|
+
const itemStyle = {
|
|
25
|
+
color: selectedColor,
|
|
26
|
+
fontSize: pxTransform(fontSize),
|
|
27
|
+
borderColor: selectedColor,
|
|
28
|
+
backgroundColor: color
|
|
29
|
+
};
|
|
30
|
+
const selectedItemStyle = {
|
|
31
|
+
color,
|
|
32
|
+
fontSize: pxTransform(fontSize),
|
|
33
|
+
borderColor: selectedColor,
|
|
34
|
+
backgroundColor: selectedColor
|
|
35
|
+
};
|
|
36
|
+
const rootCls = classNames(
|
|
37
|
+
"at-segmented-control",
|
|
38
|
+
{
|
|
39
|
+
"at-segmented-control--disabled": disabled
|
|
40
|
+
},
|
|
41
|
+
className
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootCls, style: mergeStyle(rootStyle, customStyle) }, values.map((value, i) => /* @__PURE__ */ React.createElement(
|
|
44
|
+
View,
|
|
45
|
+
{
|
|
46
|
+
className: classNames("at-segmented-control__item", {
|
|
47
|
+
"at-segmented-control__item--active": current === i
|
|
48
|
+
}),
|
|
49
|
+
style: current === i ? selectedItemStyle : itemStyle,
|
|
50
|
+
key: value,
|
|
51
|
+
onClick: (event) => handleClick(i, event)
|
|
52
|
+
},
|
|
53
|
+
value
|
|
54
|
+
)));
|
|
57
55
|
}
|
|
58
|
-
AtSegmentedControl.defaultProps = {
|
|
59
|
-
customStyle: "",
|
|
60
|
-
className: "",
|
|
61
|
-
current: 0,
|
|
62
|
-
color: "",
|
|
63
|
-
fontSize: 28,
|
|
64
|
-
disabled: false,
|
|
65
|
-
selectedColor: "",
|
|
66
|
-
values: [],
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
68
|
-
onClick: () => {
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
56
|
AtSegmentedControl.propTypes = {
|
|
72
57
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
73
58
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
@@ -78,7 +63,8 @@ AtSegmentedControl.propTypes = {
|
|
|
78
63
|
values: PropTypes.array,
|
|
79
64
|
onClick: PropTypes.func
|
|
80
65
|
};
|
|
66
|
+
var segmented_control_default = AtSegmentedControl;
|
|
81
67
|
export {
|
|
82
|
-
|
|
68
|
+
segmented_control_default as default
|
|
83
69
|
};
|
|
84
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/segmented-control/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/segmented-control/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtSegmentedControlProps } from '../../../types/segmented-control'\nimport { mergeStyle, noop, pxTransform } from '../../common/utils'\n\nfunction AtSegmentedControl({\n customStyle = '',\n className = '',\n disabled = false,\n values = [],\n selectedColor = '',\n current = 0,\n color = '',\n fontSize = 28,\n onClick = noop\n}: AtSegmentedControlProps): JSX.Element {\n const handleClick = (index: number, event: CommonEvent): void => {\n if (disabled) return\n onClick(index, event)\n }\n\n const rootStyle = {\n borderColor: selectedColor\n }\n const itemStyle = {\n color: selectedColor,\n fontSize: pxTransform(fontSize),\n borderColor: selectedColor,\n backgroundColor: color\n }\n const selectedItemStyle = {\n color,\n fontSize: pxTransform(fontSize),\n borderColor: selectedColor,\n backgroundColor: selectedColor\n }\n const rootCls = classNames(\n 'at-segmented-control',\n {\n 'at-segmented-control--disabled': disabled\n },\n className\n )\n\n return (\n <View className={rootCls} style={mergeStyle(rootStyle, customStyle)}>\n {values.map((value, i) => (\n <View\n className={classNames('at-segmented-control__item', {\n 'at-segmented-control__item--active': current === i\n })}\n style={current === i ? selectedItemStyle : itemStyle}\n key={value}\n onClick={event => handleClick(i, event)}\n >\n {value}\n </View>\n ))}\n </View>\n )\n}\n\nAtSegmentedControl.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n current: PropTypes.number,\n color: PropTypes.string,\n fontSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n values: PropTypes.array,\n onClick: PropTypes.func\n}\n\nexport default AtSegmentedControl\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,SAAS,YAAY,MAAM,mBAAmB;AAE9C,SAAS,mBAAmB;AAAA,EAC1B,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS,CAAC;AAAA,EACV,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AACZ,GAAyC;AACvC,QAAM,cAAc,CAAC,OAAe,UAA6B;AAC/D,QAAI,SAAU;AACd,YAAQ,OAAO,KAAK;AAAA,EACtB;AAEA,QAAM,YAAY;AAAA,IAChB,aAAa;AAAA,EACf;AACA,QAAM,YAAY;AAAA,IAChB,OAAO;AAAA,IACP,UAAU,YAAY,QAAQ;AAAA,IAC9B,aAAa;AAAA,IACb,iBAAiB;AAAA,EACnB;AACA,QAAM,oBAAoB;AAAA,IACxB;AAAA,IACA,UAAU,YAAY,QAAQ;AAAA,IAC9B,aAAa;AAAA,IACb,iBAAiB;AAAA,EACnB;AACA,QAAM,UAAU;AAAA,IACd;AAAA,IACA;AAAA,MACE,kCAAkC;AAAA,IACpC;AAAA,IACA;AAAA,EACF;AAEA,SACE,oCAAC,QAAK,WAAW,SAAS,OAAO,WAAW,WAAW,WAAW,KAC/D,OAAO,IAAI,CAAC,OAAO,MAClB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,WAAW,8BAA8B;AAAA,QAClD,sCAAsC,YAAY;AAAA,MACpD,CAAC;AAAA,MACD,OAAO,YAAY,IAAI,oBAAoB;AAAA,MAC3C,KAAK;AAAA,MACL,SAAS,WAAS,YAAY,GAAG,KAAK;AAAA;AAAA,IAErC;AAAA,EACH,CACD,CACH;AAEJ;AAEA,mBAAmB,YAAY;AAAA,EAC7B,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,SAAS,UAAU;AAAA,EACnB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EAClE,UAAU,UAAU;AAAA,EACpB,QAAQ,UAAU;AAAA,EAClB,SAAS,UAAU;AACrB;AAEA,IAAO,4BAAQ;","names":[]}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { AtSliderProps } from '../../../types/slider';
|
|
3
|
+
declare function AtSlider({ customStyle, className, min, max, step, value, disabled, activeColor, backgroundColor, blockSize, blockColor, showValue, onChange, onChanging }: AtSliderProps): JSX.Element;
|
|
4
|
+
declare namespace AtSlider {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
7
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
8
|
+
min: PropTypes.Requireable<number>;
|
|
9
|
+
max: PropTypes.Requireable<number>;
|
|
10
|
+
step: PropTypes.Requireable<number>;
|
|
11
|
+
value: PropTypes.Requireable<number>;
|
|
12
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
13
|
+
activeColor: PropTypes.Requireable<string>;
|
|
14
|
+
backgroundColor: PropTypes.Requireable<string>;
|
|
15
|
+
blockSize: PropTypes.Requireable<number>;
|
|
16
|
+
blockColor: PropTypes.Requireable<string>;
|
|
17
|
+
showValue: PropTypes.Requireable<boolean>;
|
|
18
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
onChanging: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
};
|
|
13
21
|
}
|
|
22
|
+
export default AtSlider;
|
|
@@ -1,98 +1,73 @@
|
|
|
1
1
|
import classNames from "classnames";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
4
4
|
import { Slider, View } from "@tarojs/components";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
function clampNumber(value, lower, upper) {
|
|
6
|
+
return Math.max(lower, Math.min(upper, value));
|
|
7
|
+
}
|
|
8
|
+
function AtSlider({
|
|
9
|
+
customStyle = "",
|
|
10
|
+
className = "",
|
|
11
|
+
min = 0,
|
|
12
|
+
max = 100,
|
|
13
|
+
step = 1,
|
|
14
|
+
value = 0,
|
|
15
|
+
disabled = false,
|
|
16
|
+
activeColor = "#6190e8",
|
|
17
|
+
backgroundColor = "#e9e9e9",
|
|
18
|
+
blockSize = 28,
|
|
19
|
+
blockColor = "#ffffff",
|
|
20
|
+
showValue = false,
|
|
21
|
+
onChange,
|
|
22
|
+
onChanging
|
|
23
|
+
}) {
|
|
24
|
+
const [_value, setValue] = useState(() => clampNumber(value, min, max));
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setValue(clampNumber(value, min, max));
|
|
27
|
+
}, [value, min, max]);
|
|
28
|
+
const handleChanging = (e) => {
|
|
29
|
+
const { value: detailValue } = e.detail;
|
|
30
|
+
if (detailValue !== _value) {
|
|
31
|
+
setValue(detailValue);
|
|
21
32
|
}
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
handleChange(e) {
|
|
25
|
-
const { value } = e.detail;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
const { _value } = this.state;
|
|
37
|
-
const {
|
|
38
|
-
customStyle,
|
|
39
|
-
className,
|
|
40
|
-
min,
|
|
41
|
-
max,
|
|
42
|
-
step,
|
|
43
|
-
disabled,
|
|
44
|
-
activeColor,
|
|
45
|
-
backgroundColor,
|
|
46
|
-
blockSize,
|
|
47
|
-
blockColor,
|
|
48
|
-
showValue
|
|
49
|
-
} = this.props;
|
|
50
|
-
return /* @__PURE__ */ React.createElement(
|
|
51
|
-
View,
|
|
52
|
-
{
|
|
53
|
-
className: classNames(
|
|
54
|
-
{
|
|
55
|
-
"at-slider": true,
|
|
56
|
-
"at-slider--disabled": disabled
|
|
57
|
-
},
|
|
58
|
-
className
|
|
59
|
-
),
|
|
60
|
-
style: customStyle
|
|
61
|
-
},
|
|
62
|
-
/* @__PURE__ */ React.createElement(View, { className: "at-slider__inner" }, /* @__PURE__ */ React.createElement(
|
|
63
|
-
Slider,
|
|
33
|
+
onChanging && onChanging(detailValue);
|
|
34
|
+
};
|
|
35
|
+
const handleChange = (e) => {
|
|
36
|
+
const { value: detailValue } = e.detail;
|
|
37
|
+
setValue(detailValue);
|
|
38
|
+
onChange && onChange(detailValue);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ React.createElement(
|
|
41
|
+
View,
|
|
42
|
+
{
|
|
43
|
+
className: classNames(
|
|
64
44
|
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
45
|
+
"at-slider": true,
|
|
46
|
+
"at-slider--disabled": disabled
|
|
47
|
+
},
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
style: customStyle
|
|
51
|
+
},
|
|
52
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-slider__inner" }, /* @__PURE__ */ React.createElement(
|
|
53
|
+
Slider,
|
|
54
|
+
{
|
|
55
|
+
min,
|
|
56
|
+
max,
|
|
57
|
+
step,
|
|
58
|
+
value: _value,
|
|
59
|
+
disabled,
|
|
60
|
+
activeColor,
|
|
61
|
+
backgroundColor,
|
|
62
|
+
blockSize,
|
|
63
|
+
blockColor,
|
|
64
|
+
onChanging: handleChanging,
|
|
65
|
+
onChange: handleChange
|
|
66
|
+
}
|
|
67
|
+
)),
|
|
68
|
+
showValue && /* @__PURE__ */ React.createElement(View, { className: "at-slider__text" }, `${_value}`)
|
|
69
|
+
);
|
|
81
70
|
}
|
|
82
|
-
AtSlider.defaultProps = {
|
|
83
|
-
customStyle: "",
|
|
84
|
-
className: "",
|
|
85
|
-
min: 0,
|
|
86
|
-
max: 100,
|
|
87
|
-
step: 1,
|
|
88
|
-
value: 0,
|
|
89
|
-
disabled: false,
|
|
90
|
-
activeColor: "#6190e8",
|
|
91
|
-
backgroundColor: "#e9e9e9",
|
|
92
|
-
blockSize: 28,
|
|
93
|
-
blockColor: "#ffffff",
|
|
94
|
-
showValue: false
|
|
95
|
-
};
|
|
96
71
|
AtSlider.propTypes = {
|
|
97
72
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
98
73
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
@@ -109,7 +84,8 @@ AtSlider.propTypes = {
|
|
|
109
84
|
onChange: PropTypes.func,
|
|
110
85
|
onChanging: PropTypes.func
|
|
111
86
|
};
|
|
87
|
+
var slider_default = AtSlider;
|
|
112
88
|
export {
|
|
113
|
-
|
|
89
|
+
slider_default as default
|
|
114
90
|
};
|
|
115
91
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/slider/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/slider/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React, { useEffect, useState } from 'react'\nimport { Slider, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtSliderProps } from '../../../types/slider'\n\nfunction clampNumber(value: number, lower: number, upper: number): number {\n return Math.max(lower, Math.min(upper, value))\n}\n\nfunction AtSlider({\n customStyle = '',\n className = '',\n min = 0,\n max = 100,\n step = 1,\n value = 0,\n disabled = false,\n activeColor = '#6190e8',\n backgroundColor = '#e9e9e9',\n blockSize = 28,\n blockColor = '#ffffff',\n showValue = false,\n onChange,\n onChanging\n}: AtSliderProps): JSX.Element {\n const [_value, setValue] = useState(() => clampNumber(value, min, max))\n\n useEffect(() => {\n setValue(clampNumber(value, min, max))\n }, [value, min, max])\n\n const handleChanging = (e: CommonEvent): void => {\n const { value: detailValue }: { value: number } = e.detail\n\n if (detailValue !== _value) {\n setValue(detailValue)\n }\n onChanging && onChanging(detailValue)\n }\n\n const handleChange = (e: CommonEvent): void => {\n const { value: detailValue } = e.detail\n\n setValue(detailValue)\n onChange && onChange(detailValue)\n }\n\n return (\n <View\n className={classNames(\n {\n 'at-slider': true,\n 'at-slider--disabled': disabled\n },\n className\n )}\n style={customStyle}\n >\n <View className='at-slider__inner'>\n <Slider\n min={min}\n max={max}\n step={step}\n value={_value}\n disabled={disabled}\n activeColor={activeColor}\n backgroundColor={backgroundColor}\n blockSize={blockSize}\n blockColor={blockColor}\n onChanging={handleChanging}\n onChange={handleChange}\n ></Slider>\n </View>\n {showValue && <View className='at-slider__text'>{`${_value}`}</View>}\n </View>\n )\n}\n\nAtSlider.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n min: PropTypes.number,\n max: PropTypes.number,\n step: PropTypes.number,\n value: PropTypes.number,\n disabled: PropTypes.bool,\n activeColor: PropTypes.string,\n backgroundColor: PropTypes.string,\n blockSize: PropTypes.number,\n blockColor: PropTypes.string,\n showValue: PropTypes.bool,\n onChange: PropTypes.func,\n onChanging: PropTypes.func\n}\n\nexport default AtSlider\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,gBAAgB;AAC3C,SAAS,QAAQ,YAAY;AAI7B,SAAS,YAAY,OAAe,OAAe,OAAuB;AACxE,SAAO,KAAK,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC;AAC/C;AAEA,SAAS,SAAS;AAAA,EAChB,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ;AAAA,EACA;AACF,GAA+B;AAC7B,QAAM,CAAC,QAAQ,QAAQ,IAAI,SAAS,MAAM,YAAY,OAAO,KAAK,GAAG,CAAC;AAEtE,YAAU,MAAM;AACd,aAAS,YAAY,OAAO,KAAK,GAAG,CAAC;AAAA,EACvC,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC;AAEpB,QAAM,iBAAiB,CAAC,MAAyB;AAC/C,UAAM,EAAE,OAAO,YAAY,IAAuB,EAAE;AAEpD,QAAI,gBAAgB,QAAQ;AAC1B,eAAS,WAAW;AAAA,IACtB;AACA,kBAAc,WAAW,WAAW;AAAA,EACtC;AAEA,QAAM,eAAe,CAAC,MAAyB;AAC7C,UAAM,EAAE,OAAO,YAAY,IAAI,EAAE;AAEjC,aAAS,WAAW;AACpB,gBAAY,SAAS,WAAW;AAAA,EAClC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,UACE,aAAa;AAAA,UACb,uBAAuB;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO;AAAA;AAAA,IAEP,oCAAC,QAAK,WAAU,sBACd;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,UAAU;AAAA;AAAA,IACX,CACH;AAAA,IACC,aAAa,oCAAC,QAAK,WAAU,qBAAmB,GAAG,MAAM,EAAG;AAAA,EAC/D;AAEJ;AAEA,SAAS,YAAY;AAAA,EACnB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,KAAK,UAAU;AAAA,EACf,KAAK,UAAU;AAAA,EACf,MAAM,UAAU;AAAA,EAChB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AAAA,EACpB,aAAa,UAAU;AAAA,EACvB,iBAAiB,UAAU;AAAA,EAC3B,WAAW,UAAU;AAAA,EACrB,YAAY,UAAU;AAAA,EACtB,WAAW,UAAU;AAAA,EACrB,UAAU,UAAU;AAAA,EACpB,YAAY,UAAU;AACxB;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtStepsProps } from '../../../types/steps';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
declare function AtSteps({ customStyle, className, current, items, onChange }: AtStepsProps): JSX.Element;
|
|
4
|
+
declare namespace AtSteps {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
7
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
8
|
+
current: PropTypes.Requireable<number>;
|
|
9
|
+
items: PropTypes.Requireable<any[]>;
|
|
10
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
9
12
|
}
|
|
13
|
+
export default AtSteps;
|
|
@@ -2,58 +2,53 @@ import classNames from "classnames";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Text, View } from "@tarojs/components";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { noop } from "../../common/utils";
|
|
6
|
+
function AtSteps({
|
|
7
|
+
customStyle = "",
|
|
8
|
+
className = "",
|
|
9
|
+
current = 0,
|
|
10
|
+
items = [],
|
|
11
|
+
onChange = noop
|
|
12
|
+
}) {
|
|
13
|
+
const handleClick = (stepCurrent, event) => {
|
|
14
|
+
onChange(stepCurrent, event);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames("at-steps", className), style: customStyle }, !!items && items.map((item, i) => /* @__PURE__ */ React.createElement(
|
|
17
|
+
View,
|
|
18
|
+
{
|
|
19
|
+
key: item.title,
|
|
20
|
+
className: classNames({
|
|
21
|
+
"at-steps__item": true,
|
|
22
|
+
"at-steps__item--active": i === current,
|
|
23
|
+
"at-steps__item--inactive": i !== current
|
|
24
|
+
}),
|
|
25
|
+
onClick: (event) => handleClick(i, event)
|
|
26
|
+
},
|
|
27
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-steps__circular-wrap" }, i !== 0 && /* @__PURE__ */ React.createElement(View, { className: "at-steps__left-line" }), item.status ? /* @__PURE__ */ React.createElement(
|
|
12
28
|
View,
|
|
13
29
|
{
|
|
14
|
-
key: item.title,
|
|
15
30
|
className: classNames({
|
|
16
|
-
"at-
|
|
17
|
-
"at-
|
|
18
|
-
"at-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
className: classNames("at-icon", {
|
|
38
|
-
[`at-icon-${item.icon.value}`]: item.icon.value,
|
|
39
|
-
"at-steps__circle-icon": true
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
) : /* @__PURE__ */ React.createElement(Text, { className: "at-steps__num" }, i + 1)), i !== items.length - 1 && /* @__PURE__ */ React.createElement(View, { className: "at-steps__right-line" })),
|
|
43
|
-
/* @__PURE__ */ React.createElement(View, { className: "at-steps__title" }, item.title),
|
|
44
|
-
/* @__PURE__ */ React.createElement(View, { className: "at-steps__desc" }, item.desc)
|
|
45
|
-
)));
|
|
46
|
-
}
|
|
31
|
+
"at-icon": true,
|
|
32
|
+
"at-icon-check-circle": item.status === "success",
|
|
33
|
+
"at-icon-close-circle": item.status === "error",
|
|
34
|
+
"at-steps__single-icon": true,
|
|
35
|
+
"at-steps__single-icon--success": item.status === "success",
|
|
36
|
+
"at-steps__single-icon--error": item.status === "error"
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
) : /* @__PURE__ */ React.createElement(View, { className: "at-steps__circular" }, item.icon ? /* @__PURE__ */ React.createElement(
|
|
40
|
+
Text,
|
|
41
|
+
{
|
|
42
|
+
className: classNames("at-icon", {
|
|
43
|
+
[`at-icon-${item.icon.value}`]: item.icon.value,
|
|
44
|
+
"at-steps__circle-icon": true
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
) : /* @__PURE__ */ React.createElement(Text, { className: "at-steps__num" }, i + 1)), i !== items.length - 1 && /* @__PURE__ */ React.createElement(View, { className: "at-steps__right-line" })),
|
|
48
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-steps__title" }, item.title),
|
|
49
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-steps__desc" }, item.desc)
|
|
50
|
+
)));
|
|
47
51
|
}
|
|
48
|
-
AtSteps.defaultProps = {
|
|
49
|
-
customStyle: "",
|
|
50
|
-
className: "",
|
|
51
|
-
current: 0,
|
|
52
|
-
items: [],
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
54
|
-
onChange: () => {
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
52
|
AtSteps.propTypes = {
|
|
58
53
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
59
54
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/steps/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/steps/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtStepsProps } from '../../../types/steps'\nimport { noop } from '../../common/utils'\n\nexport default function AtSteps({\n customStyle = '',\n className = '',\n current = 0,\n items = [],\n onChange = noop\n}: AtStepsProps): JSX.Element {\n const handleClick = (stepCurrent: number, event: CommonEvent): void => {\n onChange(stepCurrent, event)\n }\n\n return (\n <View className={classNames('at-steps', className)} style={customStyle}>\n {!!items &&\n items.map((item, i) => (\n <View\n key={item.title}\n className={classNames({\n 'at-steps__item': true,\n 'at-steps__item--active': i === current,\n 'at-steps__item--inactive': i !== current\n })}\n onClick={event => handleClick(i, event)}\n >\n <View className='at-steps__circular-wrap'>\n {i !== 0 && <View className='at-steps__left-line'></View>}\n {item.status ? (\n <View\n className={classNames({\n 'at-icon': true,\n 'at-icon-check-circle': item.status === 'success',\n 'at-icon-close-circle': item.status === 'error',\n 'at-steps__single-icon': true,\n 'at-steps__single-icon--success': item.status === 'success',\n 'at-steps__single-icon--error': item.status === 'error'\n })}\n ></View>\n ) : (\n <View className='at-steps__circular'>\n {item.icon ? (\n <Text\n className={classNames('at-icon', {\n [`at-icon-${item.icon.value}`]: item.icon.value,\n 'at-steps__circle-icon': true\n })}\n ></Text>\n ) : (\n <Text className='at-steps__num'>{i + 1}</Text>\n )}\n </View>\n )}\n {i !== items.length - 1 && (\n <View className='at-steps__right-line'></View>\n )}\n </View>\n <View className='at-steps__title'>{item.title}</View>\n <View className='at-steps__desc'>{item.desc}</View>\n </View>\n ))}\n </View>\n )\n}\n\nAtSteps.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n current: PropTypes.number,\n items: PropTypes.array,\n onChange: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAG3B,SAAS,YAAY;AAEN,SAAR,QAAyB;AAAA,EAC9B,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ,CAAC;AAAA,EACT,WAAW;AACb,GAA8B;AAC5B,QAAM,cAAc,CAAC,aAAqB,UAA6B;AACrE,aAAS,aAAa,KAAK;AAAA,EAC7B;AAEA,SACE,oCAAC,QAAK,WAAW,WAAW,YAAY,SAAS,GAAG,OAAO,eACxD,CAAC,CAAC,SACD,MAAM,IAAI,CAAC,MAAM,MACf;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,KAAK;AAAA,MACV,WAAW,WAAW;AAAA,QACpB,kBAAkB;AAAA,QAClB,0BAA0B,MAAM;AAAA,QAChC,4BAA4B,MAAM;AAAA,MACpC,CAAC;AAAA,MACD,SAAS,WAAS,YAAY,GAAG,KAAK;AAAA;AAAA,IAEtC,oCAAC,QAAK,WAAU,6BACb,MAAM,KAAK,oCAAC,QAAK,WAAU,uBAAsB,GACjD,KAAK,SACJ;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,WAAW;AAAA,UACpB,WAAW;AAAA,UACX,wBAAwB,KAAK,WAAW;AAAA,UACxC,wBAAwB,KAAK,WAAW;AAAA,UACxC,yBAAyB;AAAA,UACzB,kCAAkC,KAAK,WAAW;AAAA,UAClD,gCAAgC,KAAK,WAAW;AAAA,QAClD,CAAC;AAAA;AAAA,IACF,IAED,oCAAC,QAAK,WAAU,wBACb,KAAK,OACJ;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,WAAW,WAAW;AAAA,UAC/B,CAAC,WAAW,KAAK,KAAK,KAAK,EAAE,GAAG,KAAK,KAAK;AAAA,UAC1C,yBAAyB;AAAA,QAC3B,CAAC;AAAA;AAAA,IACF,IAED,oCAAC,QAAK,WAAU,mBAAiB,IAAI,CAAE,CAE3C,GAED,MAAM,MAAM,SAAS,KACpB,oCAAC,QAAK,WAAU,wBAAuB,CAE3C;AAAA,IACA,oCAAC,QAAK,WAAU,qBAAmB,KAAK,KAAM;AAAA,IAC9C,oCAAC,QAAK,WAAU,oBAAkB,KAAK,IAAK;AAAA,EAC9C,CACD,CACL;AAEJ;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,SAAS,UAAU;AAAA,EACnB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AACtB;","names":[]}
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import { InferProps } from 'prop-types';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { CommonEvent } from '@tarojs/components/types/common';
|
|
3
3
|
import { AtSwipeActionProps, AtSwipeActionState } from '../../../types/swipe-action';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
private getAreaWidth;
|
|
16
|
-
/**
|
|
17
|
-
* 获取最大偏移量
|
|
18
|
-
*/
|
|
19
|
-
private getMaxOffsetSize;
|
|
20
|
-
private _reset;
|
|
21
|
-
private handleOpened;
|
|
22
|
-
private handleClosed;
|
|
23
|
-
private handleClick;
|
|
24
|
-
onTouchEnd: (e: any) => void;
|
|
25
|
-
onChange: (e: any) => void;
|
|
26
|
-
render(): JSX.Element;
|
|
27
|
-
}
|
|
4
|
+
export type AtSwipeActionInstance = {
|
|
5
|
+
state: AtSwipeActionState;
|
|
6
|
+
onChange: (e: {
|
|
7
|
+
detail: {
|
|
8
|
+
x: number;
|
|
9
|
+
};
|
|
10
|
+
}) => void;
|
|
11
|
+
onTouchEnd: (e: CommonEvent) => void;
|
|
12
|
+
};
|
|
13
|
+
declare const AtSwipeAction: React.ForwardRefExoticComponent<AtSwipeActionProps & React.RefAttributes<AtSwipeActionInstance>>;
|
|
14
|
+
export default AtSwipeAction;
|