@nutui/nutui-react-taro 2.6.0 → 2.6.1
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 +10 -0
- package/dist/esm/Cell.js +1 -1
- package/dist/esm/CellGroup.js +1 -1
- package/dist/esm/Form.js +2 -2
- package/dist/esm/FormItem.js +1 -1
- package/dist/esm/Swiper.js +14 -8
- package/dist/esm/{cell.taro-CCnLF6RC.js → cell.taro-CmI4m0SC.js} +1 -1
- package/dist/esm/{cellgroup.taro-Dz69kT6e.js → cellgroup.taro-CYsSk-Bt.js} +1 -1
- package/dist/esm/{formitem.taro-Brz5dj_8.js → formitem.taro-DDNlpN_O.js} +1 -1
- package/dist/esm/nutui-react.es.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 +30 -11
- package/dist/nutui.react.umd.js +30 -11
- package/dist/style.mjs +1 -1
- package/dist/types/utils/use-lock-fn.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# v2.6.1
|
|
2
|
+
`2024-04-19`
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
* :bug: fix(image): standardize demos (#2177) @Alex-huxiyang
|
|
6
|
+
* :bug: fix(cellgroup): 去掉 cellgroup 未单独使用的 style 属性 (#2176) @kurisu994
|
|
7
|
+
* :bug: fix(site): png url error & key duplicate (#2178) @Alex-huxiyang
|
|
8
|
+
* :bug: fix(swiper): 异步加载 indicator 不显示 (#2167) @Alex-huxiyang
|
|
9
|
+
|
|
10
|
+
|
|
1
11
|
# v2.6.0
|
|
2
12
|
`2024-04-12`
|
|
3
13
|
|
package/dist/esm/Cell.js
CHANGED
package/dist/esm/CellGroup.js
CHANGED
package/dist/esm/Form.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import { u as useForm, S as SECRET, C as Context, F as FormItem } from "./formitem.taro-
|
|
3
|
+
import { u as useForm, S as SECRET, C as Context, F as FormItem } from "./formitem.taro-DDNlpN_O.js";
|
|
4
4
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
5
|
-
import { C as Cell } from "./cell.taro-
|
|
5
|
+
import { C as Cell } from "./cell.taro-CmI4m0SC.js";
|
|
6
6
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { labelPosition: "right", starPosition: "left", divider: false, onFinish: (values) => {
|
|
7
7
|
}, onFinishFailed: (values, errorFields) => {
|
|
8
8
|
} });
|
package/dist/esm/FormItem.js
CHANGED
package/dist/esm/Swiper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
|
|
2
|
-
import React__default, { forwardRef, useState,
|
|
2
|
+
import React__default, { forwardRef, useState, useMemo, useEffect, useImperativeHandle, Children } from "react";
|
|
3
3
|
import { View, Swiper as Swiper$1, SwiperItem } from "@tarojs/components";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { I as Indicator } from "./indicator.taro-CpHZtD9p.js";
|
|
@@ -17,21 +17,27 @@ const classPrefix = "nut-swiper";
|
|
|
17
17
|
const Swiper = forwardRef((props, ref) => {
|
|
18
18
|
const _a = Object.assign(Object.assign({}, defaultProps), props), { width, height, className, children, indicator, loop, autoPlay, duration, direction, defaultValue, onChange, style } = _a, rest = __rest(_a, ["width", "height", "className", "children", "indicator", "loop", "autoPlay", "duration", "direction", "defaultValue", "onChange", "style"]);
|
|
19
19
|
const [current, setCurrent] = useState(defaultValue);
|
|
20
|
-
const childrenCount =
|
|
20
|
+
const childrenCount = useMemo(() => {
|
|
21
|
+
let c = 0;
|
|
22
|
+
React__default.Children.map(children, (child, index) => {
|
|
23
|
+
c += 1;
|
|
24
|
+
});
|
|
25
|
+
return c;
|
|
26
|
+
}, [children]);
|
|
21
27
|
useEffect(() => {
|
|
22
28
|
setCurrent(defaultValue);
|
|
23
29
|
}, [defaultValue]);
|
|
24
30
|
const renderIndicator = () => {
|
|
25
31
|
if (React__default.isValidElement(indicator))
|
|
26
32
|
return indicator;
|
|
27
|
-
if (indicator
|
|
33
|
+
if (indicator) {
|
|
28
34
|
return React__default.createElement(
|
|
29
35
|
"div",
|
|
30
36
|
{ className: classNames({
|
|
31
37
|
[`${classPrefix}-indicator`]: true,
|
|
32
38
|
[`${classPrefix}-indicator-vertical`]: direction === "vertical"
|
|
33
39
|
}) },
|
|
34
|
-
React__default.createElement(Indicator, { current, total: childrenCount
|
|
40
|
+
React__default.createElement(Indicator, { current, total: childrenCount, direction })
|
|
35
41
|
);
|
|
36
42
|
}
|
|
37
43
|
return null;
|
|
@@ -45,16 +51,16 @@ const Swiper = forwardRef((props, ref) => {
|
|
|
45
51
|
},
|
|
46
52
|
next: () => {
|
|
47
53
|
if (loop) {
|
|
48
|
-
setCurrent((current + 1) % childrenCount
|
|
54
|
+
setCurrent((current + 1) % childrenCount);
|
|
49
55
|
} else {
|
|
50
|
-
setCurrent(current + 1 >= childrenCount
|
|
56
|
+
setCurrent(current + 1 >= childrenCount ? current : current + 1);
|
|
51
57
|
}
|
|
52
58
|
},
|
|
53
59
|
prev: () => {
|
|
54
60
|
if (loop) {
|
|
55
61
|
let next = current - 1;
|
|
56
|
-
next = next < 0 ? childrenCount
|
|
57
|
-
setCurrent(next % childrenCount
|
|
62
|
+
next = next < 0 ? childrenCount + next : next;
|
|
63
|
+
setCurrent(next % childrenCount);
|
|
58
64
|
} else {
|
|
59
65
|
setCurrent(current - 1 <= 0 ? 0 : current - 1);
|
|
60
66
|
}
|
|
@@ -2,7 +2,7 @@ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
|
|
|
2
2
|
import React__default, { useContext } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
5
|
-
import { a as CellGroupContext, C as CellGroup } from "./cellgroup.taro-
|
|
5
|
+
import { a as CellGroupContext, C as CellGroup } from "./cellgroup.taro-CYsSk-Bt.js";
|
|
6
6
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { title: null, description: null, extra: null, radius: "6px", align: "flex-start", onClick: (event) => {
|
|
7
7
|
} });
|
|
8
8
|
const classPrefix = "nut-cell";
|
|
@@ -6,7 +6,7 @@ const CellGroupContext = createContext(null);
|
|
|
6
6
|
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { title: "", description: "", divider: true });
|
|
7
7
|
const classPrefix = "nut-cell-group";
|
|
8
8
|
const CellGroup = (props) => {
|
|
9
|
-
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, className,
|
|
9
|
+
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, className, title, description, divider } = _a, rest = __rest(_a, ["children", "className", "title", "description", "divider"]);
|
|
10
10
|
return React__default.createElement(
|
|
11
11
|
"div",
|
|
12
12
|
Object.assign({ className: classNames(classPrefix, className) }, rest),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { createContext, useRef } from "react";
|
|
2
|
-
import { C as Cell } from "./cell.taro-
|
|
2
|
+
import { C as Cell } from "./cell.taro-CmI4m0SC.js";
|
|
3
3
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
4
4
|
import { a as __awaiter } from "./tslib.es6-BZ8i9Q6l.js";
|
|
5
5
|
import Schema from "async-validator";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B } from "./button.taro-CjH840d8.js";
|
|
2
|
-
import { C } from "./cell.taro-
|
|
3
|
-
import { C as C2 } from "./cellgroup.taro-
|
|
2
|
+
import { C } from "./cell.taro-CmI4m0SC.js";
|
|
3
|
+
import { C as C2 } from "./cellgroup.taro-CYsSk-Bt.js";
|
|
4
4
|
import { C as C3, g, s, u, a } from "./configprovider.taro-CyU_tvNJ.js";
|
|
5
5
|
import { I } from "./image.taro-BLz2WCva.js";
|
|
6
6
|
import { O } from "./overlay.taro--1Kf1D7C.js";
|
|
@@ -32,7 +32,7 @@ import { C as C8 } from "./cascader.taro-CFcAyFL-.js";
|
|
|
32
32
|
import { C as C9, a as a2 } from "./checkbox.taro-CUpF7Afr.js";
|
|
33
33
|
import { D as D2 } from "./datepicker.taro-Bgq3ZNDe.js";
|
|
34
34
|
import { default as default2 } from "./Form.js";
|
|
35
|
-
import { F as F2 } from "./formitem.taro-
|
|
35
|
+
import { F as F2 } from "./formitem.taro-DDNlpN_O.js";
|
|
36
36
|
import { I as I2 } from "./input.taro-CAZ-rRMH.js";
|
|
37
37
|
import { I as I3 } from "./inputnumber.taro-CQiAPZgS.js";
|
|
38
38
|
import { M } from "./menu.taro-J7oZoaGM.js";
|
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v2.6.
|
|
2
|
+
* @nutui/nutui-react-taro v2.6.1 Fri Apr 19 2024 14:47:10 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -305,7 +305,7 @@ const defaultProps$1v = {
|
|
|
305
305
|
};
|
|
306
306
|
const classPrefix$r = "nut-cell-group";
|
|
307
307
|
const CellGroup = (props) => {
|
|
308
|
-
const { children, className,
|
|
308
|
+
const { children, className, title, description, divider, ...rest } = {
|
|
309
309
|
...defaultProps$1v,
|
|
310
310
|
...props
|
|
311
311
|
};
|
|
@@ -3424,6 +3424,19 @@ function getScrollParent(el, root2 = defaultRoot) {
|
|
|
3424
3424
|
}
|
|
3425
3425
|
return root2;
|
|
3426
3426
|
}
|
|
3427
|
+
let passiveSupported = false;
|
|
3428
|
+
if (canUseDom) {
|
|
3429
|
+
try {
|
|
3430
|
+
const opts = Object.defineProperty({}, "passive", {
|
|
3431
|
+
get() {
|
|
3432
|
+
passiveSupported = true;
|
|
3433
|
+
}
|
|
3434
|
+
});
|
|
3435
|
+
window.addEventListener("test-passive-supported", null, opts);
|
|
3436
|
+
} catch (e2) {
|
|
3437
|
+
console.log(e2);
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3427
3440
|
let totalLockCount = 0;
|
|
3428
3441
|
const BODY_LOCK_CLASS = "nut-overflow-hidden";
|
|
3429
3442
|
function getScrollableElement(el) {
|
|
@@ -3472,7 +3485,7 @@ function useLockScroll(rootRef, shouldLock) {
|
|
|
3472
3485
|
document.addEventListener(
|
|
3473
3486
|
"touchmove",
|
|
3474
3487
|
onTouchMove,
|
|
3475
|
-
false
|
|
3488
|
+
passiveSupported ? { passive: false } : false
|
|
3476
3489
|
);
|
|
3477
3490
|
if (!totalLockCount) {
|
|
3478
3491
|
document.body.classList.add(BODY_LOCK_CLASS);
|
|
@@ -8043,7 +8056,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
8043
8056
|
moving: moving.current
|
|
8044
8057
|
}));
|
|
8045
8058
|
useEffect(() => {
|
|
8046
|
-
const eventOptions = false;
|
|
8059
|
+
const eventOptions = passiveSupported ? { passive: false, once: true } : false;
|
|
8047
8060
|
const element = pickerPanelRef.current;
|
|
8048
8061
|
element.addEventListener("touchstart", touchStart, eventOptions);
|
|
8049
8062
|
element.addEventListener("touchmove", touchMove, eventOptions);
|
|
@@ -16806,14 +16819,20 @@ const Swiper = forwardRef((props, ref) => {
|
|
|
16806
16819
|
...props
|
|
16807
16820
|
};
|
|
16808
16821
|
const [current, setCurrent] = useState(defaultValue);
|
|
16809
|
-
const childrenCount =
|
|
16822
|
+
const childrenCount = useMemo$1(() => {
|
|
16823
|
+
let c2 = 0;
|
|
16824
|
+
React__default.Children.map(children, (child, index) => {
|
|
16825
|
+
c2 += 1;
|
|
16826
|
+
});
|
|
16827
|
+
return c2;
|
|
16828
|
+
}, [children]);
|
|
16810
16829
|
useEffect(() => {
|
|
16811
16830
|
setCurrent(defaultValue);
|
|
16812
16831
|
}, [defaultValue]);
|
|
16813
16832
|
const renderIndicator = () => {
|
|
16814
16833
|
if (React__default.isValidElement(indicator))
|
|
16815
16834
|
return indicator;
|
|
16816
|
-
if (indicator
|
|
16835
|
+
if (indicator) {
|
|
16817
16836
|
return /* @__PURE__ */ React__default.createElement(
|
|
16818
16837
|
"div",
|
|
16819
16838
|
{
|
|
@@ -16826,7 +16845,7 @@ const Swiper = forwardRef((props, ref) => {
|
|
|
16826
16845
|
Indicator,
|
|
16827
16846
|
{
|
|
16828
16847
|
current,
|
|
16829
|
-
total: childrenCount
|
|
16848
|
+
total: childrenCount,
|
|
16830
16849
|
direction
|
|
16831
16850
|
}
|
|
16832
16851
|
)
|
|
@@ -16843,16 +16862,16 @@ const Swiper = forwardRef((props, ref) => {
|
|
|
16843
16862
|
},
|
|
16844
16863
|
next: () => {
|
|
16845
16864
|
if (loop) {
|
|
16846
|
-
setCurrent((current + 1) % childrenCount
|
|
16865
|
+
setCurrent((current + 1) % childrenCount);
|
|
16847
16866
|
} else {
|
|
16848
|
-
setCurrent(current + 1 >= childrenCount
|
|
16867
|
+
setCurrent(current + 1 >= childrenCount ? current : current + 1);
|
|
16849
16868
|
}
|
|
16850
16869
|
},
|
|
16851
16870
|
prev: () => {
|
|
16852
16871
|
if (loop) {
|
|
16853
16872
|
let next = current - 1;
|
|
16854
|
-
next = next < 0 ? childrenCount
|
|
16855
|
-
setCurrent(next % childrenCount
|
|
16873
|
+
next = next < 0 ? childrenCount + next : next;
|
|
16874
|
+
setCurrent(next % childrenCount);
|
|
16856
16875
|
} else {
|
|
16857
16876
|
setCurrent(current - 1 <= 0 ? 0 : current - 1);
|
|
16858
16877
|
}
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
|
|
3
3
|
})(this, function(exports2, React, Taro, components, ReactDOM) {
|
|
4
4
|
"use strict";/*!
|
|
5
|
-
* @nutui/nutui-react-taro v2.6.
|
|
5
|
+
* @nutui/nutui-react-taro v2.6.1 Fri Apr 19 2024 14:47:10 GMT+0800 (China Standard Time)
|
|
6
6
|
* (c) 2023 @jdf2e.
|
|
7
7
|
* Released under the MIT License.
|
|
8
8
|
*/
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
};
|
|
322
322
|
const classPrefix$r = "nut-cell-group";
|
|
323
323
|
const CellGroup = (props) => {
|
|
324
|
-
const { children, className,
|
|
324
|
+
const { children, className, title, description, divider, ...rest } = {
|
|
325
325
|
...defaultProps$1v,
|
|
326
326
|
...props
|
|
327
327
|
};
|
|
@@ -3440,6 +3440,19 @@
|
|
|
3440
3440
|
}
|
|
3441
3441
|
return root2;
|
|
3442
3442
|
}
|
|
3443
|
+
let passiveSupported = false;
|
|
3444
|
+
if (canUseDom) {
|
|
3445
|
+
try {
|
|
3446
|
+
const opts = Object.defineProperty({}, "passive", {
|
|
3447
|
+
get() {
|
|
3448
|
+
passiveSupported = true;
|
|
3449
|
+
}
|
|
3450
|
+
});
|
|
3451
|
+
window.addEventListener("test-passive-supported", null, opts);
|
|
3452
|
+
} catch (e2) {
|
|
3453
|
+
console.log(e2);
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3443
3456
|
let totalLockCount = 0;
|
|
3444
3457
|
const BODY_LOCK_CLASS = "nut-overflow-hidden";
|
|
3445
3458
|
function getScrollableElement(el) {
|
|
@@ -3488,7 +3501,7 @@
|
|
|
3488
3501
|
document.addEventListener(
|
|
3489
3502
|
"touchmove",
|
|
3490
3503
|
onTouchMove,
|
|
3491
|
-
false
|
|
3504
|
+
passiveSupported ? { passive: false } : false
|
|
3492
3505
|
);
|
|
3493
3506
|
if (!totalLockCount) {
|
|
3494
3507
|
document.body.classList.add(BODY_LOCK_CLASS);
|
|
@@ -8059,7 +8072,7 @@
|
|
|
8059
8072
|
moving: moving.current
|
|
8060
8073
|
}));
|
|
8061
8074
|
React.useEffect(() => {
|
|
8062
|
-
const eventOptions = false;
|
|
8075
|
+
const eventOptions = passiveSupported ? { passive: false, once: true } : false;
|
|
8063
8076
|
const element = pickerPanelRef.current;
|
|
8064
8077
|
element.addEventListener("touchstart", touchStart, eventOptions);
|
|
8065
8078
|
element.addEventListener("touchmove", touchMove, eventOptions);
|
|
@@ -16822,14 +16835,20 @@
|
|
|
16822
16835
|
...props
|
|
16823
16836
|
};
|
|
16824
16837
|
const [current, setCurrent] = React.useState(defaultValue);
|
|
16825
|
-
const childrenCount = React.
|
|
16838
|
+
const childrenCount = React.useMemo(() => {
|
|
16839
|
+
let c2 = 0;
|
|
16840
|
+
React.Children.map(children, (child, index) => {
|
|
16841
|
+
c2 += 1;
|
|
16842
|
+
});
|
|
16843
|
+
return c2;
|
|
16844
|
+
}, [children]);
|
|
16826
16845
|
React.useEffect(() => {
|
|
16827
16846
|
setCurrent(defaultValue);
|
|
16828
16847
|
}, [defaultValue]);
|
|
16829
16848
|
const renderIndicator = () => {
|
|
16830
16849
|
if (React.isValidElement(indicator))
|
|
16831
16850
|
return indicator;
|
|
16832
|
-
if (indicator
|
|
16851
|
+
if (indicator) {
|
|
16833
16852
|
return /* @__PURE__ */ React.createElement(
|
|
16834
16853
|
"div",
|
|
16835
16854
|
{
|
|
@@ -16842,7 +16861,7 @@
|
|
|
16842
16861
|
Indicator,
|
|
16843
16862
|
{
|
|
16844
16863
|
current,
|
|
16845
|
-
total: childrenCount
|
|
16864
|
+
total: childrenCount,
|
|
16846
16865
|
direction
|
|
16847
16866
|
}
|
|
16848
16867
|
)
|
|
@@ -16859,16 +16878,16 @@
|
|
|
16859
16878
|
},
|
|
16860
16879
|
next: () => {
|
|
16861
16880
|
if (loop) {
|
|
16862
|
-
setCurrent((current + 1) % childrenCount
|
|
16881
|
+
setCurrent((current + 1) % childrenCount);
|
|
16863
16882
|
} else {
|
|
16864
|
-
setCurrent(current + 1 >= childrenCount
|
|
16883
|
+
setCurrent(current + 1 >= childrenCount ? current : current + 1);
|
|
16865
16884
|
}
|
|
16866
16885
|
},
|
|
16867
16886
|
prev: () => {
|
|
16868
16887
|
if (loop) {
|
|
16869
16888
|
let next = current - 1;
|
|
16870
|
-
next = next < 0 ? childrenCount
|
|
16871
|
-
setCurrent(next % childrenCount
|
|
16889
|
+
next = next < 0 ? childrenCount + next : next;
|
|
16890
|
+
setCurrent(next % childrenCount);
|
|
16872
16891
|
} else {
|
|
16873
16892
|
setCurrent(current - 1 <= 0 ? 0 : current - 1);
|
|
16874
16893
|
}
|
package/dist/style.mjs
CHANGED