@nutui/nutui-react-taro 2.0.21 → 2.0.22-beta.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/CHANGELOG.md +11 -0
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +4 -4
- package/dist/esm/Audio.js +3 -3
- package/dist/esm/Avatar.js +2 -2
- package/dist/esm/Calendar.js +3 -3
- package/dist/esm/CalendarItem.js +2 -2
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +3 -3
- package/dist/esm/Checkbox.js +2 -2
- package/dist/esm/CheckboxGroup.js +2 -2
- package/dist/esm/Collapse.js +2 -2
- package/dist/esm/DatePicker.js +3 -3
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/Image.js +1 -1
- package/dist/esm/ImagePreview.js +3 -3
- package/dist/esm/Input.js +2 -2
- package/dist/esm/InputNumber.js +2 -2
- package/dist/esm/Menu.js +3 -3
- package/dist/esm/MenuItem.js +2 -2
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/Pagination.js +2 -2
- package/dist/esm/Picker.js +2 -2
- package/dist/esm/Radio.js +2 -2
- package/dist/esm/RadioGroup.js +2 -2
- package/dist/esm/Range.js +2 -2
- package/dist/esm/Rate.js +2 -2
- package/dist/esm/ShortPassword.js +2 -2
- package/dist/esm/Skeleton.js +3 -3
- package/dist/esm/Swipe.js +1 -1
- package/dist/esm/Switch.js +2 -2
- package/dist/esm/TabPane/style/style.css +1 -1
- package/dist/esm/Tabbar.js +2 -2
- package/dist/esm/Tabs/style/style.css +1 -1
- package/dist/esm/Tabs.js +2 -2
- package/dist/esm/TextArea.js +2 -2
- package/dist/esm/Toast.js +2 -2
- package/dist/esm/Uploader.js +2 -2
- package/dist/esm/{address.taro-33910001.js → address.taro-4295c3b3.js} +2 -2
- package/dist/esm/{audio.taro-f0ec6410.js → audio.taro-abacd130.js} +1 -1
- package/dist/esm/{avatar.taro-1743c7c3.js → avatar.taro-68369036.js} +1 -1
- package/dist/esm/{calendar.taro-45a9c705.js → calendar.taro-802f92e1.js} +1 -1
- package/dist/esm/{calendaritem.taro-bc06f40f.js → calendaritem.taro-f1995224.js} +1 -1
- package/dist/esm/{cascader.taro-505e8467.js → cascader.taro-9070043a.js} +2 -2
- package/dist/esm/{checkbox.taro-22cd35c4.js → checkbox.taro-b113a84d.js} +1 -1
- package/dist/esm/{collapse.taro-4a3e417c.js → collapse.taro-341f8941.js} +1 -1
- package/dist/esm/{datepicker.taro-f0e1771a.js → datepicker.taro-59c99fd7.js} +2 -2
- package/dist/esm/{dialog.taro-ffad380a.js → dialog.taro-eb61fb7a.js} +1 -1
- package/dist/esm/{image.taro-fa4a92a1.js → image.taro-c2441b71.js} +1 -1
- package/dist/esm/{imagepreview.taro-8a715216.js → imagepreview.taro-8bbafaa4.js} +3 -3
- package/dist/esm/{input.taro-fbcb7090.js → input.taro-a71ef3d2.js} +2 -2
- package/dist/esm/{inputnumber.taro-d2fc26bd.js → inputnumber.taro-5f60d969.js} +1 -1
- package/dist/esm/{menu.taro-b54d3f8d.js → menu.taro-cad143e1.js} +1 -1
- package/dist/esm/{menuitem.taro-6455f170.js → menuitem.taro-60e01217.js} +1 -1
- package/dist/esm/{noticebar.taro-4e1d882b.js → noticebar.taro-bc771bc9.js} +2 -2
- package/dist/esm/nutui-react.es.js +32 -32
- package/dist/esm/{pagination.taro-47fad28d.js → pagination.taro-be383e8b.js} +1 -1
- package/dist/esm/{picker.taro-d731f062.js → picker.taro-11d54577.js} +1 -1
- package/dist/esm/{radio.taro-d1d370be.js → radio.taro-a1956aa2.js} +1 -1
- package/dist/esm/{range.taro-4028c748.js → range.taro-021442f5.js} +1 -1
- package/dist/esm/{rate.taro-61bbf5a7.js → rate.taro-8f34772f.js} +1 -1
- package/dist/esm/{shortpassword.taro-8e8c4102.js → shortpassword.taro-b01da5b3.js} +1 -1
- package/dist/esm/{skeleton.taro-5a621338.js → skeleton.taro-a0bb88d4.js} +1 -1
- package/dist/esm/{swipe.taro-385eece1.js → swipe.taro-3d5c4b51.js} +2 -2
- package/dist/esm/{switch.taro-74b2bd0a.js → switch.taro-1c7715e8.js} +1 -1
- package/dist/esm/{tabbar.taro-2bcdca7c.js → tabbar.taro-d7af9698.js} +1 -1
- package/dist/esm/{tabs.taro-3ece2221.js → tabs.taro-f4239f2d.js} +14 -48
- package/dist/esm/{textarea.taro-6ebe789c.js → textarea.taro-d1c63f86.js} +1 -1
- package/dist/esm/{toast.taro-50ee73e6.js → toast.taro-3bdf6d67.js} +1 -1
- package/dist/esm/types/src/packages/image/demo.taro.d.ts +0 -1
- package/dist/esm/types/src/utils/use-props-value.d.ts +1 -1
- package/dist/esm/{uploader.taro-69af92c4.js → uploader.taro-aa39a03f.js} +1 -1
- package/dist/esm/{use-props-value-c78cbf9b.js → use-props-value-7637d900.js} +3 -3
- 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/tr-TR.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.es.js +27 -58
- package/dist/nutui.react.umd.js +27 -58
- package/dist/packages/tabpane/tabpane.scss +0 -8
- package/dist/packages/tabs/tabs.scss +6 -8
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/utils/use-props-value.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { JoySmile } from "@nutui/icons-react-taro";
|
|
|
5
5
|
import Taro, { nextTick } from "@tarojs/taro";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
import { T as TabPane } from "./tabpane.taro-d0eea168.js";
|
|
8
|
-
import { u as usePropsValue } from "./use-props-value-
|
|
8
|
+
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
9
9
|
import { u as useForceUpdate } from "./use-force-update-9cd7c164.js";
|
|
10
10
|
import { r as requestAniFrame } from "./raf-a9ff50ad.js";
|
|
11
11
|
const defaultProps = {
|
|
@@ -84,24 +84,24 @@ const Tabs = (props) => {
|
|
|
84
84
|
};
|
|
85
85
|
const getAllRect = (selector) => {
|
|
86
86
|
return new Promise((resolve) => {
|
|
87
|
-
Taro.createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) =>
|
|
87
|
+
Taro.createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) => {
|
|
88
|
+
resolve(rect[0]);
|
|
89
|
+
});
|
|
88
90
|
});
|
|
89
91
|
};
|
|
90
92
|
const scrollWithAnimation = useRef(false);
|
|
91
93
|
const navRectRef = useRef();
|
|
92
94
|
const titleRectRef = useRef([]);
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
const scrollTop = useRef(0);
|
|
95
|
+
const [scrollLeft, setScrollLeft] = useState(0);
|
|
96
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
96
97
|
const scrollDirection = (to, direction2) => {
|
|
97
98
|
let count = 0;
|
|
98
|
-
const from = direction2 === "horizontal" ? scrollLeft.current : scrollTop.current;
|
|
99
99
|
const frames = 1;
|
|
100
100
|
function animate() {
|
|
101
101
|
if (direction2 === "horizontal") {
|
|
102
|
-
|
|
102
|
+
setScrollLeft(to);
|
|
103
103
|
} else {
|
|
104
|
-
|
|
104
|
+
setScrollTop(to);
|
|
105
105
|
}
|
|
106
106
|
if (++count < frames) {
|
|
107
107
|
requestAniFrame(animate);
|
|
@@ -114,37 +114,20 @@ const Tabs = (props) => {
|
|
|
114
114
|
return;
|
|
115
115
|
requestAniFrame(() => {
|
|
116
116
|
Promise.all([
|
|
117
|
-
getRect(`#nut-tabs__titles_${name}`),
|
|
117
|
+
getRect(`#nut-tabs__titles_${name} .nut-tabs__list`),
|
|
118
118
|
getAllRect(`#nut-tabs__titles_${name} .nut-tabs__titles-item`)
|
|
119
119
|
]).then(([navRect, titleRects]) => {
|
|
120
120
|
navRectRef.current = navRect;
|
|
121
121
|
titleRectRef.current = titleRects;
|
|
122
|
-
if (navRectRef.current) {
|
|
123
|
-
if (props.direction === "vertical") {
|
|
124
|
-
const titlesTotalHeight = titleRects.reduce((prev, curr) => prev + curr.height, 0);
|
|
125
|
-
if (titlesTotalHeight > navRectRef.current.height) {
|
|
126
|
-
canShowLabel.current = true;
|
|
127
|
-
} else {
|
|
128
|
-
canShowLabel.current = false;
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
const titlesTotalWidth = titleRects.reduce((prev, curr) => prev + curr.width, 0);
|
|
132
|
-
if (titlesTotalWidth > navRectRef.current.width) {
|
|
133
|
-
canShowLabel.current = true;
|
|
134
|
-
} else {
|
|
135
|
-
canShowLabel.current = false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
122
|
const titleRect = titleRectRef.current[value];
|
|
140
123
|
let to = 0;
|
|
141
124
|
if (props.direction === "vertical") {
|
|
142
125
|
const DEFAULT_PADDING = 11;
|
|
143
|
-
const top = titleRects.slice(0, value).reduce((prev, curr) => prev + curr.height
|
|
126
|
+
const top = titleRects.slice(0, value).reduce((prev, curr) => prev + curr.height, DEFAULT_PADDING);
|
|
144
127
|
to = top - (navRectRef.current.height - titleRect.height) / 2;
|
|
145
128
|
} else {
|
|
146
|
-
const DEFAULT_PADDING =
|
|
147
|
-
const left = titleRects.slice(0, value).reduce((prev, curr) => prev + curr.width
|
|
129
|
+
const DEFAULT_PADDING = 20;
|
|
130
|
+
const left = titleRects.slice(0, value).reduce((prev, curr) => prev + curr.width, DEFAULT_PADDING);
|
|
148
131
|
to = left - (navRectRef.current.width - titleRect.width) / 2;
|
|
149
132
|
}
|
|
150
133
|
nextTick(() => {
|
|
@@ -154,15 +137,12 @@ const Tabs = (props) => {
|
|
|
154
137
|
});
|
|
155
138
|
});
|
|
156
139
|
};
|
|
157
|
-
const scrollIntoRef = useRef(0);
|
|
158
140
|
useEffect(() => {
|
|
159
141
|
const index = titles.current.findIndex((t) => t.value === value);
|
|
160
142
|
setContentStyle({
|
|
161
143
|
transform: direction === "horizontal" ? `translate3d(-${index * 100}%, 0, 0)` : `translate3d( 0,-${index * 100}%, 0)`,
|
|
162
144
|
transitionDuration: `${duration}ms`
|
|
163
145
|
});
|
|
164
|
-
const scrollToIndex = index - 2;
|
|
165
|
-
scrollIntoRef.current = scrollToIndex < 0 ? 0 : scrollToIndex;
|
|
166
146
|
scrollIntoView();
|
|
167
147
|
}, [value]);
|
|
168
148
|
const tabChange = (item, index) => {
|
|
@@ -177,22 +157,8 @@ const Tabs = (props) => {
|
|
|
177
157
|
{ className: classes, ...rest },
|
|
178
158
|
React__default.createElement(
|
|
179
159
|
ScrollView,
|
|
180
|
-
{
|
|
181
|
-
|
|
182
|
-
scrollX: direction === "horizontal",
|
|
183
|
-
scrollY: direction === "vertical",
|
|
184
|
-
scrollLeft: scrollLeft.current,
|
|
185
|
-
scrollTop: scrollTop.current,
|
|
186
|
-
showScrollbar: false,
|
|
187
|
-
scrollIntoViewAlignment: "center",
|
|
188
|
-
scrollWithAnimation: scrollWithAnimation.current,
|
|
189
|
-
// scrollIntoView={`scrollIntoView${scrollIntoRef.current}`}
|
|
190
|
-
id: `nut-tabs__titles_${name}`,
|
|
191
|
-
className: classesTitle,
|
|
192
|
-
style: { ...tabStyle },
|
|
193
|
-
ref: navRef
|
|
194
|
-
},
|
|
195
|
-
React__default.createElement(View, { className: "nut-tabs__list" }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
|
|
160
|
+
{ enableFlex: true, scrollX: direction === "horizontal", scrollY: direction === "vertical", scrollLeft, scrollTop, showScrollbar: false, scrollWithAnimation: scrollWithAnimation.current, id: `nut-tabs__titles_${name}`, className: classesTitle, style: { ...tabStyle } },
|
|
161
|
+
React__default.createElement(View, { className: "nut-tabs__list", ref: navRef }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
|
|
196
162
|
return React__default.createElement(
|
|
197
163
|
View,
|
|
198
164
|
{ ref: (ref) => titleItemsRef.current.push(ref), id: `scrollIntoView${index}`, onClick: (e) => {
|
|
@@ -4,7 +4,7 @@ import Taro from "@tarojs/taro";
|
|
|
4
4
|
import { Textarea } from "@tarojs/components";
|
|
5
5
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
|
-
import { u as usePropsValue } from "./use-props-value-
|
|
7
|
+
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
8
8
|
const defaultProps = {
|
|
9
9
|
...ComponentDefaults,
|
|
10
10
|
defaultValue: "",
|
|
@@ -4,7 +4,7 @@ import { Success, Failure, Tips, Loading } from "@nutui/icons-react-taro";
|
|
|
4
4
|
import { O as Overlay } from "./overlay.taro-626840fc.js";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
6
|
import { u as useParams, a as useCustomEvent, b as useCustomEventsPath, c as customEvents } from "./use-custom-event-bb9c7f2e.js";
|
|
7
|
-
import { u as usePropsValue } from "./use-props-value-
|
|
7
|
+
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
8
8
|
const defaultProps = {
|
|
9
9
|
...ComponentDefaults,
|
|
10
10
|
id: "",
|
|
@@ -4,5 +4,5 @@ interface UsePropsValue<T> {
|
|
|
4
4
|
finalValue?: T;
|
|
5
5
|
onChange?: (value: T) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare function usePropsValue<T>({ value, defaultValue, finalValue, onChange, }: UsePropsValue<T>): [
|
|
7
|
+
export declare function usePropsValue<T>({ value, defaultValue, finalValue, onChange, }: UsePropsValue<T>): readonly [T, (v: T, forceTrigger?: boolean) => void];
|
|
8
8
|
export {};
|
|
@@ -12,7 +12,7 @@ import { B as Button } from "./button.taro-25f559e1.js";
|
|
|
12
12
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
13
13
|
import { i as isPromise } from "./index-e3184f19.js";
|
|
14
14
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
15
|
-
import { u as usePropsValue } from "./use-props-value-
|
|
15
|
+
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
16
16
|
import { Image } from "@tarojs/components";
|
|
17
17
|
import { P as Progress } from "./progress.taro-421575b9.js";
|
|
18
18
|
class UploadOptions {
|
|
@@ -8,13 +8,13 @@ function usePropsValue({ value, defaultValue, finalValue, onChange = (value2) =>
|
|
|
8
8
|
if (value !== void 0) {
|
|
9
9
|
stateRef.current = value;
|
|
10
10
|
}
|
|
11
|
-
const setState = useCallback((v) => {
|
|
11
|
+
const setState = useCallback((v, forceTrigger = false) => {
|
|
12
12
|
const prevState = stateRef.current;
|
|
13
13
|
stateRef.current = v;
|
|
14
|
-
if (prevState !== stateRef.current) {
|
|
14
|
+
if (prevState !== stateRef.current || forceTrigger) {
|
|
15
15
|
forceUpdate();
|
|
16
|
+
onChange == null ? void 0 : onChange(v);
|
|
16
17
|
}
|
|
17
|
-
onChange == null ? void 0 : onChange(v);
|
|
18
18
|
}, [value, onChange]);
|
|
19
19
|
return [stateRef.current, setState];
|
|
20
20
|
}
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED
package/dist/nutui.react.es.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
/*!
|
|
8
|
-
* @nutui/nutui-react-taro v2.0.
|
|
8
|
+
* @nutui/nutui-react-taro v2.0.22 Fri Oct 27 2023 18:00:59 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
@@ -3261,7 +3261,7 @@ const Image$1 = (props) => {
|
|
|
3261
3261
|
};
|
|
3262
3262
|
const containerStyle = {
|
|
3263
3263
|
// eslint-disable-next-line no-nested-ternary
|
|
3264
|
-
height: height ? pxCheck(height) : Taro.getEnv() === "WEB" ? "" : "
|
|
3264
|
+
height: height ? pxCheck(height) : Taro.getEnv() === "WEB" ? "" : "100%",
|
|
3265
3265
|
// eslint-disable-next-line no-nested-ternary
|
|
3266
3266
|
width: width ? pxCheck(width) : Taro.getEnv() === "WEB" ? "" : "100%",
|
|
3267
3267
|
overflow: radius !== void 0 && radius !== null ? "hidden" : "",
|
|
@@ -6432,13 +6432,13 @@ function usePropsValue({
|
|
|
6432
6432
|
stateRef.current = value;
|
|
6433
6433
|
}
|
|
6434
6434
|
const setState = useCallback(
|
|
6435
|
-
(v) => {
|
|
6435
|
+
(v, forceTrigger = false) => {
|
|
6436
6436
|
const prevState = stateRef.current;
|
|
6437
6437
|
stateRef.current = v;
|
|
6438
|
-
if (prevState !== stateRef.current) {
|
|
6438
|
+
if (prevState !== stateRef.current || forceTrigger) {
|
|
6439
6439
|
forceUpdate();
|
|
6440
|
+
onChange == null ? void 0 : onChange(v);
|
|
6440
6441
|
}
|
|
6441
|
-
onChange == null ? void 0 : onChange(v);
|
|
6442
6442
|
},
|
|
6443
6443
|
[value, onChange]
|
|
6444
6444
|
);
|
|
@@ -6736,24 +6736,24 @@ const Tabs = (props) => {
|
|
|
6736
6736
|
};
|
|
6737
6737
|
const getAllRect = (selector) => {
|
|
6738
6738
|
return new Promise((resolve) => {
|
|
6739
|
-
Taro.createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) =>
|
|
6739
|
+
Taro.createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) => {
|
|
6740
|
+
resolve(rect[0]);
|
|
6741
|
+
});
|
|
6740
6742
|
});
|
|
6741
6743
|
};
|
|
6742
6744
|
const scrollWithAnimation = useRef(false);
|
|
6743
6745
|
const navRectRef = useRef();
|
|
6744
6746
|
const titleRectRef = useRef([]);
|
|
6745
|
-
const
|
|
6746
|
-
const
|
|
6747
|
-
const scrollTop = useRef(0);
|
|
6747
|
+
const [scrollLeft, setScrollLeft] = useState(0);
|
|
6748
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
6748
6749
|
const scrollDirection = (to, direction2) => {
|
|
6749
6750
|
let count = 0;
|
|
6750
|
-
const from = direction2 === "horizontal" ? scrollLeft.current : scrollTop.current;
|
|
6751
6751
|
const frames = 1;
|
|
6752
6752
|
function animate() {
|
|
6753
6753
|
if (direction2 === "horizontal") {
|
|
6754
|
-
|
|
6754
|
+
setScrollLeft(to);
|
|
6755
6755
|
} else {
|
|
6756
|
-
|
|
6756
|
+
setScrollTop(to);
|
|
6757
6757
|
}
|
|
6758
6758
|
if (++count < frames) {
|
|
6759
6759
|
requestAniFrame$1(animate);
|
|
@@ -6766,47 +6766,24 @@ const Tabs = (props) => {
|
|
|
6766
6766
|
return;
|
|
6767
6767
|
requestAniFrame$1(() => {
|
|
6768
6768
|
Promise.all([
|
|
6769
|
-
getRect2(`#nut-tabs__titles_${name}`),
|
|
6769
|
+
getRect2(`#nut-tabs__titles_${name} .nut-tabs__list`),
|
|
6770
6770
|
getAllRect(`#nut-tabs__titles_${name} .nut-tabs__titles-item`)
|
|
6771
6771
|
]).then(([navRect, titleRects]) => {
|
|
6772
6772
|
navRectRef.current = navRect;
|
|
6773
6773
|
titleRectRef.current = titleRects;
|
|
6774
|
-
if (navRectRef.current) {
|
|
6775
|
-
if (props.direction === "vertical") {
|
|
6776
|
-
const titlesTotalHeight = titleRects.reduce(
|
|
6777
|
-
(prev, curr) => prev + curr.height,
|
|
6778
|
-
0
|
|
6779
|
-
);
|
|
6780
|
-
if (titlesTotalHeight > navRectRef.current.height) {
|
|
6781
|
-
canShowLabel.current = true;
|
|
6782
|
-
} else {
|
|
6783
|
-
canShowLabel.current = false;
|
|
6784
|
-
}
|
|
6785
|
-
} else {
|
|
6786
|
-
const titlesTotalWidth = titleRects.reduce(
|
|
6787
|
-
(prev, curr) => prev + curr.width,
|
|
6788
|
-
0
|
|
6789
|
-
);
|
|
6790
|
-
if (titlesTotalWidth > navRectRef.current.width) {
|
|
6791
|
-
canShowLabel.current = true;
|
|
6792
|
-
} else {
|
|
6793
|
-
canShowLabel.current = false;
|
|
6794
|
-
}
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6797
6774
|
const titleRect = titleRectRef.current[value];
|
|
6798
6775
|
let to = 0;
|
|
6799
6776
|
if (props.direction === "vertical") {
|
|
6800
6777
|
const DEFAULT_PADDING = 11;
|
|
6801
6778
|
const top = titleRects.slice(0, value).reduce(
|
|
6802
|
-
(prev, curr) => prev + curr.height
|
|
6779
|
+
(prev, curr) => prev + curr.height,
|
|
6803
6780
|
DEFAULT_PADDING
|
|
6804
6781
|
);
|
|
6805
6782
|
to = top - (navRectRef.current.height - titleRect.height) / 2;
|
|
6806
6783
|
} else {
|
|
6807
|
-
const DEFAULT_PADDING =
|
|
6784
|
+
const DEFAULT_PADDING = 20;
|
|
6808
6785
|
const left = titleRects.slice(0, value).reduce(
|
|
6809
|
-
(prev, curr) => prev + curr.width
|
|
6786
|
+
(prev, curr) => prev + curr.width,
|
|
6810
6787
|
DEFAULT_PADDING
|
|
6811
6788
|
);
|
|
6812
6789
|
to = left - (navRectRef.current.width - titleRect.width) / 2;
|
|
@@ -6818,15 +6795,12 @@ const Tabs = (props) => {
|
|
|
6818
6795
|
});
|
|
6819
6796
|
});
|
|
6820
6797
|
};
|
|
6821
|
-
const scrollIntoRef = useRef(0);
|
|
6822
6798
|
useEffect(() => {
|
|
6823
6799
|
const index = titles.current.findIndex((t) => t.value === value);
|
|
6824
6800
|
setContentStyle({
|
|
6825
6801
|
transform: direction === "horizontal" ? `translate3d(-${index * 100}%, 0, 0)` : `translate3d( 0,-${index * 100}%, 0)`,
|
|
6826
6802
|
transitionDuration: `${duration}ms`
|
|
6827
6803
|
});
|
|
6828
|
-
const scrollToIndex = index - 2;
|
|
6829
|
-
scrollIntoRef.current = scrollToIndex < 0 ? 0 : scrollToIndex;
|
|
6830
6804
|
scrollIntoView();
|
|
6831
6805
|
}, [value]);
|
|
6832
6806
|
const tabChange = (item, index) => {
|
|
@@ -6842,17 +6816,15 @@ const Tabs = (props) => {
|
|
|
6842
6816
|
enableFlex: true,
|
|
6843
6817
|
scrollX: direction === "horizontal",
|
|
6844
6818
|
scrollY: direction === "vertical",
|
|
6845
|
-
scrollLeft
|
|
6846
|
-
scrollTop
|
|
6819
|
+
scrollLeft,
|
|
6820
|
+
scrollTop,
|
|
6847
6821
|
showScrollbar: false,
|
|
6848
|
-
scrollIntoViewAlignment: "center",
|
|
6849
6822
|
scrollWithAnimation: scrollWithAnimation.current,
|
|
6850
6823
|
id: `nut-tabs__titles_${name}`,
|
|
6851
6824
|
className: classesTitle,
|
|
6852
|
-
style: { ...tabStyle }
|
|
6853
|
-
ref: navRef
|
|
6825
|
+
style: { ...tabStyle }
|
|
6854
6826
|
},
|
|
6855
|
-
/* @__PURE__ */ React__default.createElement(View, { className: "nut-tabs__list" }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
|
|
6827
|
+
/* @__PURE__ */ React__default.createElement(View, { className: "nut-tabs__list", ref: navRef }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
|
|
6856
6828
|
return /* @__PURE__ */ React__default.createElement(
|
|
6857
6829
|
View,
|
|
6858
6830
|
{
|
|
@@ -11408,7 +11380,7 @@ const Input = forwardRef(
|
|
|
11408
11380
|
}
|
|
11409
11381
|
setValue(val);
|
|
11410
11382
|
const eventHandler = props[trigger];
|
|
11411
|
-
if (eventHandler && typeof eventHandler === "function") {
|
|
11383
|
+
if (eventHandler && typeof eventHandler === "function" && trigger !== "onChange") {
|
|
11412
11384
|
eventHandler(val);
|
|
11413
11385
|
}
|
|
11414
11386
|
forceUpdate();
|
|
@@ -14266,7 +14238,7 @@ const defaultProps$F = {
|
|
|
14266
14238
|
lockScroll: true,
|
|
14267
14239
|
beforeCancel: () => true,
|
|
14268
14240
|
beforeClose: () => true,
|
|
14269
|
-
onOverlayClick: () =>
|
|
14241
|
+
onOverlayClick: () => true
|
|
14270
14242
|
};
|
|
14271
14243
|
const BaseDialog = (props) => {
|
|
14272
14244
|
const classPrefix2 = "nut-dialog";
|
|
@@ -14752,7 +14724,7 @@ const defaultProps$A = {
|
|
|
14752
14724
|
content: "",
|
|
14753
14725
|
closeable: false,
|
|
14754
14726
|
wrap: false,
|
|
14755
|
-
leftIcon:
|
|
14727
|
+
leftIcon: /* @__PURE__ */ React__default.createElement(a$b, { size: 16 }),
|
|
14756
14728
|
rightIcon: null,
|
|
14757
14729
|
delay: 1,
|
|
14758
14730
|
scrollable: null,
|
|
@@ -15085,7 +15057,7 @@ const NoticeBar = (props) => {
|
|
|
15085
15057
|
stopAutoPlay();
|
|
15086
15058
|
};
|
|
15087
15059
|
}, []);
|
|
15088
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React__default.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick }, /* @__PURE__ */ React__default.createElement("div", { className: "left-icon" }, leftIcon
|
|
15060
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React__default.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick }, leftIcon ? /* @__PURE__ */ React__default.createElement("div", { className: "left-icon" }, leftIcon) : null, /* @__PURE__ */ React__default.createElement("div", { ref: wrapRef, className: "wrap" }, /* @__PURE__ */ React__default.createElement(
|
|
15089
15061
|
"div",
|
|
15090
15062
|
{
|
|
15091
15063
|
ref: contentRef,
|
|
@@ -15929,9 +15901,9 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
15929
15901
|
return;
|
|
15930
15902
|
}
|
|
15931
15903
|
touch.move(event);
|
|
15932
|
-
props.onTouchMove && props.onTouchMove(event);
|
|
15933
15904
|
if (touch.isHorizontal()) {
|
|
15934
15905
|
lockClick.current = true;
|
|
15906
|
+
props.onTouchMove && props.onTouchMove(event);
|
|
15935
15907
|
const newState = { ...state, dragging: true };
|
|
15936
15908
|
const isEdge = !opened || touch.deltaX * startOffset.current < 0;
|
|
15937
15909
|
if (isEdge) {
|
|
@@ -16040,8 +16012,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
16040
16012
|
onTouchStart: (e) => onTouchStart(e),
|
|
16041
16013
|
onTouchMove: (e) => onTouchMove(e),
|
|
16042
16014
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
16043
|
-
style
|
|
16044
|
-
catchMove: true
|
|
16015
|
+
style
|
|
16045
16016
|
},
|
|
16046
16017
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left"), children, renderActionContent("right"))
|
|
16047
16018
|
);
|
|
@@ -17860,9 +17831,7 @@ const ImagePreview = (props) => {
|
|
|
17860
17831
|
{
|
|
17861
17832
|
src: item.src,
|
|
17862
17833
|
mode: "aspectFit",
|
|
17863
|
-
showMenuByLongpress: true
|
|
17864
|
-
width: "100%",
|
|
17865
|
-
height: "100%"
|
|
17834
|
+
showMenuByLongpress: true
|
|
17866
17835
|
}
|
|
17867
17836
|
)
|
|
17868
17837
|
);
|