@nutui/nutui-react-taro 2.0.0-alpha.7 → 2.0.0-alpha.8
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/CHANGELOG.md +6 -0
- package/dist/esm/Audio.js +7 -6
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/ImagePreview.js +1 -1
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +5 -7
- package/dist/esm/Step.js +1 -1
- package/dist/esm/Steps.js +1 -1
- package/dist/esm/Swiper.js +1 -1
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/{audio.taro-ec96ef80.js → audio.taro-bbd39f93.js} +2 -2
- package/dist/esm/{cascader.taro-0a2694ed.js → cascader.taro-fb7a0230.js} +21 -13
- package/dist/esm/nutui-react.es.js +5 -5
- package/dist/esm/range.taro-615e193a.js +259 -0
- package/dist/esm/step.taro-3bc01c0c.js +1 -1
- package/dist/esm/steps.taro-77e301ab.js +1 -1
- package/dist/esm/swiper.taro-74cf9306.js +1 -1
- package/dist/esm/swiperitem-80df464a.js +1 -1
- package/dist/esm/{tabs.taro-b75f20ff.js → tabs.taro-66164782.js} +8 -1
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +408 -483
- package/dist/nutui.react.umd.js +408 -483
- package/dist/packages/range/range.scss +24 -49
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +11 -17
- package/dist/styles/variables.scss +11 -14
- package/dist/types/index.d.ts +20 -26
- package/package.json +1 -1
- package/dist/esm/range.taro-52cda918.js +0 -325
package/dist/style.mjs
CHANGED
|
@@ -894,25 +894,19 @@ $infiniteloading-bottom-color: var(
|
|
|
894
894
|
) !default;
|
|
895
895
|
|
|
896
896
|
//range(✅)
|
|
897
|
-
$range-
|
|
898
|
-
$range-
|
|
899
|
-
$range-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
135deg,
|
|
905
|
-
$primary-color 0%,
|
|
906
|
-
$primary-color-end 100%
|
|
907
|
-
) !default;
|
|
908
|
-
$range-bar-btn-bg-color: var(
|
|
909
|
-
--nutui-range-bar-btn-bg-color,
|
|
897
|
+
$range-font-color: var(--nutui-range-font-color, $gray1) !default;
|
|
898
|
+
$range-height: var(--nutui-range-height, 4px) !default;
|
|
899
|
+
$range-margin: var(--nutui-range-margin, 15px) !default;
|
|
900
|
+
$range-inactive-color: var(--nutui-range-inactive-color, #fa958c) !default;
|
|
901
|
+
$range-active-color: var(--nutui-range-active-color, $primary-color) !default;
|
|
902
|
+
$range-button-background: var(
|
|
903
|
+
--nutui-range-button-background,
|
|
910
904
|
$primary-text-color
|
|
911
905
|
) !default;
|
|
912
|
-
$range-
|
|
913
|
-
$range-
|
|
914
|
-
$range-
|
|
915
|
-
--nutui-range-
|
|
906
|
+
$range-button-width: var(--nutui-range-button-width, 24px) !default;
|
|
907
|
+
$range-button-height: var(--nutui-range-button-height, 24px) !default;
|
|
908
|
+
$range-button-border: var(
|
|
909
|
+
--nutui-range-button-border,
|
|
916
910
|
1px solid $primary-color
|
|
917
911
|
) !default;
|
|
918
912
|
|
|
@@ -880,22 +880,19 @@ $infiniteloading-bottom-color: var(
|
|
|
880
880
|
) !default;
|
|
881
881
|
|
|
882
882
|
//range(✅)
|
|
883
|
-
$range-
|
|
884
|
-
$range-
|
|
885
|
-
$range-
|
|
886
|
-
$range-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
) !default;
|
|
891
|
-
$range-bar-btn-bg-color: var(
|
|
892
|
-
--nutui-range-bar-btn-bg-color,
|
|
883
|
+
$range-font-color: var(--nutui-range-font-color, $gray1) !default;
|
|
884
|
+
$range-height: var(--nutui-range-height, 4px) !default;
|
|
885
|
+
$range-margin: var(--nutui-range-margin, 15px) !default;
|
|
886
|
+
$range-inactive-color: var(--nutui-range-inactive-color, #fa958c) !default;
|
|
887
|
+
$range-active-color: var(--nutui-range-active-color, $primary-color) !default;
|
|
888
|
+
$range-button-background: var(
|
|
889
|
+
--nutui-range-button-background,
|
|
893
890
|
$primary-text-color
|
|
894
891
|
) !default;
|
|
895
|
-
$range-
|
|
896
|
-
$range-
|
|
897
|
-
$range-
|
|
898
|
-
--nutui-range-
|
|
892
|
+
$range-button-width: var(--nutui-range-button-width, 24px) !default;
|
|
893
|
+
$range-button-height: var(--nutui-range-button-height, 24px) !default;
|
|
894
|
+
$range-button-border: var(
|
|
895
|
+
--nutui-range-button-border,
|
|
899
896
|
1px solid $primary-color
|
|
900
897
|
) !default;
|
|
901
898
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -601,6 +601,7 @@ interface CascaderOption {
|
|
|
601
601
|
loading?: boolean;
|
|
602
602
|
root?: boolean;
|
|
603
603
|
}
|
|
604
|
+
type CascaderValue = Exclude<CascaderOption['value'], undefined>[];
|
|
604
605
|
interface optionKey {
|
|
605
606
|
textKey: string;
|
|
606
607
|
valueKey: string;
|
|
@@ -613,7 +614,8 @@ interface CascaderProps extends BasicComponent {
|
|
|
613
614
|
activeColor: string;
|
|
614
615
|
activeIcon: string;
|
|
615
616
|
options: CascaderOption[];
|
|
616
|
-
value
|
|
617
|
+
value?: CascaderValue;
|
|
618
|
+
defaultValue?: CascaderValue;
|
|
617
619
|
title: string;
|
|
618
620
|
optionKey: optionKey;
|
|
619
621
|
format: Record<string, string | number | null>;
|
|
@@ -623,8 +625,8 @@ interface CascaderProps extends BasicComponent {
|
|
|
623
625
|
lazy: boolean;
|
|
624
626
|
onLoad: (node: any, resolve: any) => void;
|
|
625
627
|
onClose?: () => void;
|
|
626
|
-
onChange: (value:
|
|
627
|
-
onPathChange: (value:
|
|
628
|
+
onChange: (value: CascaderValue, params?: any) => void;
|
|
629
|
+
onPathChange: (value: CascaderValue, params: any) => void;
|
|
628
630
|
}
|
|
629
631
|
declare const Cascader: React__default.ForwardRefExoticComponent<Partial<CascaderProps> & {
|
|
630
632
|
children?: React__default.ReactNode;
|
|
@@ -935,34 +937,26 @@ declare const Radio: FunctionComponent<Partial<RadioProps> & React__default.HTML
|
|
|
935
937
|
RadioGroup: typeof RadioGroup;
|
|
936
938
|
};
|
|
937
939
|
|
|
938
|
-
type
|
|
939
|
-
interface RangeProps {
|
|
940
|
-
|
|
941
|
-
|
|
940
|
+
type RangeValue = number | number[];
|
|
941
|
+
interface RangeProps extends BasicComponent {
|
|
942
|
+
value: RangeValue;
|
|
943
|
+
defaultValue: RangeValue;
|
|
942
944
|
range: boolean;
|
|
943
945
|
disabled: boolean;
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
max: number | string;
|
|
951
|
-
minDesc: number | string;
|
|
952
|
-
maxDesc: number | string;
|
|
953
|
-
curValueDesc: number | string;
|
|
954
|
-
step: number | string;
|
|
955
|
-
modelValue: SliderValue;
|
|
956
|
-
button: React__default.ReactNode;
|
|
946
|
+
min: number;
|
|
947
|
+
max: number;
|
|
948
|
+
step: number;
|
|
949
|
+
minDescription: ReactNode;
|
|
950
|
+
maxDescription: ReactNode;
|
|
951
|
+
button: ReactNode;
|
|
957
952
|
vertical: boolean;
|
|
958
953
|
marks: Record<string, unknown>;
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
onDragEnd?: () => void;
|
|
954
|
+
currentDescription: ((value: RangeValue) => ReactNode) | null;
|
|
955
|
+
onChange: (value: RangeValue) => void;
|
|
956
|
+
onStart: () => void;
|
|
957
|
+
onEnd: (value: RangeValue) => void;
|
|
964
958
|
}
|
|
965
|
-
declare const Range: FunctionComponent<Partial<RangeProps> & Omit<React__default.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onChange'>>;
|
|
959
|
+
declare const Range: FunctionComponent<Partial<RangeProps> & Omit<React__default.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onChange' | 'defaultValue'>>;
|
|
966
960
|
|
|
967
961
|
interface RateProps extends BasicComponent {
|
|
968
962
|
count: number;
|
package/package.json
CHANGED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect, useCallback } from "react";
|
|
2
|
-
import { u as useTouch } from "./use-touch-ff43512c.js";
|
|
3
|
-
import { g as getRectByTaro } from "./use-client-rect-f317804e.js";
|
|
4
|
-
import { T as Toast } from "./toast.taro-92c10e1d.js";
|
|
5
|
-
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
6
|
-
const defaultProps = {
|
|
7
|
-
range: false,
|
|
8
|
-
hiddenRange: false,
|
|
9
|
-
hiddenTag: false,
|
|
10
|
-
min: 0,
|
|
11
|
-
max: 100,
|
|
12
|
-
step: 1,
|
|
13
|
-
modelValue: 0,
|
|
14
|
-
vertical: false,
|
|
15
|
-
marks: {}
|
|
16
|
-
};
|
|
17
|
-
let startValue;
|
|
18
|
-
let currentValue;
|
|
19
|
-
const Range = (props) => {
|
|
20
|
-
const { locale } = useConfig();
|
|
21
|
-
const { className, range, disabled, activeColor, inactiveColor, buttonColor, hiddenRange, hiddenTag, modelValue, button, vertical, marks, dragStart, dragEnd, onChange, onDragStart, onDragEnd, minDesc, maxDesc, curValueDesc } = { ...defaultProps, ...props };
|
|
22
|
-
let { min, max, step } = { ...defaultProps, ...props };
|
|
23
|
-
min = Number(min);
|
|
24
|
-
max = Number(max);
|
|
25
|
-
step = Number(step);
|
|
26
|
-
const [buttonIndex, SetButtonIndex] = useState(0);
|
|
27
|
-
const [initValue, SetInitValue] = useState();
|
|
28
|
-
const [dragStatus, SetDragStatus] = useState("start");
|
|
29
|
-
const touch = useTouch();
|
|
30
|
-
const root = useRef(null);
|
|
31
|
-
const [marksList, SetMarksList] = useState([]);
|
|
32
|
-
const [show, SetShow] = useState(false);
|
|
33
|
-
const [toastMsg, SetToastMsg] = useState("");
|
|
34
|
-
const toastShow = (msg) => {
|
|
35
|
-
SetToastMsg(msg);
|
|
36
|
-
SetShow(true);
|
|
37
|
-
};
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (typeof modelValue === "number") {
|
|
40
|
-
if (!range && (modelValue < min || modelValue > max)) {
|
|
41
|
-
SetInitValue(0);
|
|
42
|
-
toastShow(`${modelValue} ${locale.range.rangeText}`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
SetInitValue(modelValue);
|
|
46
|
-
}
|
|
47
|
-
}, [modelValue]);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (marks) {
|
|
50
|
-
const marksKeys = Object.keys(marks);
|
|
51
|
-
const list = marksKeys.map(parseFloat).sort((a, b) => a - b).filter((point) => point >= min && point <= max);
|
|
52
|
-
SetMarksList(list);
|
|
53
|
-
}
|
|
54
|
-
}, [marks]);
|
|
55
|
-
const scope = () => {
|
|
56
|
-
return Number(max) - Number(min);
|
|
57
|
-
};
|
|
58
|
-
const classes = useCallback(() => {
|
|
59
|
-
const prefixCls = "nut-range";
|
|
60
|
-
return [
|
|
61
|
-
prefixCls,
|
|
62
|
-
`${disabled ? `${prefixCls}-disabled` : ""}`,
|
|
63
|
-
`${vertical ? `${prefixCls}-vertical` : ""}`,
|
|
64
|
-
`${!hiddenRange ? `${prefixCls}-show-number` : ""}`
|
|
65
|
-
].filter(Boolean).join(" ");
|
|
66
|
-
}, [disabled, vertical, hiddenRange]);
|
|
67
|
-
const containerClasses = useCallback(() => {
|
|
68
|
-
const prefixCls = "nut-range-container";
|
|
69
|
-
return [prefixCls, `${vertical ? `${prefixCls}-vertical` : ""}`, className].filter(Boolean).join(" ");
|
|
70
|
-
}, [vertical, className]);
|
|
71
|
-
const markClassName = useCallback((mark) => {
|
|
72
|
-
const classPrefix = "nut-range-mark";
|
|
73
|
-
let lowerBound = Number(min);
|
|
74
|
-
let upperBound = Number(max);
|
|
75
|
-
if (range) {
|
|
76
|
-
const [left, right] = modelValue;
|
|
77
|
-
lowerBound = left;
|
|
78
|
-
upperBound = right;
|
|
79
|
-
} else {
|
|
80
|
-
upperBound = modelValue;
|
|
81
|
-
}
|
|
82
|
-
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
83
|
-
return [
|
|
84
|
-
`${classPrefix}-text`,
|
|
85
|
-
`${isActive ? `${classPrefix}-text-active` : ""}`
|
|
86
|
-
].filter(Boolean).join(" ");
|
|
87
|
-
}, [range, modelValue, min, max]);
|
|
88
|
-
const [rangeName, setRangeName] = useState(classes());
|
|
89
|
-
const [containerName, setContainerName] = useState(containerClasses());
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
setRangeName(classes());
|
|
92
|
-
setContainerName(containerClasses());
|
|
93
|
-
}, [classes, containerClasses]);
|
|
94
|
-
const wrapperStyle = () => {
|
|
95
|
-
return {
|
|
96
|
-
background: inactiveColor
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
const buttonStyle = () => {
|
|
100
|
-
return {
|
|
101
|
-
borderColor: buttonColor
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
const isRange = (val) => {
|
|
105
|
-
return !!range && Array.isArray(val);
|
|
106
|
-
};
|
|
107
|
-
const calcMainAxis = () => {
|
|
108
|
-
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
109
|
-
if (isRange(modelVal)) {
|
|
110
|
-
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
111
|
-
}
|
|
112
|
-
return `${(modelVal - Number(min)) * 100 / scope()}%`;
|
|
113
|
-
};
|
|
114
|
-
const calcOffset = () => {
|
|
115
|
-
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
116
|
-
if (isRange(modelVal)) {
|
|
117
|
-
return `${(modelVal[0] - Number(min)) * 100 / scope()}%`;
|
|
118
|
-
}
|
|
119
|
-
return `0%`;
|
|
120
|
-
};
|
|
121
|
-
const barStyle = () => {
|
|
122
|
-
if (vertical) {
|
|
123
|
-
return {
|
|
124
|
-
height: calcMainAxis(),
|
|
125
|
-
top: calcOffset(),
|
|
126
|
-
background: activeColor,
|
|
127
|
-
transition: dragStatus ? "none" : void 0
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
width: calcMainAxis(),
|
|
132
|
-
left: calcOffset(),
|
|
133
|
-
background: activeColor,
|
|
134
|
-
transition: dragStatus ? "none" : void 0
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
const marksStyle = (mark) => {
|
|
138
|
-
let style = {
|
|
139
|
-
left: `${(mark - Number(min)) / scope() * 100}%`
|
|
140
|
-
};
|
|
141
|
-
if (vertical) {
|
|
142
|
-
style = {
|
|
143
|
-
top: `${(mark - Number(min)) / scope() * 100}%`
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
return style;
|
|
147
|
-
};
|
|
148
|
-
const tickStyle = (mark) => {
|
|
149
|
-
let lowerBound = Number(min);
|
|
150
|
-
let upperBound = Number(max);
|
|
151
|
-
if (range) {
|
|
152
|
-
const [left, right] = modelValue;
|
|
153
|
-
lowerBound = left;
|
|
154
|
-
upperBound = right;
|
|
155
|
-
}
|
|
156
|
-
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
157
|
-
const style = {
|
|
158
|
-
background: !isActive ? inactiveColor : activeColor
|
|
159
|
-
};
|
|
160
|
-
return style;
|
|
161
|
-
};
|
|
162
|
-
const format = (value) => {
|
|
163
|
-
value = Math.max(+min, Math.min(value, +max));
|
|
164
|
-
return Math.round(value / +step) * +step;
|
|
165
|
-
};
|
|
166
|
-
const isSameValue = (newValue, oldValue) => {
|
|
167
|
-
return JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
168
|
-
};
|
|
169
|
-
const handleOverlap = (value) => {
|
|
170
|
-
if (value[0] > value[1]) {
|
|
171
|
-
return value.slice(0).reverse();
|
|
172
|
-
}
|
|
173
|
-
return value;
|
|
174
|
-
};
|
|
175
|
-
const updateValue = (value, end) => {
|
|
176
|
-
if (isRange(value)) {
|
|
177
|
-
value = handleOverlap(value).map(format);
|
|
178
|
-
} else {
|
|
179
|
-
value = format(value);
|
|
180
|
-
}
|
|
181
|
-
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
182
|
-
if (!isSameValue(value, modelVal)) {
|
|
183
|
-
SetInitValue(value);
|
|
184
|
-
}
|
|
185
|
-
if ((marks || end) && !isSameValue(value, startValue)) {
|
|
186
|
-
onChange && onChange(value);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const click = async (event) => {
|
|
190
|
-
if (disabled || !root.current) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
SetDragStatus("");
|
|
194
|
-
const rect = await getRectByTaro(root.current);
|
|
195
|
-
let delta = (event.detail.x ? event.detail.x : event.clientX) - rect.left;
|
|
196
|
-
let total = rect.width;
|
|
197
|
-
if (vertical) {
|
|
198
|
-
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
199
|
-
total = rect.height;
|
|
200
|
-
}
|
|
201
|
-
const value = Number(min) + delta / total * scope();
|
|
202
|
-
currentValue = initValue || initValue === 0 ? initValue : modelValue;
|
|
203
|
-
if (isRange(currentValue)) {
|
|
204
|
-
const [left, right] = currentValue;
|
|
205
|
-
const middle = (left + right) / 2;
|
|
206
|
-
if (value <= middle) {
|
|
207
|
-
updateValue([value, right], true);
|
|
208
|
-
} else {
|
|
209
|
-
updateValue([left, value], true);
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
updateValue(value, true);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const onTouchStart = (event) => {
|
|
216
|
-
if (disabled) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
touch.start(event);
|
|
220
|
-
currentValue = initValue || initValue === 0 ? initValue : modelValue;
|
|
221
|
-
if (isRange(currentValue)) {
|
|
222
|
-
startValue = currentValue.map(format);
|
|
223
|
-
} else {
|
|
224
|
-
startValue = format(currentValue);
|
|
225
|
-
}
|
|
226
|
-
SetDragStatus("start");
|
|
227
|
-
};
|
|
228
|
-
const onTouchMove = async (event) => {
|
|
229
|
-
if (disabled || !root.current) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (dragStatus === "start") {
|
|
233
|
-
dragStart && dragStart();
|
|
234
|
-
onDragStart && onDragStart();
|
|
235
|
-
}
|
|
236
|
-
touch.move(event);
|
|
237
|
-
SetDragStatus("draging");
|
|
238
|
-
const rect = await getRectByTaro(root.current);
|
|
239
|
-
let delta = touch.deltaX;
|
|
240
|
-
let total = rect.width;
|
|
241
|
-
let diff = delta / total * scope();
|
|
242
|
-
if (vertical) {
|
|
243
|
-
delta = touch.deltaY;
|
|
244
|
-
total = rect.height;
|
|
245
|
-
diff = delta / total * scope();
|
|
246
|
-
}
|
|
247
|
-
if (isRange(startValue)) {
|
|
248
|
-
currentValue[buttonIndex] = startValue[buttonIndex] + diff;
|
|
249
|
-
} else {
|
|
250
|
-
currentValue = startValue + diff;
|
|
251
|
-
}
|
|
252
|
-
updateValue(currentValue);
|
|
253
|
-
};
|
|
254
|
-
const onTouchEnd = (event) => {
|
|
255
|
-
if (disabled) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
if (dragStatus === "draging") {
|
|
259
|
-
updateValue(currentValue, true);
|
|
260
|
-
dragEnd && dragEnd();
|
|
261
|
-
onDragEnd && onDragEnd();
|
|
262
|
-
}
|
|
263
|
-
SetDragStatus("");
|
|
264
|
-
};
|
|
265
|
-
const curValue = (idx) => {
|
|
266
|
-
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
267
|
-
const value = typeof idx === "number" ? modelVal[idx] : modelVal;
|
|
268
|
-
return value;
|
|
269
|
-
};
|
|
270
|
-
return React.createElement(
|
|
271
|
-
"div",
|
|
272
|
-
{ className: `${containerName}` },
|
|
273
|
-
!hiddenRange ? React.createElement("div", { className: "min" }, minDesc || +min) : null,
|
|
274
|
-
React.createElement(
|
|
275
|
-
"div",
|
|
276
|
-
{ ref: root, style: wrapperStyle(), className: `${rangeName}`, onClick: (e) => {
|
|
277
|
-
click(e);
|
|
278
|
-
} },
|
|
279
|
-
marksList.length > 0 ? React.createElement("div", { className: "nut-range-mark" }, marksList.map((marks2) => {
|
|
280
|
-
return React.createElement(
|
|
281
|
-
"span",
|
|
282
|
-
{ key: marks2, className: markClassName(marks2), style: marksStyle(marks2) },
|
|
283
|
-
marks2,
|
|
284
|
-
React.createElement("span", { className: "nut-range-tick", style: tickStyle(marks2) })
|
|
285
|
-
);
|
|
286
|
-
})) : null,
|
|
287
|
-
React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range ? [0, 1].map((item, index) => {
|
|
288
|
-
return React.createElement("div", { role: "slider", key: index, className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
289
|
-
${index === 1 ? "nut-range-button-wrapper-right" : ""}`, tabIndex: disabled ? -1 : 0, "aria-valuemin": +min, "aria-valuenow": curValue(index), "aria-valuemax": +max, "aria-orientation": vertical ? "vertical" : "horizontal", onTouchStart: (e) => {
|
|
290
|
-
if (typeof index === "number") {
|
|
291
|
-
SetButtonIndex(index);
|
|
292
|
-
}
|
|
293
|
-
onTouchStart(e);
|
|
294
|
-
}, onTouchMove: (e) => {
|
|
295
|
-
onTouchMove(e);
|
|
296
|
-
}, onTouchEnd: (e) => {
|
|
297
|
-
onTouchEnd();
|
|
298
|
-
}, onTouchCancel: (e) => {
|
|
299
|
-
onTouchEnd();
|
|
300
|
-
}, onClick: (e) => {
|
|
301
|
-
e.stopPropagation();
|
|
302
|
-
} }, button || React.createElement("div", { className: "nut-range-button", style: buttonStyle() }, !hiddenTag ? React.createElement("div", { className: "number" }, curValueDesc || curValue(index)) : null));
|
|
303
|
-
}) : React.createElement("div", { role: "slider", className: "nut-range-button-wrapper", tabIndex: disabled ? -1 : 0, "aria-valuemin": +min, "aria-valuenow": curValue(), "aria-valuemax": +max, "aria-orientation": vertical ? "vertical" : "horizontal", onTouchStart: (e) => {
|
|
304
|
-
onTouchStart(e);
|
|
305
|
-
}, onTouchMove: (e) => {
|
|
306
|
-
onTouchMove(e);
|
|
307
|
-
}, onTouchEnd: (e) => {
|
|
308
|
-
onTouchEnd();
|
|
309
|
-
}, onTouchCancel: (e) => {
|
|
310
|
-
onTouchEnd();
|
|
311
|
-
}, onClick: (e) => {
|
|
312
|
-
e.stopPropagation();
|
|
313
|
-
} }, button || React.createElement("div", { className: "nut-range-button", style: buttonStyle() }, !hiddenTag ? React.createElement("div", { className: "number" }, curValueDesc || curValue()) : null)))
|
|
314
|
-
),
|
|
315
|
-
!hiddenRange ? React.createElement("div", { className: "max" }, maxDesc || +max) : null,
|
|
316
|
-
React.createElement(Toast, { type: "text", visible: show, msg: toastMsg, onClose: () => {
|
|
317
|
-
SetShow(false);
|
|
318
|
-
} })
|
|
319
|
-
);
|
|
320
|
-
};
|
|
321
|
-
Range.defaultProps = defaultProps;
|
|
322
|
-
Range.displayName = "NutRange";
|
|
323
|
-
export {
|
|
324
|
-
Range as R
|
|
325
|
-
};
|