@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/esm/Audio.js +7 -6
  3. package/dist/esm/Cascader.js +2 -2
  4. package/dist/esm/ImagePreview.js +1 -1
  5. package/dist/esm/Range/style/index.js +1 -1
  6. package/dist/esm/Range.js +5 -7
  7. package/dist/esm/Step.js +1 -1
  8. package/dist/esm/Steps.js +1 -1
  9. package/dist/esm/Swiper.js +1 -1
  10. package/dist/esm/SwiperItem.js +1 -1
  11. package/dist/esm/Tabs.js +1 -1
  12. package/dist/esm/{audio.taro-ec96ef80.js → audio.taro-bbd39f93.js} +2 -2
  13. package/dist/esm/{cascader.taro-0a2694ed.js → cascader.taro-fb7a0230.js} +21 -13
  14. package/dist/esm/nutui-react.es.js +5 -5
  15. package/dist/esm/range.taro-615e193a.js +259 -0
  16. package/dist/esm/step.taro-3bc01c0c.js +1 -1
  17. package/dist/esm/steps.taro-77e301ab.js +1 -1
  18. package/dist/esm/swiper.taro-74cf9306.js +1 -1
  19. package/dist/esm/swiperitem-80df464a.js +1 -1
  20. package/dist/esm/{tabs.taro-b75f20ff.js → tabs.taro-66164782.js} +8 -1
  21. package/dist/locales/base.js +1 -1
  22. package/dist/locales/en-US.js +1 -1
  23. package/dist/locales/id-ID.js +1 -1
  24. package/dist/locales/zh-CN.js +1 -1
  25. package/dist/locales/zh-TW.js +1 -1
  26. package/dist/locales/zh-UG.js +1 -1
  27. package/dist/nutui.react.mjs +408 -483
  28. package/dist/nutui.react.umd.js +408 -483
  29. package/dist/packages/range/range.scss +24 -49
  30. package/dist/style.css +1 -1
  31. package/dist/style.mjs +1 -1
  32. package/dist/styles/variables-jmapp.scss +11 -17
  33. package/dist/styles/variables.scss +11 -14
  34. package/dist/types/index.d.ts +20 -26
  35. package/package.json +1 -1
  36. package/dist/esm/range.taro-52cda918.js +0 -325
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v2.0.0-alpha.8
2
+ `2023-05-12`
3
+ * :sparkles:feat: cascader支持受控 (#1000) @xiaoyatong
4
+ * :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
5
+ * 🛠 refactor: Range (#991) @Eiinu
6
+
1
7
  # v2.0.0-alpha.7
2
8
  `2023-05-12`
3
9
  * :bug: fix: tabs children 变化需要更新选中状态 @oasis-cloud
package/dist/esm/Audio.js CHANGED
@@ -1,17 +1,18 @@
1
- import { A as Audio } from "./audio.taro-ec96ef80.js";
1
+ import { A as Audio } from "./audio.taro-bbd39f93.js";
2
2
  import "react";
3
3
  import "@tarojs/taro";
4
4
  import "@nutui/icons-react-taro";
5
- import "./range.taro-52cda918.js";
5
+ import "./range.taro-615e193a.js";
6
+ import "classnames";
7
+ import "@tarojs/components";
6
8
  import "./use-touch-ff43512c.js";
7
9
  import "./use-client-rect-f317804e.js";
8
- import "./toast.taro-92c10e1d.js";
9
- import "classnames";
10
+ import "./typings-11d83a22.js";
11
+ import "./use-props-value-7ac1b1b5.js";
12
+ import "./button.taro-01eae688.js";
10
13
  import "./bem-cdccae08.js";
11
14
  import "@bem-react/classname";
12
15
  import "./configprovider.taro-25758d9f.js";
13
- import "./button.taro-01eae688.js";
14
- import "./typings-11d83a22.js";
15
16
  export {
16
17
  Audio as default
17
18
  };
@@ -1,4 +1,4 @@
1
- import { C as Cascader } from "./cascader.taro-0a2694ed.js";
1
+ import { C as Cascader } from "./cascader.taro-fb7a0230.js";
2
2
  import "react";
3
3
  import "classnames";
4
4
  import "./popup.taro-e756f3fc.js";
@@ -8,7 +8,7 @@ import "@nutui/icons-react-taro";
8
8
  import "@tarojs/components";
9
9
  import "./overlay.taro-75012bd3.js";
10
10
  import "./typings-11d83a22.js";
11
- import "./tabs.taro-b75f20ff.js";
11
+ import "./tabs.taro-66164782.js";
12
12
  import "./tabpane.taro-f8d92ece.js";
13
13
  import "./use-props-value-7ac1b1b5.js";
14
14
  export {
@@ -10,7 +10,7 @@ import "./overlay.taro-75012bd3.js";
10
10
  import "./typings-11d83a22.js";
11
11
  import "./swiper.taro-74cf9306.js";
12
12
  import "@tarojs/taro";
13
- import "./UserContext-735db09f.js";
13
+ import "./UserContext-fde5badc.js";
14
14
  import "./bem-cdccae08.js";
15
15
  import "@bem-react/classname";
16
16
  import "./swiperitem-80df464a.js";
@@ -1,2 +1,2 @@
1
- import '../../Toast/style'
1
+
2
2
  import '../../../packages/range/range.scss'
package/dist/esm/Range.js CHANGED
@@ -1,13 +1,11 @@
1
- import { R as Range } from "./range.taro-52cda918.js";
1
+ import { R as Range } from "./range.taro-615e193a.js";
2
2
  import "react";
3
+ import "classnames";
4
+ import "@tarojs/components";
3
5
  import "./use-touch-ff43512c.js";
4
6
  import "./use-client-rect-f317804e.js";
5
- import "./toast.taro-92c10e1d.js";
6
- import "classnames";
7
- import "@nutui/icons-react-taro";
8
- import "./bem-cdccae08.js";
9
- import "@bem-react/classname";
10
- import "./configprovider.taro-25758d9f.js";
7
+ import "./typings-11d83a22.js";
8
+ import "./use-props-value-7ac1b1b5.js";
11
9
  export {
12
10
  Range as default
13
11
  };
package/dist/esm/Step.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { S as Step } from "./step.taro-3bc01c0c.js";
2
2
  import "react";
3
3
  import "classnames";
4
- import "./UserContext-fde5badc.js";
4
+ import "./UserContext-735db09f.js";
5
5
  import "./bem-cdccae08.js";
6
6
  import "@bem-react/classname";
7
7
  import "./typings-11d83a22.js";
package/dist/esm/Steps.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { S as Steps } from "./steps.taro-77e301ab.js";
2
2
  import "react";
3
3
  import "classnames";
4
- import "./UserContext-fde5badc.js";
4
+ import "./UserContext-735db09f.js";
5
5
  import "./bem-cdccae08.js";
6
6
  import "@bem-react/classname";
7
7
  export {
@@ -2,7 +2,7 @@ import { S as Swiper } from "./swiper.taro-74cf9306.js";
2
2
  import "react";
3
3
  import "classnames";
4
4
  import "@tarojs/taro";
5
- import "./UserContext-735db09f.js";
5
+ import "./UserContext-fde5badc.js";
6
6
  import "./bem-cdccae08.js";
7
7
  import "@bem-react/classname";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  import { S as SwiperItem } from "./swiperitem-80df464a.js";
2
2
  import "react";
3
3
  import "classnames";
4
- import "./UserContext-735db09f.js";
4
+ import "./UserContext-fde5badc.js";
5
5
  import "./bem-cdccae08.js";
6
6
  import "@bem-react/classname";
7
7
  export {
package/dist/esm/Tabs.js CHANGED
@@ -1,4 +1,4 @@
1
- import { T as Tabs } from "./tabs.taro-b75f20ff.js";
1
+ import { T as Tabs } from "./tabs.taro-66164782.js";
2
2
  import "react";
3
3
  import "@tarojs/components";
4
4
  import "classnames";
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useRef } from "react";
2
2
  import { createInnerAudioContext } from "@tarojs/taro";
3
3
  import { Service } from "@nutui/icons-react-taro";
4
- import { R as Range } from "./range.taro-52cda918.js";
4
+ import { R as Range } from "./range.taro-615e193a.js";
5
5
  import { B as Button } from "./button.taro-01eae688.js";
6
6
  import { c as cn } from "./bem-cdccae08.js";
7
7
  import { u as useConfig } from "./configprovider.taro-25758d9f.js";
@@ -148,7 +148,7 @@ const Audio = (props) => {
148
148
  React.createElement(
149
149
  "div",
150
150
  { className: b("progress-bar-wrapper") },
151
- React.createElement(Range, { modelValue: percent, hiddenTag: true, hiddenRange: true, "inactive-color": "#cccccc", "active-color": "#fa2c19" })
151
+ React.createElement(Range, { value: percent, onChange: (val) => setPercent(val), currentDescription: null, maxDescription: null, minDescription: null, "inactive-color": "#cccccc", "active-color": "#fa2c19" })
152
152
  ),
153
153
  React.createElement("div", { className: "time" }, formatSeconds(`${totalSeconds}`) || "00:00:00")
154
154
  ),
@@ -7,9 +7,10 @@ var __publicField = (obj, key, value) => {
7
7
  import React, { isValidElement, useState, useEffect } from "react";
8
8
  import classNames from "classnames";
9
9
  import { P as Popup } from "./popup.taro-e756f3fc.js";
10
- import { T as Tabs } from "./tabs.taro-b75f20ff.js";
10
+ import { T as Tabs } from "./tabs.taro-66164782.js";
11
11
  import { Loading, Checklist } from "@nutui/icons-react-taro";
12
12
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
13
+ import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
13
14
  const defaultProps$1 = {
14
15
  data: {
15
16
  text: "",
@@ -191,7 +192,6 @@ const defaultProps = {
191
192
  popup: true,
192
193
  visible: false,
193
194
  options: [],
194
- value: [],
195
195
  title: "",
196
196
  optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
197
197
  format: {},
@@ -206,14 +206,22 @@ const defaultProps = {
206
206
  onChange: () => {
207
207
  },
208
208
  onPathChange: () => {
209
- },
210
- ...Popup.defaultProps
209
+ }
211
210
  };
212
211
  const InternalCascader = (props, ref) => {
213
- const { className, style, popup, visible, options, value, title, optionKey, format, closeable, closeIconPosition, closeIcon, lazy, onLoad, onClose, onChange, onPathChange } = { ...defaultProps, ...props };
212
+ const { className, style, popup, visible, options, value, defaultValue, title, optionKey, format, closeable, closeIconPosition, closeIcon, lazy, onLoad, onClose, onChange, onPathChange } = { ...defaultProps, ...props };
214
213
  const [tabvalue, setTabvalue] = useState("c1");
215
214
  const [optionsData, setOptionsData] = useState([]);
216
215
  const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
216
+ const [innerValue, setInnerValue] = usePropsValue({
217
+ value,
218
+ defaultValue,
219
+ finalValue: defaultValue,
220
+ onChange: (val) => {
221
+ var _a;
222
+ (_a = props.onChange) == null ? void 0 : _a.call(props, val);
223
+ }
224
+ });
217
225
  const [state] = useState({
218
226
  optionsData: [],
219
227
  panes: [
@@ -223,7 +231,6 @@ const InternalCascader = (props, ref) => {
223
231
  paneKey: ""
224
232
  }
225
233
  ],
226
- innerValue: value,
227
234
  tree: new Tree$1([], {}),
228
235
  tabsCursor: 0,
229
236
  initLoading: false,
@@ -242,12 +249,12 @@ const InternalCascader = (props, ref) => {
242
249
  });
243
250
  useEffect(() => {
244
251
  initData();
245
- }, [options]);
252
+ }, [options, format]);
246
253
  useEffect(() => {
247
- if (value !== state.innerValue) {
248
- state.innerValue = value;
254
+ if (defaultValue && defaultValue !== innerValue) {
255
+ setInnerValue(defaultValue);
249
256
  }
250
- }, [value]);
257
+ }, [defaultValue]);
251
258
  const initData = async () => {
252
259
  state.lazyLoadMap.clear();
253
260
  if (format && Object.keys(format).length > 0) {
@@ -279,8 +286,8 @@ const InternalCascader = (props, ref) => {
279
286
  setOptionsData(state.panes);
280
287
  };
281
288
  const syncValue = async () => {
282
- const currentValue = state.innerValue;
283
- if (currentValue === void 0 || !state.tree.nodes.length) {
289
+ const currentValue = innerValue;
290
+ if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
284
291
  return;
285
292
  }
286
293
  if (currentValue.length === 0) {
@@ -308,7 +315,7 @@ const InternalCascader = (props, ref) => {
308
315
  state.initLoading = false;
309
316
  }
310
317
  }
311
- if (needToSync.length && currentValue === value) {
318
+ if (needToSync.length && currentValue === defaultValue) {
312
319
  const pathNodes = state.tree.getPathNodesByValue(needToSync);
313
320
  pathNodes.forEach((node, index) => {
314
321
  state.tabsCursor = index;
@@ -365,6 +372,7 @@ const InternalCascader = (props, ref) => {
365
372
  const optionParams = pathNodes.map((item) => item.value);
366
373
  onChange(optionParams, pathNodes);
367
374
  onPathChange(optionParams, pathNodes);
375
+ setInnerValue(optionParams);
368
376
  }
369
377
  setOptionsData(state.panes);
370
378
  close();
@@ -21,11 +21,11 @@ import { S as S4 } from "./subsidenavbar.taro-abe07673.js";
21
21
  import { T } from "./tabbar.taro-18eee41f.js";
22
22
  import { T as T2 } from "./tabbaritem.taro-89646ca1.js";
23
23
  import { T as T3 } from "./tabpane.taro-f8d92ece.js";
24
- import { T as T4 } from "./tabs.taro-b75f20ff.js";
24
+ import { T as T4 } from "./tabs.taro-66164782.js";
25
25
  import { A } from "./address.taro-1c534feb.js";
26
26
  import { C as C5 } from "./calendar.taro-10a6cb11.js";
27
27
  import { C as C6 } from "./calendaritem.taro-3e5f114e.js";
28
- import { C as C7 } from "./cascader.taro-0a2694ed.js";
28
+ import { C as C7 } from "./cascader.taro-fb7a0230.js";
29
29
  import { C as C8, a } from "./checkbox.taro-016074da.js";
30
30
  import { D as D2 } from "./datepicker.taro-3f718964.js";
31
31
  import { F as F2 } from "./form.taro-b06754e8.js";
@@ -37,7 +37,7 @@ import { M as M2 } from "./menuitem.taro-6076bffa.js";
37
37
  import { N as N2 } from "./numberkeyboard.taro-0a0e866a.js";
38
38
  import { P } from "./picker.taro-a5603921.js";
39
39
  import { R as R2, a as a2 } from "./radio.taro-3a54f4c8.js";
40
- import { R as R3 } from "./range.taro-52cda918.js";
40
+ import { R as R3 } from "./range.taro-615e193a.js";
41
41
  import { R as R4 } from "./rate.taro-78c66969.js";
42
42
  import { S as S5 } from "./searchbar.taro-37ade36e.js";
43
43
  import { S as S6 } from "./shortpassword.taro-f7292032.js";
@@ -61,7 +61,7 @@ import { P as P4 } from "./popup.taro-e756f3fc.js";
61
61
  import { T as T6 } from "./toast.taro-92c10e1d.js";
62
62
  import { A as A3 } from "./animate.taro-c8b29242.js";
63
63
  import { A as A4 } from "./animatingnumbers.taro-c2a52dbd.js";
64
- import { A as A5 } from "./audio.taro-ec96ef80.js";
64
+ import { A as A5 } from "./audio.taro-bbd39f93.js";
65
65
  import { A as A6 } from "./avatar.taro-01536aff.js";
66
66
  import { A as A7 } from "./avatargroup-ad5ffb46.js";
67
67
  import { C as C9 } from "./circleprogress.taro-7149e09d.js";
@@ -112,8 +112,8 @@ import "@use-gesture/react";
112
112
  import "@react-spring/web";
113
113
  import "react-dom";
114
114
  import "./context-d0fccf11.js";
115
- import "./UserContext-fde5badc.js";
116
115
  import "./UserContext-735db09f.js";
116
+ import "./UserContext-fde5badc.js";
117
117
  export {
118
118
  A2 as ActionSheet,
119
119
  A as Address,
@@ -0,0 +1,259 @@
1
+ import React, { useState, useRef, useEffect, useCallback } from "react";
2
+ import classNames from "classnames";
3
+ import { View } from "@tarojs/components";
4
+ import { u as useTouch } from "./use-touch-ff43512c.js";
5
+ import { g as getRectByTaro } from "./use-client-rect-f317804e.js";
6
+ import { C as ComponentDefaults } from "./typings-11d83a22.js";
7
+ import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
8
+ const defaultProps = {
9
+ ...ComponentDefaults,
10
+ range: false,
11
+ min: 0,
12
+ max: 100,
13
+ step: 1,
14
+ vertical: false,
15
+ marks: {}
16
+ };
17
+ const Range = (props) => {
18
+ const { className, range, disabled, button, vertical, marks, onChange, onStart, onEnd, minDescription, maxDescription, currentDescription, min, max, step, value, defaultValue } = { ...defaultProps, ...props };
19
+ const classPrefix = "nut-range";
20
+ const [buttonIndex, setButtonIndex] = useState(0);
21
+ const [dragStatus, setDragStatus] = useState("start");
22
+ const touch = useTouch();
23
+ const root = useRef(null);
24
+ const [marksList, setMarksList] = useState([]);
25
+ const [startValue, setStartValue] = useState(0);
26
+ const handleChange = (value2) => {
27
+ onChange && onChange(value2);
28
+ };
29
+ const [current, setCurrent] = usePropsValue({
30
+ value,
31
+ defaultValue,
32
+ finalValue: 0,
33
+ onChange: handleChange
34
+ });
35
+ const [exactValue, setEaxctValue] = useState(() => value || defaultValue || 0);
36
+ useEffect(() => {
37
+ if (marks) {
38
+ const marksKeys = Object.keys(marks);
39
+ const list = marksKeys.map(parseFloat).sort((a, b) => a - b).filter((point) => point >= min && point <= max);
40
+ setMarksList(list);
41
+ }
42
+ }, [marks]);
43
+ const scope = () => {
44
+ return max - min;
45
+ };
46
+ const classes = classNames(classPrefix, {
47
+ [`${classPrefix}-disabled`]: disabled,
48
+ [`${classPrefix}-vertical`]: vertical
49
+ });
50
+ const containerClasses = classNames(`${classPrefix}-container`, className, {
51
+ [`${classPrefix}-container-vertical`]: vertical
52
+ });
53
+ const markClassName = useCallback((mark) => {
54
+ const classPrefix2 = "nut-range-mark";
55
+ let lowerBound = min;
56
+ let upperBound = max;
57
+ if (range && Array.isArray(current)) {
58
+ lowerBound = current[0];
59
+ upperBound = current[1];
60
+ } else {
61
+ upperBound = current;
62
+ }
63
+ const isActive = mark <= upperBound && mark >= lowerBound;
64
+ return [
65
+ `${classPrefix2}-text`,
66
+ `${isActive ? `${classPrefix2}-text-active` : ""}`
67
+ ].join(" ");
68
+ }, [range, current, min, max]);
69
+ const isRange = (val) => {
70
+ return !!range && Array.isArray(val);
71
+ };
72
+ const calcMainAxis = () => {
73
+ const modelVal = current;
74
+ if (isRange(modelVal)) {
75
+ return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
76
+ }
77
+ return `${(modelVal - min) * 100 / scope()}%`;
78
+ };
79
+ const calcOffset = () => {
80
+ const modelVal = current;
81
+ if (isRange(modelVal)) {
82
+ return `${(modelVal[0] - min) * 100 / scope()}%`;
83
+ }
84
+ return `0%`;
85
+ };
86
+ const barStyle = () => {
87
+ if (vertical) {
88
+ return {
89
+ height: calcMainAxis(),
90
+ top: calcOffset(),
91
+ transition: dragStatus ? "none" : void 0
92
+ };
93
+ }
94
+ return {
95
+ width: calcMainAxis(),
96
+ left: calcOffset(),
97
+ transition: dragStatus ? "none" : void 0
98
+ };
99
+ };
100
+ const marksStyle = (mark) => {
101
+ let style = {
102
+ left: `${(mark - min) / scope() * 100}%`
103
+ };
104
+ if (vertical) {
105
+ style = {
106
+ top: `${(mark - min) / scope() * 100}%`
107
+ };
108
+ }
109
+ return style;
110
+ };
111
+ const tickClass = (mark) => {
112
+ if (range && Array.isArray(current)) {
113
+ return mark <= current[1] && mark >= current[0];
114
+ }
115
+ return mark <= current;
116
+ };
117
+ const format = (value2) => {
118
+ value2 = Math.max(+min, Math.min(value2, +max));
119
+ return Math.round(value2 / +step) * +step;
120
+ };
121
+ const isSameValue = (newValue, oldValue) => {
122
+ return JSON.stringify(newValue) === JSON.stringify(oldValue);
123
+ };
124
+ const handleOverlap = (value2) => {
125
+ if (value2[0] > value2[1]) {
126
+ return value2.slice(0).reverse();
127
+ }
128
+ return value2;
129
+ };
130
+ const updateValue = (value2, end) => {
131
+ if (isRange(value2)) {
132
+ value2 = handleOverlap(value2).map(format);
133
+ } else {
134
+ value2 = format(value2);
135
+ }
136
+ if (!isSameValue(value2, current)) {
137
+ setCurrent(value2);
138
+ }
139
+ end && onEnd && onEnd(value2);
140
+ };
141
+ const click = async (event) => {
142
+ if (disabled || !root.current) {
143
+ return;
144
+ }
145
+ setDragStatus("");
146
+ const rect = await getRectByTaro(root.current);
147
+ let delta = (event.detail.x ? event.detail.x : event.clientX) - rect.left;
148
+ let total = rect.width;
149
+ if (vertical) {
150
+ delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
151
+ total = rect.height;
152
+ }
153
+ const value2 = min + delta / total * scope();
154
+ setEaxctValue(current);
155
+ if (isRange(current)) {
156
+ const [left, right] = current;
157
+ const middle = (left + right) / 2;
158
+ if (value2 <= middle) {
159
+ updateValue([value2, right], true);
160
+ } else {
161
+ updateValue([left, value2], true);
162
+ }
163
+ } else {
164
+ updateValue(value2, true);
165
+ }
166
+ };
167
+ const onTouchStart = (event) => {
168
+ if (disabled) {
169
+ return;
170
+ }
171
+ touch.start(event);
172
+ setEaxctValue(current);
173
+ if (isRange(current)) {
174
+ setStartValue(current.map(format));
175
+ } else {
176
+ setStartValue(format(current));
177
+ }
178
+ setDragStatus("start");
179
+ };
180
+ const onTouchMove = async (event) => {
181
+ if (disabled || !root.current) {
182
+ return;
183
+ }
184
+ if (dragStatus === "start") {
185
+ onStart && onStart();
186
+ }
187
+ touch.move(event);
188
+ setDragStatus("draging");
189
+ const rect = await getRectByTaro(root.current);
190
+ let delta = touch.deltaX;
191
+ let total = rect.width;
192
+ let diff = delta / total * scope();
193
+ if (vertical) {
194
+ delta = touch.deltaY;
195
+ total = rect.height;
196
+ diff = delta / total * scope();
197
+ }
198
+ let newValue;
199
+ if (isRange(startValue)) {
200
+ newValue = exactValue.slice();
201
+ newValue[buttonIndex] = startValue[buttonIndex] + diff;
202
+ } else {
203
+ newValue = startValue + diff;
204
+ }
205
+ setEaxctValue(newValue);
206
+ updateValue(newValue);
207
+ };
208
+ const onTouchEnd = (event) => {
209
+ if (disabled) {
210
+ return;
211
+ }
212
+ if (dragStatus === "draging") {
213
+ updateValue(current, true);
214
+ }
215
+ setDragStatus("");
216
+ };
217
+ const curValue = (idx) => {
218
+ const modelVal = current;
219
+ const value2 = typeof idx === "number" ? modelVal[idx] : modelVal;
220
+ return value2;
221
+ };
222
+ const renderButton = (index) => {
223
+ return React.createElement(React.Fragment, null, button || React.createElement("div", { className: "nut-range-button" }, currentDescription !== null && React.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
224
+ };
225
+ return React.createElement(
226
+ "div",
227
+ { className: containerClasses },
228
+ minDescription !== null && React.createElement("div", { className: "min" }, minDescription || min),
229
+ React.createElement(
230
+ "div",
231
+ { ref: root, className: classes, onClick: (e) => click(e) },
232
+ marksList.length > 0 && React.createElement("div", { className: "nut-range-mark" }, marksList.map((marks2) => {
233
+ return React.createElement(
234
+ "span",
235
+ { key: marks2, className: markClassName(marks2), style: marksStyle(marks2) },
236
+ marks2,
237
+ React.createElement("span", { className: classNames("nut-range-tick", {
238
+ active: tickClass(marks2)
239
+ }) })
240
+ );
241
+ })),
242
+ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range ? [0, 1].map((item, index) => {
243
+ return React.createElement("div", { key: index, className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
244
+ ${index === 1 ? "nut-range-button-wrapper-right" : ""}`, onTouchStart: (e) => {
245
+ if (typeof index === "number") {
246
+ setButtonIndex(index);
247
+ }
248
+ onTouchStart(e);
249
+ }, onTouchMove: (e) => onTouchMove(e), onTouchEnd: (e) => onTouchEnd(), onTouchCancel: (e) => onTouchEnd(), onClick: (e) => e.stopPropagation() }, renderButton(index));
250
+ }) : React.createElement(View, { catchMove: true, className: "nut-range-button-wrapper", onTouchStart: (e) => onTouchStart(e), onTouchMove: (e) => onTouchMove(e), onTouchEnd: (e) => onTouchEnd(), onTouchCancel: (e) => onTouchEnd(), onClick: (e) => e.stopPropagation() }, renderButton()))
251
+ ),
252
+ maxDescription !== null && React.createElement("div", { className: "max" }, maxDescription || max)
253
+ );
254
+ };
255
+ Range.defaultProps = defaultProps;
256
+ Range.displayName = "NutRange";
257
+ export {
258
+ Range as R
259
+ };
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from "react";
2
2
  import classNames from "classnames";
3
- import { D as DataContext } from "./UserContext-fde5badc.js";
3
+ import { D as DataContext } from "./UserContext-735db09f.js";
4
4
  import { c as cn } from "./bem-cdccae08.js";
5
5
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
6
6
  const defaultProps = {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import classNames from "classnames";
3
- import { D as DataContext } from "./UserContext-fde5badc.js";
3
+ import { D as DataContext } from "./UserContext-735db09f.js";
4
4
  import { c as cn } from "./bem-cdccae08.js";
5
5
  const defaultProps = {
6
6
  current: 0,
@@ -1,7 +1,7 @@
1
1
  import React, { useRef, useState, useMemo, useEffect } from "react";
2
2
  import classNames from "classnames";
3
3
  import { nextTick, useReady, createSelectorQuery } from "@tarojs/taro";
4
- import { D as DataContext } from "./UserContext-735db09f.js";
4
+ import { D as DataContext } from "./UserContext-fde5badc.js";
5
5
  import { c as cn } from "./bem-cdccae08.js";
6
6
  const defaultProps = {
7
7
  width: typeof window === "object" ? window.innerWidth : 375,
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from "react";
2
2
  import classNames from "classnames";
3
- import { D as DataContext } from "./UserContext-735db09f.js";
3
+ import { D as DataContext } from "./UserContext-fde5badc.js";
4
4
  import { c as cn } from "./bem-cdccae08.js";
5
5
  const defaultProps = {
6
6
  direction: "horizontal"
@@ -5,6 +5,10 @@ import { JoySmile } from "@nutui/icons-react-taro";
5
5
  import { C as ComponentDefaults } from "./typings-11d83a22.js";
6
6
  import { T as TabPane } from "./tabpane.taro-f8d92ece.js";
7
7
  import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
8
+ function useForceUpdate() {
9
+ const [, updateState] = React.useState();
10
+ return React.useCallback(() => updateState({}), []);
11
+ }
8
12
  const defaultProps = {
9
13
  ...ComponentDefaults,
10
14
  tabStyle: {},
@@ -46,6 +50,7 @@ const Tabs = (props) => {
46
50
  return titles2;
47
51
  };
48
52
  const titles = useRef(getTitles());
53
+ const forceUpdate = useForceUpdate();
49
54
  useEffect(() => {
50
55
  titles.current = getTitles();
51
56
  let current = "";
@@ -54,8 +59,10 @@ const Tabs = (props) => {
54
59
  current = value;
55
60
  }
56
61
  });
57
- if (current !== "") {
62
+ if (current !== "" && current !== value) {
58
63
  setValue(current);
64
+ } else {
65
+ forceUpdate();
59
66
  }
60
67
  }, [children]);
61
68
  const classes = classNames(classPrefix, `${classPrefix}--${direction}`, className);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.0-alpha.7 Fri May 12 2023 15:37:20 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:29 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.0-alpha.7 Fri May 12 2023 15:37:20 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:29 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.0-alpha.7 Fri May 12 2023 15:37:20 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:29 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.0-alpha.7 Fri May 12 2023 15:37:20 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:29 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.0-alpha.7 Fri May 12 2023 15:37:20 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:29 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */