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
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtProgressProps } from '../../../types/progress';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
declare function AtProgress({ color, percent: percentProp, strokeWidth, status, isHidePercent, className }: AtProgressProps): JSX.Element;
|
|
4
|
+
declare namespace AtProgress {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
color: PropTypes.Requireable<string>;
|
|
7
|
+
status: PropTypes.Requireable<string>;
|
|
8
|
+
percent: PropTypes.Requireable<number>;
|
|
9
|
+
strokeWidth: PropTypes.Requireable<number>;
|
|
10
|
+
isHidePercent: PropTypes.Requireable<boolean>;
|
|
11
|
+
};
|
|
7
12
|
}
|
|
13
|
+
export default AtProgress;
|
|
@@ -2,43 +2,46 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 })));
|
|
5
|
+
function AtProgress({
|
|
6
|
+
color,
|
|
7
|
+
percent: percentProp,
|
|
8
|
+
strokeWidth,
|
|
9
|
+
status,
|
|
10
|
+
isHidePercent,
|
|
11
|
+
className
|
|
12
|
+
}) {
|
|
13
|
+
let percent = percentProp;
|
|
14
|
+
if (typeof percent !== "number") {
|
|
15
|
+
percent = 0;
|
|
41
16
|
}
|
|
17
|
+
if (percent < 0) {
|
|
18
|
+
percent = 0;
|
|
19
|
+
} else if (percent > 100) {
|
|
20
|
+
percent = 100;
|
|
21
|
+
}
|
|
22
|
+
const rootClass = classNames(
|
|
23
|
+
"at-progress",
|
|
24
|
+
{
|
|
25
|
+
[`at-progress--${status}`]: !!status
|
|
26
|
+
},
|
|
27
|
+
className
|
|
28
|
+
);
|
|
29
|
+
const iconClass = classNames("at-icon", {
|
|
30
|
+
"at-icon-close-circle": status === "error",
|
|
31
|
+
"at-icon-check-circle": status === "success"
|
|
32
|
+
});
|
|
33
|
+
const progressStyle = {
|
|
34
|
+
width: percent && `${+percent}%`,
|
|
35
|
+
height: strokeWidth && `${+strokeWidth}px`,
|
|
36
|
+
backgroundColor: color
|
|
37
|
+
};
|
|
38
|
+
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(
|
|
39
|
+
View,
|
|
40
|
+
{
|
|
41
|
+
className: "at-progress__outer-inner-background",
|
|
42
|
+
style: progressStyle
|
|
43
|
+
}
|
|
44
|
+
))), !isHidePercent && /* @__PURE__ */ React.createElement(View, { className: "at-progress__content" }, !status || status === "progress" ? `${percent}%` : /* @__PURE__ */ React.createElement(Text, { className: iconClass })));
|
|
42
45
|
}
|
|
43
46
|
AtProgress.propTypes = {
|
|
44
47
|
color: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/progress/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/progress/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtProgressProps } from '../../../types/progress'\n\nexport default function AtProgress({\n color,\n percent: percentProp,\n strokeWidth,\n status,\n isHidePercent,\n className\n}: AtProgressProps): JSX.Element {\n let percent = percentProp\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 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\nAtProgress.propTypes = {\n color: PropTypes.string,\n status: PropTypes.string,\n percent: PropTypes.number,\n strokeWidth: PropTypes.number,\n isHidePercent: PropTypes.bool\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAGZ,SAAR,WAA4B;AAAA,EACjC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAiC;AAC/B,MAAI,UAAU;AACd,MAAI,OAAO,YAAY,UAAU;AAC/B,cAAU;AAAA,EACZ;AAEA,MAAI,UAAU,GAAG;AACf,cAAU;AAAA,EACZ,WAAW,UAAU,KAAK;AACxB,cAAU;AAAA,EACZ;AAEA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,MACE,CAAC,gBAAgB,MAAM,EAAE,GAAG,CAAC,CAAC;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AACA,QAAM,YAAY,WAAW,WAAW;AAAA,IACtC,wBAAwB,WAAW;AAAA,IACnC,wBAAwB,WAAW;AAAA,EACrC,CAAC;AAED,QAAM,gBAAgB;AAAA,IACpB,OAAO,WAAW,GAAG,CAAC,OAAO;AAAA,IAC7B,QAAQ,eAAe,GAAG,CAAC,WAAW;AAAA,IACtC,iBAAiB;AAAA,EACnB;AAEA,SACE,oCAAC,QAAK,WAAW,aACf,oCAAC,QAAK,WAAU,wBACd,oCAAC,QAAK,WAAU,8BACd;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA;AAAA,EACT,CACF,CACF,GAEC,CAAC,iBACA,oCAAC,QAAK,WAAU,0BACb,CAAC,UAAU,WAAW,aACrB,GAAG,OAAO,MAEV,oCAAC,QAAK,WAAW,WAAW,CAEhC,CAEJ;AAEJ;AAEA,WAAW,YAAY;AAAA,EACrB,OAAO,UAAU;AAAA,EACjB,QAAQ,UAAU;AAAA,EAClB,SAAS,UAAU;AAAA,EACnB,aAAa,UAAU;AAAA,EACvB,eAAe,UAAU;AAC3B;","names":[]}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtRadioProps } from '../../../types/radio';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
declare function AtRadio({ customStyle, className, value, options, onClick }: AtRadioProps<any>): JSX.Element;
|
|
4
|
+
declare namespace AtRadio {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
7
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
8
|
+
value: PropTypes.Requireable<string>;
|
|
9
|
+
options: PropTypes.Requireable<any[]>;
|
|
10
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
9
12
|
}
|
|
13
|
+
export default AtRadio;
|
|
@@ -2,45 +2,40 @@ 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
|
-
|
|
5
|
+
import { noop } from "../../common/utils";
|
|
6
|
+
function AtRadio({
|
|
7
|
+
customStyle = "",
|
|
8
|
+
className = "",
|
|
9
|
+
value = "",
|
|
10
|
+
options = [],
|
|
11
|
+
onClick = noop
|
|
12
|
+
}) {
|
|
13
|
+
const handleClick = (option, event) => {
|
|
7
14
|
if (option.disabled) return;
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
onClick(option.value, event);
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames("at-radio", className), style: customStyle }, options.map((option) => /* @__PURE__ */ React.createElement(
|
|
18
|
+
View,
|
|
19
|
+
{
|
|
20
|
+
key: option.value,
|
|
21
|
+
onClick: (event) => handleClick(option, event),
|
|
22
|
+
className: classNames({
|
|
23
|
+
"at-radio__option": true,
|
|
24
|
+
"at-radio__option--disabled": option.disabled
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
/* @__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(
|
|
13
28
|
View,
|
|
14
29
|
{
|
|
15
|
-
key: option.value,
|
|
16
|
-
onClick: this.handleClick.bind(this, option),
|
|
17
30
|
className: classNames({
|
|
18
|
-
"at-
|
|
19
|
-
"at-
|
|
31
|
+
"at-radio__icon": true,
|
|
32
|
+
"at-radio__icon--checked": value === option.value
|
|
20
33
|
})
|
|
21
34
|
},
|
|
22
|
-
/* @__PURE__ */ React.createElement(
|
|
23
|
-
|
|
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
|
-
}
|
|
35
|
+
/* @__PURE__ */ React.createElement(Text, { className: "at-icon at-icon-check" })
|
|
36
|
+
)), option.desc && /* @__PURE__ */ React.createElement(View, { className: "at-radio__desc" }, option.desc))
|
|
37
|
+
)));
|
|
34
38
|
}
|
|
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
39
|
AtRadio.propTypes = {
|
|
45
40
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
46
41
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
@@ -48,7 +43,8 @@ AtRadio.propTypes = {
|
|
|
48
43
|
options: PropTypes.array,
|
|
49
44
|
onClick: PropTypes.func
|
|
50
45
|
};
|
|
46
|
+
var radio_default = AtRadio;
|
|
51
47
|
export {
|
|
52
|
-
|
|
48
|
+
radio_default as default
|
|
53
49
|
};
|
|
54
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/radio/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 { AtRadioProps, RadioOption } from '../../../types/radio'\nimport { noop } from '../../common/utils'\n\nfunction AtRadio({\n customStyle = '',\n className = '',\n value = '',\n options = [],\n onClick = noop\n}: AtRadioProps<any>): JSX.Element {\n const handleClick = (option: RadioOption<any>, event: CommonEvent): void => {\n if (option.disabled) return\n onClick(option.value, event)\n }\n\n return (\n <View className={classNames('at-radio', className)} style={customStyle}>\n {options.map(option => (\n <View\n key={option.value}\n onClick={event => handleClick(option, event)}\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\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\nexport default AtRadio\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAG3B,SAAS,YAAY;AAErB,SAAS,QAAQ;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,UAAU,CAAC;AAAA,EACX,UAAU;AACZ,GAAmC;AACjC,QAAM,cAAc,CAAC,QAA0B,UAA6B;AAC1E,QAAI,OAAO,SAAU;AACrB,YAAQ,OAAO,OAAO,KAAK;AAAA,EAC7B;AAEA,SACE,oCAAC,QAAK,WAAW,WAAW,YAAY,SAAS,GAAG,OAAO,eACxD,QAAQ,IAAI,YACX;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,OAAO;AAAA,MACZ,SAAS,WAAS,YAAY,QAAQ,KAAK;AAAA,MAC3C,WAAW,WAAW;AAAA,QACpB,oBAAoB;AAAA,QACpB,8BAA8B,OAAO;AAAA,MACvC,CAAC;AAAA;AAAA,IAED,oCAAC,QAAK,WAAU,2BACd,oCAAC,QAAK,WAAU,gCACd,oCAAC,QAAK,WAAU,qBAAmB,OAAO,KAAM,GAChD;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,WAAW;AAAA,UACpB,kBAAkB;AAAA,UAClB,2BAA2B,UAAU,OAAO;AAAA,QAC9C,CAAC;AAAA;AAAA,MAED,oCAAC,QAAK,WAAU,yBAAwB;AAAA,IAC1C,CACF,GACC,OAAO,QACN,oCAAC,QAAK,WAAU,oBAAkB,OAAO,IAAK,CAElD;AAAA,EACF,CACD,CACH;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,OAAO,UAAU;AAAA,EACjB,SAAS,UAAU;AAAA,EACnB,SAAS,UAAU;AACrB;AAEA,IAAO,gBAAQ;","names":[]}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
UNSAFE_componentWillReceiveProps(nextProps: AtRangeProps): void;
|
|
20
|
-
componentDidMount(): void;
|
|
21
|
-
render(): JSX.Element;
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { AtRangeProps } from '../../../types/range';
|
|
3
|
+
declare function AtRange({ customStyle, className, sliderStyle, railStyle, trackStyle, value, min, max, disabled, blockSize, onChange, onAfterChange }: AtRangeProps): JSX.Element;
|
|
4
|
+
declare namespace AtRange {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
7
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
8
|
+
sliderStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
9
|
+
railStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
10
|
+
trackStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
11
|
+
value: PropTypes.Requireable<any[]>;
|
|
12
|
+
min: PropTypes.Requireable<number>;
|
|
13
|
+
max: PropTypes.Requireable<number>;
|
|
14
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
15
|
+
blockSize: PropTypes.Requireable<number>;
|
|
16
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
onAfterChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
};
|
|
22
19
|
}
|
|
20
|
+
export default AtRange;
|
|
@@ -19,174 +19,166 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import classNames from "classnames";
|
|
21
21
|
import PropTypes from "prop-types";
|
|
22
|
-
import React from "react";
|
|
22
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
23
23
|
import { View } from "@tarojs/components";
|
|
24
24
|
import {
|
|
25
25
|
delayQuerySelector,
|
|
26
26
|
getEventDetail,
|
|
27
27
|
mergeStyle
|
|
28
28
|
} from "../../common/utils";
|
|
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
|
-
const
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
handleTouchEnd(sliderName) {
|
|
57
|
-
if (this.props.disabled) return;
|
|
58
|
-
this.currentSlider = sliderName;
|
|
59
|
-
this.triggerEvent("onAfterChange");
|
|
60
|
-
}
|
|
61
|
-
setSliderValue(sliderName, targetValue, funcName) {
|
|
62
|
-
const distance = Math.min(Math.max(targetValue, 0), this.width);
|
|
63
|
-
const sliderValue = Math.floor(distance / this.width * 100);
|
|
64
|
-
if (funcName) {
|
|
65
|
-
this.setState(
|
|
66
|
-
{
|
|
67
|
-
[sliderName]: sliderValue
|
|
68
|
-
},
|
|
69
|
-
() => this.triggerEvent(funcName)
|
|
70
|
-
);
|
|
71
|
-
} else {
|
|
72
|
-
this.setState({
|
|
73
|
-
[sliderName]: sliderValue
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
setValue(value) {
|
|
78
|
-
const { min = 0 } = this.props;
|
|
79
|
-
const aX = Math.round((value[0] - min) / this.deltaValue * 100);
|
|
80
|
-
const bX = Math.round((value[1] - min) / this.deltaValue * 100);
|
|
81
|
-
this.setState({ aX, bX });
|
|
82
|
-
}
|
|
83
|
-
triggerEvent(funcName) {
|
|
84
|
-
const { min = 0 } = this.props;
|
|
85
|
-
const { aX, bX } = this.state;
|
|
86
|
-
const a = Math.round(aX / 100 * this.deltaValue) + min;
|
|
87
|
-
const b = Math.round(bX / 100 * this.deltaValue) + min;
|
|
29
|
+
function AtRange({
|
|
30
|
+
customStyle = "",
|
|
31
|
+
className = "",
|
|
32
|
+
sliderStyle = {},
|
|
33
|
+
railStyle = {},
|
|
34
|
+
trackStyle = {},
|
|
35
|
+
value = [0, 0],
|
|
36
|
+
min = 0,
|
|
37
|
+
max = 100,
|
|
38
|
+
disabled = false,
|
|
39
|
+
blockSize = 0,
|
|
40
|
+
onChange,
|
|
41
|
+
onAfterChange
|
|
42
|
+
}) {
|
|
43
|
+
const widthRef = useRef(0);
|
|
44
|
+
const leftRef = useRef(0);
|
|
45
|
+
const deltaValueRef = useRef(max - min);
|
|
46
|
+
const currentSliderRef = useRef("");
|
|
47
|
+
const [{ aX, bX }, setAxis] = useState({ aX: 0, bX: 0 });
|
|
48
|
+
const stateRef = useRef({ aX: 0, bX: 0 });
|
|
49
|
+
stateRef.current = { aX, bX };
|
|
50
|
+
deltaValueRef.current = max - min;
|
|
51
|
+
const triggerEvent = (funcName) => {
|
|
52
|
+
const { aX: stateAX, bX: stateBX } = stateRef.current;
|
|
53
|
+
const a = Math.round(stateAX / 100 * deltaValueRef.current) + min;
|
|
54
|
+
const b = Math.round(stateBX / 100 * deltaValueRef.current) + min;
|
|
88
55
|
const result = [a, b].sort((x, y) => x - y);
|
|
89
56
|
if (funcName === "onChange") {
|
|
90
|
-
|
|
57
|
+
onChange && onChange(result);
|
|
91
58
|
} else if (funcName === "onAfterChange") {
|
|
92
|
-
|
|
59
|
+
onAfterChange && onAfterChange(result);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const setValue = (nextValue) => {
|
|
63
|
+
const aXVal = Math.round(
|
|
64
|
+
(nextValue[0] - min) / deltaValueRef.current * 100
|
|
65
|
+
);
|
|
66
|
+
const bXVal = Math.round(
|
|
67
|
+
(nextValue[1] - min) / deltaValueRef.current * 100
|
|
68
|
+
);
|
|
69
|
+
setAxis({ aX: aXVal, bX: bXVal });
|
|
70
|
+
};
|
|
71
|
+
const setSliderValue = (sliderName, targetValue, funcName) => {
|
|
72
|
+
const distance = Math.min(Math.max(targetValue, 0), widthRef.current);
|
|
73
|
+
const sliderValue = Math.floor(distance / widthRef.current * 100);
|
|
74
|
+
if (funcName) {
|
|
75
|
+
setAxis((prev) => {
|
|
76
|
+
const next = __spreadProps(__spreadValues({}, prev), { [sliderName]: sliderValue });
|
|
77
|
+
stateRef.current = next;
|
|
78
|
+
const a = Math.round(next.aX / 100 * deltaValueRef.current) + min;
|
|
79
|
+
const b = Math.round(next.bX / 100 * deltaValueRef.current) + min;
|
|
80
|
+
const result = [a, b].sort((x, y) => x - y);
|
|
81
|
+
if (funcName === "onChange") {
|
|
82
|
+
onChange && onChange(result);
|
|
83
|
+
} else if (funcName === "onAfterChange") {
|
|
84
|
+
onAfterChange && onAfterChange(result);
|
|
85
|
+
}
|
|
86
|
+
return next;
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
setAxis((prev) => __spreadProps(__spreadValues({}, prev), { [sliderName]: sliderValue }));
|
|
93
90
|
}
|
|
94
|
-
}
|
|
95
|
-
updatePos() {
|
|
91
|
+
};
|
|
92
|
+
const updatePos = () => {
|
|
96
93
|
delayQuerySelector(".at-range__container", 0).then((rect) => {
|
|
97
94
|
var _a, _b;
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
widthRef.current = Math.round((_a = rect[0]) == null ? void 0 : _a.width);
|
|
96
|
+
leftRef.current = Math.round((_b = rect[0]) == null ? void 0 : _b.left);
|
|
100
97
|
});
|
|
101
|
-
}
|
|
102
|
-
|
|
98
|
+
};
|
|
99
|
+
const handleClick = (event) => {
|
|
100
|
+
if (currentSliderRef.current && !disabled) {
|
|
101
|
+
let sliderValue = 0;
|
|
102
|
+
const detail = getEventDetail(event);
|
|
103
|
+
sliderValue = detail.x - leftRef.current;
|
|
104
|
+
setSliderValue(currentSliderRef.current, sliderValue, "onChange");
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleTouchMove = (sliderName, event) => {
|
|
108
|
+
if (disabled) return;
|
|
109
|
+
event.stopPropagation();
|
|
110
|
+
const clientX = event.touches[0].clientX;
|
|
111
|
+
setSliderValue(sliderName, clientX - leftRef.current, "onChange");
|
|
112
|
+
};
|
|
113
|
+
const handleTouchEnd = (sliderName) => {
|
|
114
|
+
if (disabled) return;
|
|
115
|
+
currentSliderRef.current = sliderName;
|
|
116
|
+
triggerEvent("onAfterChange");
|
|
117
|
+
};
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
updatePos();
|
|
120
|
+
setValue(value);
|
|
121
|
+
}, []);
|
|
122
|
+
const prevValueRef = useRef(value);
|
|
123
|
+
useEffect(() => {
|
|
103
124
|
var _a, _b;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.setValue(value);
|
|
125
|
+
updatePos();
|
|
126
|
+
if (((_a = prevValueRef.current) == null ? void 0 : _a[0]) !== (value == null ? void 0 : value[0]) || ((_b = prevValueRef.current) == null ? void 0 : _b[1]) !== (value == null ? void 0 : value[1])) {
|
|
127
|
+
setValue(value);
|
|
108
128
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
className: "at-range__slider",
|
|
163
|
-
style: mergeStyle(sliderAStyle, sliderStyle),
|
|
164
|
-
onTouchMove: this.handleTouchMove.bind(this, "aX"),
|
|
165
|
-
onTouchEnd: this.handleTouchEnd.bind(this, "aX")
|
|
166
|
-
}
|
|
167
|
-
), /* @__PURE__ */ React.createElement(
|
|
168
|
-
View,
|
|
169
|
-
{
|
|
170
|
-
className: "at-range__slider",
|
|
171
|
-
style: mergeStyle(sliderBStyle, sliderStyle),
|
|
172
|
-
onTouchMove: this.handleTouchMove.bind(this, "bX"),
|
|
173
|
-
onTouchEnd: this.handleTouchEnd.bind(this, "bX")
|
|
174
|
-
}
|
|
175
|
-
)));
|
|
176
|
-
}
|
|
129
|
+
prevValueRef.current = value;
|
|
130
|
+
}, [value, min, max]);
|
|
131
|
+
const rootCls = classNames(
|
|
132
|
+
"at-range",
|
|
133
|
+
{
|
|
134
|
+
"at-range--disabled": disabled
|
|
135
|
+
},
|
|
136
|
+
className
|
|
137
|
+
);
|
|
138
|
+
const sliderCommonStyle = {
|
|
139
|
+
width: blockSize ? `${blockSize}PX` : "",
|
|
140
|
+
height: blockSize ? `${blockSize}PX` : "",
|
|
141
|
+
marginLeft: blockSize ? `${-blockSize / 2}PX` : ""
|
|
142
|
+
};
|
|
143
|
+
const sliderAStyle = __spreadProps(__spreadValues({}, sliderCommonStyle), {
|
|
144
|
+
left: `${aX}%`
|
|
145
|
+
});
|
|
146
|
+
const sliderBStyle = __spreadProps(__spreadValues({}, sliderCommonStyle), {
|
|
147
|
+
left: `${bX}%`
|
|
148
|
+
});
|
|
149
|
+
const containerStyle = {
|
|
150
|
+
height: blockSize ? `${blockSize}PX` : ""
|
|
151
|
+
};
|
|
152
|
+
const smallerX = Math.min(aX, bX);
|
|
153
|
+
const deltaX = Math.abs(aX - bX);
|
|
154
|
+
const atTrackStyle = {
|
|
155
|
+
left: `${smallerX}%`,
|
|
156
|
+
width: `${deltaX}%`
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootCls, style: customStyle, onClick: handleClick }, /* @__PURE__ */ React.createElement(View, { className: "at-range__container", style: containerStyle }, /* @__PURE__ */ React.createElement(View, { className: "at-range__rail", style: railStyle }), /* @__PURE__ */ React.createElement(
|
|
159
|
+
View,
|
|
160
|
+
{
|
|
161
|
+
className: "at-range__track",
|
|
162
|
+
style: mergeStyle(atTrackStyle, trackStyle)
|
|
163
|
+
}
|
|
164
|
+
), /* @__PURE__ */ React.createElement(
|
|
165
|
+
View,
|
|
166
|
+
{
|
|
167
|
+
className: "at-range__slider",
|
|
168
|
+
style: mergeStyle(sliderAStyle, sliderStyle),
|
|
169
|
+
onTouchMove: (event) => handleTouchMove("aX", event),
|
|
170
|
+
onTouchEnd: () => handleTouchEnd("aX")
|
|
171
|
+
}
|
|
172
|
+
), /* @__PURE__ */ React.createElement(
|
|
173
|
+
View,
|
|
174
|
+
{
|
|
175
|
+
className: "at-range__slider",
|
|
176
|
+
style: mergeStyle(sliderBStyle, sliderStyle),
|
|
177
|
+
onTouchMove: (event) => handleTouchMove("bX", event),
|
|
178
|
+
onTouchEnd: () => handleTouchEnd("bX")
|
|
179
|
+
}
|
|
180
|
+
)));
|
|
177
181
|
}
|
|
178
|
-
AtRange.defaultProps = {
|
|
179
|
-
customStyle: "",
|
|
180
|
-
className: "",
|
|
181
|
-
sliderStyle: "",
|
|
182
|
-
railStyle: "",
|
|
183
|
-
trackStyle: "",
|
|
184
|
-
value: [0, 0],
|
|
185
|
-
min: 0,
|
|
186
|
-
max: 100,
|
|
187
|
-
disabled: false,
|
|
188
|
-
blockSize: 0
|
|
189
|
-
};
|
|
190
182
|
AtRange.propTypes = {
|
|
191
183
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
192
184
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
@@ -201,7 +193,8 @@ AtRange.propTypes = {
|
|
|
201
193
|
onChange: PropTypes.func,
|
|
202
194
|
onAfterChange: PropTypes.func
|
|
203
195
|
};
|
|
196
|
+
var range_default = AtRange;
|
|
204
197
|
export {
|
|
205
|
-
|
|
198
|
+
range_default as default
|
|
206
199
|
};
|
|
207
200
|
//# sourceMappingURL=index.js.map
|