@nutui/nutui-react-taro 2.6.20 → 2.6.22
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 +30 -5
- package/dist/esm/Address.js +1 -1
- package/dist/esm/AnimatingNumbers.js +7 -7
- package/dist/esm/Audio/style/style.css +1 -1
- package/dist/esm/Audio.js +1 -1
- package/dist/esm/Avatar.js +1 -1
- package/dist/esm/AvatarCropper.js +1 -1
- package/dist/esm/BackTop.js +1 -1
- package/dist/esm/Barrage.js +1 -1
- package/dist/esm/Button.js +1 -1
- package/dist/esm/Calendar.js +1 -1
- package/dist/esm/CalendarItem.js +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/Empty.js +1 -1
- package/dist/esm/Menu.js +1 -1
- package/dist/esm/MenuItem.js +1 -1
- package/dist/esm/NavBar/style/style.css +1 -1
- package/dist/esm/NavBar.js +1 -1
- package/dist/esm/Radio.js +1 -1
- package/dist/esm/RadioGroup.js +1 -1
- package/dist/esm/Range/style/style.css +1 -1
- package/dist/esm/Range.js +1 -1
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/{address.taro-CWr6jIYg.js → address.taro-Ai6DQF3D.js} +1 -1
- package/dist/esm/{audio.taro--yoX2oyx.js → audio.taro-qK1wq4IH.js} +4 -5
- package/dist/esm/avatar.taro-9dU2KeWv.js +82 -0
- package/dist/esm/{avatarcropper.taro-B0I9uLNp.js → avatarcropper.taro-meD2sizv.js} +1 -1
- package/dist/esm/{backtop.taro-CpzSXDW3.js → backtop.taro-D3Lo3jFO.js} +8 -10
- package/dist/esm/{barrage.taro-CA-9uADD.js → barrage.taro-D2lmvcB-.js} +40 -26
- package/dist/esm/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
- package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-C52T1TFf.js} +1 -1
- package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-CHdJXKkc.js} +1 -1
- package/dist/esm/{cascader.taro-DZ_oBTm0.js → cascader.taro-CMOCzo0m.js} +1 -1
- package/dist/esm/{dialog.taro-Bg730q8d.js → dialog.taro-yjDaaRHA.js} +1 -1
- package/dist/esm/{empty.taro-Dr4eSaDg.js → empty.taro-Dt07kty5.js} +1 -1
- package/dist/esm/{menu.taro-BFc4uUxG.js → menu.taro-BmjnA_YM.js} +13 -13
- package/dist/esm/{menuitem.taro-D6KQvdRw.js → menuitem.taro-DCqPC4Nu.js} +13 -13
- package/dist/esm/{navbar.taro-Dea0-s9Q.js → navbar.taro-HRFRDGii.js} +7 -2
- package/dist/esm/nutui-react.es.js +20 -20
- package/dist/esm/{radio.taro-CzOHqD3O.js → radio.taro-M2in687s.js} +24 -20
- package/dist/esm/{raf-zwv-SBjP.js → raf-Di10dXPS.js} +2 -1
- package/dist/esm/{range.taro-BilM3sMH.js → range.taro-D4U2Q7Wx.js} +49 -44
- package/dist/esm/{skeleton.taro-bD6fHZop.js → skeleton.taro-D9Vkgsyx.js} +1 -1
- package/dist/esm/{tabs.taro-CJiI4q_-.js → tabs.taro-D8bDfm4x.js} +1 -1
- package/dist/esm/{uploader.taro-C-8Jf7un.js → uploader.taro-CceZ5Y4t.js} +8 -7
- 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 +262 -284
- package/dist/nutui.react.umd.js +262 -284
- package/dist/packages/navbar/navbar.scss +0 -5
- package/dist/packages/range/range.scss +2 -0
- package/dist/style.css +1 -1
- package/dist/types/packages/avatar/avatar.d.ts +1 -1
- package/dist/types/packages/overlay/overlay.d.ts +1 -1
- package/dist/types/packages/uploader/uploader.d.ts +1 -0
- package/dist/types/packages/uploader/uploader.taro.d.ts +5 -0
- package/package.json +1 -1
- package/dist/esm/avatar.taro-DSL3ErmC.js +0 -85
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.22 Sat Oct 12 2024 15:01:29 GMT+0800 (China Standard Time)
|
|
6
6
|
* (c) 2023 @jdf2e.
|
|
7
7
|
* Released under the MIT License.
|
|
8
8
|
*/
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
};
|
|
321
321
|
const getStyle = React.useCallback(() => {
|
|
322
322
|
const style2 = {};
|
|
323
|
-
if (
|
|
323
|
+
if (color) {
|
|
324
324
|
if (props.fill === "outline" || props.fill === "dashed") {
|
|
325
325
|
style2.color = color;
|
|
326
326
|
if (!(color == null ? void 0 : color.includes("gradient"))) {
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
return style2;
|
|
336
|
-
}, [color]);
|
|
336
|
+
}, [color, props.fill]);
|
|
337
337
|
const handleClick = (e2) => {
|
|
338
338
|
if (!loading && !disabled && onClick) {
|
|
339
339
|
onClick(e2);
|
|
@@ -3961,7 +3961,7 @@
|
|
|
3961
3961
|
stop.current = true;
|
|
3962
3962
|
};
|
|
3963
3963
|
}
|
|
3964
|
-
const inBrowser = typeof document !== "undefined" && !!document.scripts;
|
|
3964
|
+
const inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
|
|
3965
3965
|
function isWindow(val) {
|
|
3966
3966
|
return val === window;
|
|
3967
3967
|
}
|
|
@@ -4003,7 +4003,7 @@
|
|
|
4003
4003
|
}
|
|
4004
4004
|
const getRectByTaro = async (element) => {
|
|
4005
4005
|
if (element) {
|
|
4006
|
-
if (inBrowser) {
|
|
4006
|
+
if (inBrowser$1) {
|
|
4007
4007
|
return Promise.resolve(getRect(element));
|
|
4008
4008
|
}
|
|
4009
4009
|
return new Promise((resolve, reject) => {
|
|
@@ -4168,11 +4168,16 @@
|
|
|
4168
4168
|
...props
|
|
4169
4169
|
};
|
|
4170
4170
|
const classPrefix2 = "nut-backtop";
|
|
4171
|
-
const [backTop,
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4171
|
+
const [backTop, setBackTop] = React.useState(false);
|
|
4172
|
+
const cls = classNames(classPrefix2, { show: backTop }, className);
|
|
4173
|
+
const handleScroll = React.useCallback(
|
|
4174
|
+
(res) => {
|
|
4175
|
+
const { scrollTop } = res;
|
|
4176
|
+
setBackTop(scrollTop >= threshold);
|
|
4177
|
+
},
|
|
4178
|
+
[threshold]
|
|
4179
|
+
);
|
|
4180
|
+
Taro.usePageScroll(handleScroll);
|
|
4176
4181
|
const goTop = (e2) => {
|
|
4177
4182
|
onClick && onClick(e2);
|
|
4178
4183
|
Taro.pageScrollTo({
|
|
@@ -4188,23 +4193,7 @@
|
|
|
4188
4193
|
bottom: "20px",
|
|
4189
4194
|
zIndex
|
|
4190
4195
|
};
|
|
4191
|
-
return /* @__PURE__ */ React.createElement(
|
|
4192
|
-
"div",
|
|
4193
|
-
{
|
|
4194
|
-
className: classNames(
|
|
4195
|
-
classPrefix2,
|
|
4196
|
-
{
|
|
4197
|
-
show: backTop
|
|
4198
|
-
},
|
|
4199
|
-
className
|
|
4200
|
-
),
|
|
4201
|
-
style: styles,
|
|
4202
|
-
onClick: (e2) => {
|
|
4203
|
-
goTop(e2);
|
|
4204
|
-
}
|
|
4205
|
-
},
|
|
4206
|
-
children || /* @__PURE__ */ React.createElement(N, { size: 19, className: "nut-backtop-main" })
|
|
4207
|
-
);
|
|
4196
|
+
return /* @__PURE__ */ React.createElement("div", { className: cls, style: styles, onClick: (e2) => goTop(e2) }, children || /* @__PURE__ */ React.createElement(N, { size: 19, className: "nut-backtop-main" }));
|
|
4208
4197
|
};
|
|
4209
4198
|
BackTop.displayName = "NutBackTop";
|
|
4210
4199
|
const elevatorContext = React.createContext({});
|
|
@@ -4628,11 +4617,10 @@
|
|
|
4628
4617
|
};
|
|
4629
4618
|
const classes = classNames({
|
|
4630
4619
|
[`${classPrefix2}-fixed`]: fixed,
|
|
4631
|
-
[`${classPrefix2}-safe-area-inset-top`]: safeAreaInsetTop,
|
|
4632
4620
|
[`${classPrefix2}-title-align-${titleAlign}`]: true
|
|
4633
4621
|
});
|
|
4634
4622
|
const cls = classNames(classPrefix2, classes, className);
|
|
4635
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4623
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4636
4624
|
};
|
|
4637
4625
|
NavBar.displayName = "NutNavBar";
|
|
4638
4626
|
const defaultProps$1f = {
|
|
@@ -5220,8 +5208,9 @@
|
|
|
5220
5208
|
);
|
|
5221
5209
|
return children ? /* @__PURE__ */ React.createElement("div", { className: classes }, !disabled && children) : null;
|
|
5222
5210
|
};
|
|
5211
|
+
const inBrowser = typeof window !== "undefined";
|
|
5223
5212
|
function requestAniFrame() {
|
|
5224
|
-
if (
|
|
5213
|
+
if (inBrowser) {
|
|
5225
5214
|
const _window = window;
|
|
5226
5215
|
return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
|
|
5227
5216
|
_window.setTimeout(callback, 1e3 / 60);
|
|
@@ -10775,9 +10764,19 @@
|
|
|
10775
10764
|
React.useEffect(() => {
|
|
10776
10765
|
setShowPopup(show2);
|
|
10777
10766
|
}, [show2]);
|
|
10767
|
+
const getParentOffset = React.useCallback(() => {
|
|
10768
|
+
setTimeout(async () => {
|
|
10769
|
+
const p = parent.menuRef.current;
|
|
10770
|
+
const rect = await getRectByTaro(p);
|
|
10771
|
+
setPosition({
|
|
10772
|
+
height: rect.height,
|
|
10773
|
+
top: rect.top
|
|
10774
|
+
});
|
|
10775
|
+
}, 100);
|
|
10776
|
+
}, [parent.menuRef]);
|
|
10778
10777
|
React.useEffect(() => {
|
|
10779
10778
|
getParentOffset();
|
|
10780
|
-
}, [showPopup]);
|
|
10779
|
+
}, [showPopup, getParentOffset]);
|
|
10781
10780
|
const windowHeight = React.useMemo(() => Taro.getSystemInfoSync().windowHeight, []);
|
|
10782
10781
|
const updateItemOffset = React.useCallback(() => {
|
|
10783
10782
|
if (!parent.lockScroll) return;
|
|
@@ -10790,7 +10789,7 @@
|
|
|
10790
10789
|
});
|
|
10791
10790
|
}
|
|
10792
10791
|
});
|
|
10793
|
-
}, [direction, windowHeight]);
|
|
10792
|
+
}, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
|
|
10794
10793
|
Taro.usePageScroll(updateItemOffset);
|
|
10795
10794
|
React.useImperativeHandle(ref, () => ({
|
|
10796
10795
|
toggle: (s) => {
|
|
@@ -10818,16 +10817,6 @@
|
|
|
10818
10817
|
top: 0,
|
|
10819
10818
|
height: 0
|
|
10820
10819
|
});
|
|
10821
|
-
const getParentOffset = () => {
|
|
10822
|
-
setTimeout(async () => {
|
|
10823
|
-
const p = parent.menuRef.current;
|
|
10824
|
-
const rect = await getRectByTaro(p);
|
|
10825
|
-
setPosition({
|
|
10826
|
-
height: rect.height,
|
|
10827
|
-
top: rect.top
|
|
10828
|
-
});
|
|
10829
|
-
}, 100);
|
|
10830
|
-
};
|
|
10831
10820
|
const isShow = () => {
|
|
10832
10821
|
if (showPopup) return {};
|
|
10833
10822
|
return { display: "none" };
|
|
@@ -10972,24 +10961,29 @@
|
|
|
10972
10961
|
...props
|
|
10973
10962
|
};
|
|
10974
10963
|
const menuRef = React.useRef(null);
|
|
10964
|
+
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
10965
|
+
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
10975
10966
|
const [isScrollFixed, setIsScrollFixed] = React.useState(false);
|
|
10967
|
+
const cls = classNames(`nut-menu`, className, {
|
|
10968
|
+
"scroll-fixed": isScrollFixed
|
|
10969
|
+
});
|
|
10976
10970
|
const getScrollTop = (el) => {
|
|
10977
|
-
return Math.max(
|
|
10971
|
+
return Math.max(
|
|
10972
|
+
0,
|
|
10973
|
+
el === window ? window.scrollY : el.scrollTop
|
|
10974
|
+
);
|
|
10978
10975
|
};
|
|
10979
|
-
const onScroll = () => {
|
|
10980
|
-
const { scrollFixed: scrollFixed2 } = props;
|
|
10976
|
+
const onScroll = React.useCallback(() => {
|
|
10981
10977
|
const scrollTop = getScrollTop(window);
|
|
10982
|
-
const isFixed = scrollTop > (typeof
|
|
10978
|
+
const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
|
|
10983
10979
|
setIsScrollFixed(isFixed);
|
|
10984
|
-
};
|
|
10980
|
+
}, [scrollFixed]);
|
|
10985
10981
|
React.useEffect(() => {
|
|
10986
10982
|
if (scrollFixed) {
|
|
10987
10983
|
window.addEventListener("scroll", onScroll);
|
|
10988
10984
|
}
|
|
10989
10985
|
return () => window.removeEventListener("scroll", onScroll);
|
|
10990
|
-
}, []);
|
|
10991
|
-
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
10992
|
-
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
10986
|
+
}, [scrollFixed, onScroll]);
|
|
10993
10987
|
const toggleMenuItem = (index, from = "NORMAL") => {
|
|
10994
10988
|
showMenuItem[index] = !showMenuItem[index];
|
|
10995
10989
|
if (showMenuItem[index]) {
|
|
@@ -11092,26 +11086,15 @@
|
|
|
11092
11086
|
return null;
|
|
11093
11087
|
});
|
|
11094
11088
|
};
|
|
11095
|
-
return /* @__PURE__ */ React.createElement(
|
|
11089
|
+
return /* @__PURE__ */ React.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React.createElement(
|
|
11096
11090
|
"div",
|
|
11097
11091
|
{
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
}),
|
|
11102
|
-
ref: menuRef
|
|
11092
|
+
className: classNames("nut-menu-bar", {
|
|
11093
|
+
opened: showMenuItem.includes(true)
|
|
11094
|
+
})
|
|
11103
11095
|
},
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
{
|
|
11107
|
-
className: classNames("nut-menu-bar", {
|
|
11108
|
-
opened: showMenuItem.includes(true)
|
|
11109
|
-
})
|
|
11110
|
-
},
|
|
11111
|
-
menuTitle()
|
|
11112
|
-
),
|
|
11113
|
-
cloneChildren()
|
|
11114
|
-
);
|
|
11096
|
+
menuTitle()
|
|
11097
|
+
), cloneChildren());
|
|
11115
11098
|
};
|
|
11116
11099
|
Menu.displayName = "NutMenu";
|
|
11117
11100
|
Menu.Item = MenuItem;
|
|
@@ -11302,6 +11285,13 @@
|
|
|
11302
11285
|
disabled,
|
|
11303
11286
|
...rest
|
|
11304
11287
|
} = { ...defaultProps$R, ...props };
|
|
11288
|
+
const cls = classNames(
|
|
11289
|
+
classPrefix$g,
|
|
11290
|
+
{
|
|
11291
|
+
[`${classPrefix$g}-${props.direction}`]: props.direction
|
|
11292
|
+
},
|
|
11293
|
+
className
|
|
11294
|
+
);
|
|
11305
11295
|
const [val2State, setVal2State] = usePropsValue({
|
|
11306
11296
|
defaultValue: props.defaultValue,
|
|
11307
11297
|
value: props.value,
|
|
@@ -11324,7 +11314,7 @@
|
|
|
11324
11314
|
}
|
|
11325
11315
|
);
|
|
11326
11316
|
});
|
|
11327
|
-
}, [options]);
|
|
11317
|
+
}, [options, labelPosition, val2State]);
|
|
11328
11318
|
return /* @__PURE__ */ React.createElement(
|
|
11329
11319
|
RadioContext.Provider,
|
|
11330
11320
|
{
|
|
@@ -11341,20 +11331,7 @@
|
|
|
11341
11331
|
}
|
|
11342
11332
|
}
|
|
11343
11333
|
},
|
|
11344
|
-
/* @__PURE__ */ React.createElement(
|
|
11345
|
-
"div",
|
|
11346
|
-
{
|
|
11347
|
-
className: classNames(
|
|
11348
|
-
classPrefix$g,
|
|
11349
|
-
{
|
|
11350
|
-
[`${classPrefix$g}-${props.direction}`]: props.direction
|
|
11351
|
-
},
|
|
11352
|
-
className
|
|
11353
|
-
),
|
|
11354
|
-
...rest
|
|
11355
|
-
},
|
|
11356
|
-
(options == null ? void 0 : options.length) ? renderOptionsChildren() : children
|
|
11357
|
-
)
|
|
11334
|
+
/* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : children)
|
|
11358
11335
|
);
|
|
11359
11336
|
}
|
|
11360
11337
|
);
|
|
@@ -11412,29 +11389,6 @@
|
|
|
11412
11389
|
}
|
|
11413
11390
|
};
|
|
11414
11391
|
}
|
|
11415
|
-
const renderLabel = () => {
|
|
11416
|
-
return /* @__PURE__ */ React.createElement(
|
|
11417
|
-
"div",
|
|
11418
|
-
{
|
|
11419
|
-
className: classNames(`${classPrefix2}-label`, {
|
|
11420
|
-
[`${classPrefix2}-label-disabled`]: disabled
|
|
11421
|
-
})
|
|
11422
|
-
},
|
|
11423
|
-
children
|
|
11424
|
-
);
|
|
11425
|
-
};
|
|
11426
|
-
const renderButton = () => {
|
|
11427
|
-
return /* @__PURE__ */ React.createElement(
|
|
11428
|
-
"div",
|
|
11429
|
-
{
|
|
11430
|
-
className: classNames(`${classPrefix2}-button`, {
|
|
11431
|
-
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
11432
|
-
[`${classPrefix2}-button-disabled`]: disabled
|
|
11433
|
-
})
|
|
11434
|
-
},
|
|
11435
|
-
children
|
|
11436
|
-
);
|
|
11437
|
-
};
|
|
11438
11392
|
const color = () => {
|
|
11439
11393
|
return {
|
|
11440
11394
|
[`${classPrefix2}-icon-disabled`]: disabled,
|
|
@@ -11458,8 +11412,21 @@
|
|
|
11458
11412
|
className: classNames(color())
|
|
11459
11413
|
}) : /* @__PURE__ */ React.createElement(A, { className: classNames(color()) });
|
|
11460
11414
|
};
|
|
11415
|
+
const renderLabel = () => {
|
|
11416
|
+
const labelcls = classNames(`${classPrefix2}-label`, {
|
|
11417
|
+
[`${classPrefix2}-label-disabled`]: disabled
|
|
11418
|
+
});
|
|
11419
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), /* @__PURE__ */ React.createElement("div", { className: labelcls }, children));
|
|
11420
|
+
};
|
|
11421
|
+
const renderButton = () => {
|
|
11422
|
+
const buttoncls = classNames(`${classPrefix2}-button`, {
|
|
11423
|
+
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
11424
|
+
[`${classPrefix2}-button-disabled`]: disabled
|
|
11425
|
+
});
|
|
11426
|
+
return /* @__PURE__ */ React.createElement("div", { className: buttoncls }, children);
|
|
11427
|
+
};
|
|
11461
11428
|
const renderByShape = (shape2) => {
|
|
11462
|
-
return shape2 === "button" ? renderButton() :
|
|
11429
|
+
return shape2 === "button" ? renderButton() : renderLabel();
|
|
11463
11430
|
};
|
|
11464
11431
|
const renderRadioItem = () => {
|
|
11465
11432
|
return renderByShape(context && context.shape ? context.shape : shape);
|
|
@@ -11468,22 +11435,14 @@
|
|
|
11468
11435
|
if (disabled || checkedStatement) return;
|
|
11469
11436
|
setCheckedStatement(!checkedStatement);
|
|
11470
11437
|
};
|
|
11471
|
-
|
|
11472
|
-
|
|
11438
|
+
const cls = classNames(
|
|
11439
|
+
classPrefix2,
|
|
11473
11440
|
{
|
|
11474
|
-
|
|
11475
|
-
classPrefix2,
|
|
11476
|
-
{
|
|
11477
|
-
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11478
|
-
},
|
|
11479
|
-
className
|
|
11480
|
-
),
|
|
11481
|
-
style,
|
|
11482
|
-
onClick: handleClick,
|
|
11483
|
-
...rest
|
|
11441
|
+
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11484
11442
|
},
|
|
11485
|
-
|
|
11443
|
+
className
|
|
11486
11444
|
);
|
|
11445
|
+
return /* @__PURE__ */ React.createElement("div", { className: cls, style, onClick: handleClick, ...rest }, renderRadioItem());
|
|
11487
11446
|
};
|
|
11488
11447
|
Radio.displayName = "NutRadio";
|
|
11489
11448
|
Radio.Group = RadioGroup;
|
|
@@ -11505,9 +11464,6 @@
|
|
|
11505
11464
|
button,
|
|
11506
11465
|
vertical,
|
|
11507
11466
|
marks,
|
|
11508
|
-
onChange,
|
|
11509
|
-
onStart,
|
|
11510
|
-
onEnd,
|
|
11511
11467
|
minDescription,
|
|
11512
11468
|
maxDescription,
|
|
11513
11469
|
currentDescription,
|
|
@@ -11515,7 +11471,10 @@
|
|
|
11515
11471
|
max,
|
|
11516
11472
|
step,
|
|
11517
11473
|
value,
|
|
11518
|
-
defaultValue
|
|
11474
|
+
defaultValue,
|
|
11475
|
+
onChange,
|
|
11476
|
+
onStart,
|
|
11477
|
+
onEnd
|
|
11519
11478
|
} = { ...defaultProps$P, ...props };
|
|
11520
11479
|
const classPrefix2 = "nut-range";
|
|
11521
11480
|
const [buttonIndex, setButtonIndex] = React.useState(0);
|
|
@@ -11533,7 +11492,7 @@
|
|
|
11533
11492
|
finalValue: 0,
|
|
11534
11493
|
onChange: handleChange
|
|
11535
11494
|
});
|
|
11536
|
-
const [exactValue,
|
|
11495
|
+
const [exactValue, setExactValue] = React.useState(
|
|
11537
11496
|
() => value || defaultValue || 0
|
|
11538
11497
|
);
|
|
11539
11498
|
const marksRef = React.useRef({});
|
|
@@ -11551,10 +11510,7 @@
|
|
|
11551
11510
|
setMarksList(list);
|
|
11552
11511
|
}
|
|
11553
11512
|
}
|
|
11554
|
-
}, [marks]);
|
|
11555
|
-
const scope = () => {
|
|
11556
|
-
return max - min;
|
|
11557
|
-
};
|
|
11513
|
+
}, [marks, max, min]);
|
|
11558
11514
|
const classes = classNames(classPrefix2, {
|
|
11559
11515
|
[`${classPrefix2}-disabled`]: disabled,
|
|
11560
11516
|
[`${classPrefix2}-vertical`]: vertical
|
|
@@ -11566,41 +11522,38 @@
|
|
|
11566
11522
|
},
|
|
11567
11523
|
className
|
|
11568
11524
|
);
|
|
11569
|
-
const markClassName =
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
},
|
|
11586
|
-
[range2, current, min, max]
|
|
11587
|
-
);
|
|
11525
|
+
const markClassName = (mark) => {
|
|
11526
|
+
const classPrefix22 = "nut-range-mark";
|
|
11527
|
+
let lowerBound = min;
|
|
11528
|
+
let upperBound = max;
|
|
11529
|
+
if (range2 && Array.isArray(current)) {
|
|
11530
|
+
lowerBound = current[0];
|
|
11531
|
+
upperBound = current[1];
|
|
11532
|
+
} else {
|
|
11533
|
+
upperBound = current;
|
|
11534
|
+
}
|
|
11535
|
+
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
11536
|
+
return [
|
|
11537
|
+
`${classPrefix22}-text`,
|
|
11538
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
11539
|
+
].join(" ");
|
|
11540
|
+
};
|
|
11588
11541
|
const isRange = (val) => {
|
|
11589
11542
|
return !!range2 && Array.isArray(val);
|
|
11590
11543
|
};
|
|
11544
|
+
const scope = React.useMemo(() => {
|
|
11545
|
+
if (max < min || max === min) {
|
|
11546
|
+
console.log("max 的值需要大于 min的值");
|
|
11547
|
+
}
|
|
11548
|
+
return max - min;
|
|
11549
|
+
}, [max, min]);
|
|
11591
11550
|
const calcMainAxis = () => {
|
|
11592
11551
|
const modelVal = current;
|
|
11593
|
-
|
|
11594
|
-
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
11595
|
-
}
|
|
11596
|
-
return `${(modelVal - min) * 100 / scope()}%`;
|
|
11552
|
+
return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
|
|
11597
11553
|
};
|
|
11598
11554
|
const calcOffset = () => {
|
|
11599
11555
|
const modelVal = current;
|
|
11600
|
-
|
|
11601
|
-
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
11602
|
-
}
|
|
11603
|
-
return `0%`;
|
|
11556
|
+
return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
|
|
11604
11557
|
};
|
|
11605
11558
|
const barStyle = () => {
|
|
11606
11559
|
if (vertical) {
|
|
@@ -11620,11 +11573,11 @@
|
|
|
11620
11573
|
const marksStyle = (mark) => {
|
|
11621
11574
|
const dir = rtl ? "right" : "left";
|
|
11622
11575
|
let style = {
|
|
11623
|
-
[dir]: `${(mark - min) / scope
|
|
11576
|
+
[dir]: `${(mark - min) / scope * 100}%`
|
|
11624
11577
|
};
|
|
11625
11578
|
if (vertical) {
|
|
11626
11579
|
style = {
|
|
11627
|
-
top: `${(mark - min) / scope
|
|
11580
|
+
top: `${(mark - min) / scope * 100}%`
|
|
11628
11581
|
};
|
|
11629
11582
|
}
|
|
11630
11583
|
return style;
|
|
@@ -11671,8 +11624,8 @@
|
|
|
11671
11624
|
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
11672
11625
|
total = rect.height;
|
|
11673
11626
|
}
|
|
11674
|
-
const value2 = min + delta / total * scope
|
|
11675
|
-
|
|
11627
|
+
const value2 = min + delta / total * scope;
|
|
11628
|
+
setExactValue(current);
|
|
11676
11629
|
if (isRange(current)) {
|
|
11677
11630
|
const [left2, right2] = current;
|
|
11678
11631
|
const middle = (left2 + right2) / 2;
|
|
@@ -11690,7 +11643,7 @@
|
|
|
11690
11643
|
return;
|
|
11691
11644
|
}
|
|
11692
11645
|
touch.start(event);
|
|
11693
|
-
|
|
11646
|
+
setExactValue(current);
|
|
11694
11647
|
if (isRange(current)) {
|
|
11695
11648
|
setStartValue(current.map(format2));
|
|
11696
11649
|
} else {
|
|
@@ -11711,12 +11664,12 @@
|
|
|
11711
11664
|
if (!rect) return;
|
|
11712
11665
|
let delta = touch.deltaX.current;
|
|
11713
11666
|
let total = rect.width;
|
|
11714
|
-
let diff = delta / total * scope
|
|
11667
|
+
let diff = delta / total * scope;
|
|
11715
11668
|
diff = rtl ? -diff : diff;
|
|
11716
11669
|
if (vertical) {
|
|
11717
11670
|
delta = touch.deltaY.current;
|
|
11718
11671
|
total = rect.height;
|
|
11719
|
-
diff = delta / total * scope
|
|
11672
|
+
diff = delta / total * scope;
|
|
11720
11673
|
}
|
|
11721
11674
|
let newValue;
|
|
11722
11675
|
if (isRange(startValue)) {
|
|
@@ -11725,7 +11678,7 @@
|
|
|
11725
11678
|
} else {
|
|
11726
11679
|
newValue = startValue + diff;
|
|
11727
11680
|
}
|
|
11728
|
-
|
|
11681
|
+
setExactValue(newValue);
|
|
11729
11682
|
updateValue(newValue);
|
|
11730
11683
|
};
|
|
11731
11684
|
const onTouchEnd = () => {
|
|
@@ -11745,57 +11698,65 @@
|
|
|
11745
11698
|
const renderButton = (index) => {
|
|
11746
11699
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, button || /* @__PURE__ */ React.createElement("div", { className: "nut-range-button" }, currentDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
|
|
11747
11700
|
};
|
|
11748
|
-
|
|
11749
|
-
return
|
|
11750
|
-
"
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
style: marksStyle(mark)
|
|
11755
|
-
},
|
|
11756
|
-
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
11757
|
-
/* @__PURE__ */ React.createElement(
|
|
11758
|
-
"span",
|
|
11701
|
+
const renderRangeButton = () => {
|
|
11702
|
+
return [0, 1].map((item, index) => {
|
|
11703
|
+
const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
11704
|
+
${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
|
|
11705
|
+
return /* @__PURE__ */ React.createElement(
|
|
11706
|
+
"div",
|
|
11759
11707
|
{
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
}
|
|
11764
|
-
)
|
|
11765
|
-
);
|
|
11766
|
-
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? [0, 1].map((item, index) => {
|
|
11767
|
-
return /* @__PURE__ */ React.createElement(
|
|
11768
|
-
"div",
|
|
11769
|
-
{
|
|
11770
|
-
key: index,
|
|
11771
|
-
className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
11772
|
-
${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
|
|
11773
|
-
onTouchStart: (e2) => {
|
|
11774
|
-
if (typeof index === "number") {
|
|
11708
|
+
key: index,
|
|
11709
|
+
className: cls,
|
|
11710
|
+
onTouchStart: (e2) => {
|
|
11775
11711
|
setButtonIndex(index);
|
|
11776
|
-
|
|
11777
|
-
|
|
11712
|
+
onTouchStart(e2);
|
|
11713
|
+
},
|
|
11714
|
+
onTouchMove,
|
|
11715
|
+
onTouchEnd,
|
|
11716
|
+
onTouchCancel: onTouchEnd,
|
|
11717
|
+
onClick: (e2) => e2.stopPropagation()
|
|
11778
11718
|
},
|
|
11779
|
-
|
|
11719
|
+
renderButton(index)
|
|
11720
|
+
);
|
|
11721
|
+
});
|
|
11722
|
+
};
|
|
11723
|
+
const renderSingleButton = () => {
|
|
11724
|
+
return /* @__PURE__ */ React.createElement(
|
|
11725
|
+
components.View,
|
|
11726
|
+
{
|
|
11727
|
+
catchMove: true,
|
|
11728
|
+
className: "nut-range-button-wrapper",
|
|
11729
|
+
onTouchStart,
|
|
11730
|
+
onTouchMove,
|
|
11780
11731
|
onTouchEnd,
|
|
11781
11732
|
onTouchCancel: onTouchEnd,
|
|
11782
11733
|
onClick: (e2) => e2.stopPropagation()
|
|
11783
11734
|
},
|
|
11784
|
-
renderButton(
|
|
11735
|
+
renderButton()
|
|
11785
11736
|
);
|
|
11786
|
-
}
|
|
11787
|
-
|
|
11788
|
-
{
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11737
|
+
};
|
|
11738
|
+
const renderMark = () => {
|
|
11739
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
|
|
11740
|
+
return /* @__PURE__ */ React.createElement(
|
|
11741
|
+
"span",
|
|
11742
|
+
{
|
|
11743
|
+
key: mark,
|
|
11744
|
+
className: markClassName(mark),
|
|
11745
|
+
style: marksStyle(mark)
|
|
11746
|
+
},
|
|
11747
|
+
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
11748
|
+
/* @__PURE__ */ React.createElement(
|
|
11749
|
+
"span",
|
|
11750
|
+
{
|
|
11751
|
+
className: classNames("nut-range-tick", {
|
|
11752
|
+
active: tickClass(mark)
|
|
11753
|
+
})
|
|
11754
|
+
}
|
|
11755
|
+
)
|
|
11756
|
+
);
|
|
11757
|
+
})));
|
|
11758
|
+
};
|
|
11759
|
+
return /* @__PURE__ */ React.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React.createElement("div", { ref: root2, className: classes, onClick: (e2) => click(e2) }, renderMark(), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? renderRangeButton() : renderSingleButton())), maxDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "max" }, maxDescription || max));
|
|
11799
11760
|
};
|
|
11800
11761
|
Range.displayName = "NutRange";
|
|
11801
11762
|
const defaultProps$O = {
|
|
@@ -12878,6 +12839,7 @@
|
|
|
12878
12839
|
onDeleteItem,
|
|
12879
12840
|
handleItemClick,
|
|
12880
12841
|
previewUrl,
|
|
12842
|
+
deleteIcon,
|
|
12881
12843
|
children
|
|
12882
12844
|
}) => {
|
|
12883
12845
|
const renderIcon = (item) => {
|
|
@@ -12895,12 +12857,12 @@
|
|
|
12895
12857
|
key: item.uid
|
|
12896
12858
|
},
|
|
12897
12859
|
previewType === "picture" && !children && deletable && /* @__PURE__ */ React.createElement(
|
|
12898
|
-
|
|
12860
|
+
components.View,
|
|
12899
12861
|
{
|
|
12900
|
-
color: "rgba(0,0,0,0.6)",
|
|
12901
12862
|
className: "close",
|
|
12902
12863
|
onClick: () => onDeleteItem(item, index)
|
|
12903
|
-
}
|
|
12864
|
+
},
|
|
12865
|
+
deleteIcon
|
|
12904
12866
|
),
|
|
12905
12867
|
previewType === "picture" && !children && /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-img" }, item.status === "ready" ? /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress" }, /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)) : item.status !== "success" && /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress" }, renderIcon(item), /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)), ((_a = item.type) == null ? void 0 : _a.includes("image")) ? /* @__PURE__ */ React.createElement(React.Fragment, null, item.url && /* @__PURE__ */ React.createElement(
|
|
12906
12868
|
components.Image,
|
|
@@ -12963,6 +12925,7 @@
|
|
|
12963
12925
|
mediaType: ["image", "video"],
|
|
12964
12926
|
camera: "back",
|
|
12965
12927
|
uploadIcon: /* @__PURE__ */ React.createElement(y, { size: "20px", color: "#808080" }),
|
|
12928
|
+
deleteIcon: /* @__PURE__ */ React.createElement(u$1, { color: "rgba(0,0,0,0.6)" }),
|
|
12966
12929
|
uploadLabel: "",
|
|
12967
12930
|
previewType: "picture",
|
|
12968
12931
|
fit: "cover",
|
|
@@ -12990,6 +12953,7 @@
|
|
|
12990
12953
|
const {
|
|
12991
12954
|
children,
|
|
12992
12955
|
uploadIcon,
|
|
12956
|
+
deleteIcon,
|
|
12993
12957
|
uploadLabel,
|
|
12994
12958
|
accept,
|
|
12995
12959
|
name,
|
|
@@ -13316,6 +13280,7 @@
|
|
|
13316
13280
|
onDeleteItem,
|
|
13317
13281
|
handleItemClick,
|
|
13318
13282
|
previewUrl,
|
|
13283
|
+
deleteIcon,
|
|
13319
13284
|
children
|
|
13320
13285
|
}
|
|
13321
13286
|
}
|
|
@@ -15061,15 +15026,14 @@
|
|
|
15061
15026
|
size: "",
|
|
15062
15027
|
shape: "round",
|
|
15063
15028
|
icon: "",
|
|
15064
|
-
fit: "cover",
|
|
15065
15029
|
background: "#eee",
|
|
15066
15030
|
color: "#666",
|
|
15031
|
+
fit: "cover",
|
|
15067
15032
|
src: "",
|
|
15068
15033
|
alt: ""
|
|
15069
15034
|
};
|
|
15070
15035
|
const classPrefix$a = `nut-avatar`;
|
|
15071
15036
|
const Avatar = (props) => {
|
|
15072
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
15073
15037
|
const {
|
|
15074
15038
|
children,
|
|
15075
15039
|
size,
|
|
@@ -15077,9 +15041,9 @@
|
|
|
15077
15041
|
background,
|
|
15078
15042
|
color,
|
|
15079
15043
|
src,
|
|
15044
|
+
alt,
|
|
15080
15045
|
icon,
|
|
15081
15046
|
fit,
|
|
15082
|
-
alt,
|
|
15083
15047
|
className,
|
|
15084
15048
|
style,
|
|
15085
15049
|
onClick,
|
|
@@ -15095,9 +15059,10 @@
|
|
|
15095
15059
|
const avatarRef = React.useRef(null);
|
|
15096
15060
|
const parent = React.useContext(AvatarContext);
|
|
15097
15061
|
const sizeValue = ["large", "normal", "small"];
|
|
15062
|
+
const { propAvatarGroup, avatarGroupRef } = parent;
|
|
15098
15063
|
const classes = classNames({
|
|
15099
|
-
[`nut-avatar-${(
|
|
15100
|
-
[`nut-avatar-${(
|
|
15064
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
|
|
15065
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
|
|
15101
15066
|
});
|
|
15102
15067
|
const cls = classNames(classPrefix$a, classes, className);
|
|
15103
15068
|
const styles = {
|
|
@@ -15105,52 +15070,52 @@
|
|
|
15105
15070
|
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
15106
15071
|
backgroundColor: `${background}`,
|
|
15107
15072
|
color,
|
|
15108
|
-
marginLeft: avatarIndex !== 1 && (
|
|
15109
|
-
zIndex: (
|
|
15073
|
+
marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
|
|
15074
|
+
zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
|
|
15110
15075
|
...style
|
|
15111
15076
|
};
|
|
15112
15077
|
const maxStyles = {
|
|
15113
|
-
backgroundColor: `${
|
|
15114
|
-
color: `${
|
|
15078
|
+
backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
|
|
15079
|
+
color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
|
|
15115
15080
|
};
|
|
15081
|
+
const avatarLength = React.useCallback(
|
|
15082
|
+
(children2) => {
|
|
15083
|
+
var _a, _b;
|
|
15084
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15085
|
+
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15086
|
+
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15087
|
+
}
|
|
15088
|
+
}
|
|
15089
|
+
const index = Number((_b = (_a = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
|
|
15090
|
+
const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
|
|
15091
|
+
setMaxSum(children2.length);
|
|
15092
|
+
setAvatarIndex(index);
|
|
15093
|
+
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15094
|
+
setShowMax(true);
|
|
15095
|
+
}
|
|
15096
|
+
},
|
|
15097
|
+
[propAvatarGroup == null ? void 0 : propAvatarGroup.max]
|
|
15098
|
+
);
|
|
15116
15099
|
React.useEffect(() => {
|
|
15117
|
-
|
|
15118
|
-
const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
|
|
15100
|
+
const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
|
|
15119
15101
|
if (avatarChildren) {
|
|
15120
15102
|
avatarLength(avatarChildren);
|
|
15121
15103
|
}
|
|
15122
|
-
}, []);
|
|
15104
|
+
}, [avatarLength, avatarGroupRef]);
|
|
15123
15105
|
const isAvatarInClassList = (element) => {
|
|
15124
|
-
var
|
|
15106
|
+
var _a, _b;
|
|
15125
15107
|
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
15126
15108
|
return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
|
|
15127
15109
|
}
|
|
15128
|
-
return ((
|
|
15129
|
-
};
|
|
15130
|
-
const avatarLength = (children2) => {
|
|
15131
|
-
var _a2, _b2, _c2;
|
|
15132
|
-
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15133
|
-
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15134
|
-
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15135
|
-
}
|
|
15136
|
-
}
|
|
15137
|
-
const index = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
|
|
15138
|
-
const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
|
|
15139
|
-
setMaxSum(children2.length);
|
|
15140
|
-
setAvatarIndex(index);
|
|
15141
|
-
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15142
|
-
setShowMax(true);
|
|
15143
|
-
}
|
|
15110
|
+
return ((_a = element.classList) == null ? void 0 : _a.tokenList[0]) === "nut-avatar" || ((_b = element.classList) == null ? void 0 : _b.tokenList.values().next().value) === "nut-avatar";
|
|
15144
15111
|
};
|
|
15145
15112
|
const errorEvent = () => {
|
|
15146
|
-
|
|
15147
|
-
onError();
|
|
15148
|
-
}
|
|
15113
|
+
onError && onError();
|
|
15149
15114
|
};
|
|
15150
15115
|
const clickAvatar = (e2) => {
|
|
15151
15116
|
onClick && onClick(e2);
|
|
15152
15117
|
};
|
|
15153
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(
|
|
15118
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(
|
|
15154
15119
|
"div",
|
|
15155
15120
|
{
|
|
15156
15121
|
className: cls,
|
|
@@ -15159,7 +15124,7 @@
|
|
|
15159
15124
|
onClick: clickAvatar,
|
|
15160
15125
|
ref: avatarRef
|
|
15161
15126
|
},
|
|
15162
|
-
(!(
|
|
15127
|
+
(!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(
|
|
15163
15128
|
Image$1,
|
|
15164
15129
|
{
|
|
15165
15130
|
className: "avatar-img",
|
|
@@ -15171,7 +15136,7 @@
|
|
|
15171
15136
|
...icon.props,
|
|
15172
15137
|
className: `${icon.props.className || ""} icon`
|
|
15173
15138
|
}) : null, children && /* @__PURE__ */ React.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(D, { className: "icon" })),
|
|
15174
|
-
showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, (
|
|
15139
|
+
showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, (propAvatarGroup == null ? void 0 : propAvatarGroup.maxContent) ? propAvatarGroup == null ? void 0 : propAvatarGroup.maxContent : `+ ${avatarIndex - Number((propAvatarGroup == null ? void 0 : propAvatarGroup.max) || 0)}`)
|
|
15175
15140
|
));
|
|
15176
15141
|
};
|
|
15177
15142
|
Avatar.displayName = "NutAvatar";
|
|
@@ -15636,22 +15601,22 @@
|
|
|
15636
15601
|
className,
|
|
15637
15602
|
thousands,
|
|
15638
15603
|
style,
|
|
15639
|
-
...
|
|
15604
|
+
...rest
|
|
15640
15605
|
} = mergeProps(defaultProps$q, props);
|
|
15641
15606
|
const classPrefix2 = "nut-countup";
|
|
15642
15607
|
const countupRef = React.useRef(null);
|
|
15643
15608
|
const timerRef = React.useRef(0);
|
|
15644
15609
|
const numbers = Array.from({ length: 10 }, (v, i2) => i2);
|
|
15645
|
-
const getShowNumber = () => {
|
|
15610
|
+
const getShowNumber = React.useCallback(() => {
|
|
15646
15611
|
const splitArr = value.split(".");
|
|
15647
15612
|
const intNumber = length && splitArr[0].length < length ? (Array(length).join("0") + splitArr[0]).slice(-length) : splitArr[0];
|
|
15648
15613
|
const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
|
|
15649
15614
|
return currNumber.split("");
|
|
15650
|
-
};
|
|
15615
|
+
}, [length, thousands, value]);
|
|
15651
15616
|
const [numerArr, setNumerArr] = React.useState([]);
|
|
15652
15617
|
const [transformArr, setTransformArr] = React.useState([]);
|
|
15653
15618
|
const isLoaded = React.useRef(false);
|
|
15654
|
-
const setNumberTransform = () => {
|
|
15619
|
+
const setNumberTransform = React.useCallback(() => {
|
|
15655
15620
|
if (countupRef.current && numerArr.length) {
|
|
15656
15621
|
Taro.createSelectorQuery().selectAll(".nut-countup-listitem").node((numberItems) => {
|
|
15657
15622
|
const transformArrCache = [];
|
|
@@ -15666,7 +15631,7 @@
|
|
|
15666
15631
|
setTransformArr([...transformArrCache]);
|
|
15667
15632
|
}).exec();
|
|
15668
15633
|
}
|
|
15669
|
-
};
|
|
15634
|
+
}, [numerArr]);
|
|
15670
15635
|
const numberEaseStyle = (idx) => {
|
|
15671
15636
|
return {
|
|
15672
15637
|
transition: `transform ${duration}s ease-in-out`,
|
|
@@ -15675,7 +15640,7 @@
|
|
|
15675
15640
|
};
|
|
15676
15641
|
React.useEffect(() => {
|
|
15677
15642
|
setNumberTransform();
|
|
15678
|
-
}, [numerArr]);
|
|
15643
|
+
}, [numerArr, setNumberTransform]);
|
|
15679
15644
|
React.useEffect(() => {
|
|
15680
15645
|
if (!isLoaded.current) {
|
|
15681
15646
|
isLoaded.current = true;
|
|
@@ -15688,7 +15653,7 @@
|
|
|
15688
15653
|
return () => {
|
|
15689
15654
|
window.clearTimeout(timerRef.current);
|
|
15690
15655
|
};
|
|
15691
|
-
}, [value]);
|
|
15656
|
+
}, [value, delay, getShowNumber]);
|
|
15692
15657
|
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
|
|
15693
15658
|
return /* @__PURE__ */ React.createElement(
|
|
15694
15659
|
"li",
|
|
@@ -15803,7 +15768,7 @@
|
|
|
15803
15768
|
onPlay == null ? void 0 : onPlay(audioCtx);
|
|
15804
15769
|
});
|
|
15805
15770
|
audioCtx.onCanplay(() => {
|
|
15806
|
-
const intervalID = setInterval(
|
|
15771
|
+
const intervalID = setInterval(() => {
|
|
15807
15772
|
if (audioCtx.duration !== 0) {
|
|
15808
15773
|
setTotalSeconds(audioCtx.duration);
|
|
15809
15774
|
clearInterval(intervalID);
|
|
@@ -15820,8 +15785,7 @@
|
|
|
15820
15785
|
setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
|
|
15821
15786
|
});
|
|
15822
15787
|
audioCtx.onError((res) => {
|
|
15823
|
-
console.warn("
|
|
15824
|
-
console.warn("message", res.errMsg);
|
|
15788
|
+
console.warn("onError", res.errCode, res.errMsg);
|
|
15825
15789
|
});
|
|
15826
15790
|
function formatSeconds(value) {
|
|
15827
15791
|
if (!value) {
|
|
@@ -18371,6 +18335,7 @@
|
|
|
18371
18335
|
const barrageContainer = React.useRef(null);
|
|
18372
18336
|
const barrageCWidth = React.useRef(0);
|
|
18373
18337
|
const timer = React.useRef(0);
|
|
18338
|
+
const domTimer = React.useRef(0);
|
|
18374
18339
|
const index = React.useRef(0);
|
|
18375
18340
|
const times = React.useRef([]);
|
|
18376
18341
|
const historyIndex = React.useRef(-1);
|
|
@@ -18392,28 +18357,34 @@
|
|
|
18392
18357
|
}
|
|
18393
18358
|
return 0;
|
|
18394
18359
|
};
|
|
18360
|
+
const clearDomTimeout = () => {
|
|
18361
|
+
if (domTimer.current) {
|
|
18362
|
+
clearTimeout(domTimer.current);
|
|
18363
|
+
domTimer.current = 0;
|
|
18364
|
+
}
|
|
18365
|
+
};
|
|
18395
18366
|
React.useEffect(() => {
|
|
18396
18367
|
const init = async () => {
|
|
18368
|
+
var _a;
|
|
18397
18369
|
if (barrageBody.current) {
|
|
18398
18370
|
barrageCWidth.current = await getNodeWidth(barrageBody.current);
|
|
18371
|
+
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18372
|
+
"--move-distance",
|
|
18373
|
+
`-${barrageCWidth.current}px`
|
|
18374
|
+
);
|
|
18375
|
+
index.current = 0;
|
|
18376
|
+
run();
|
|
18399
18377
|
}
|
|
18400
18378
|
};
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
var _a;
|
|
18404
|
-
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18405
|
-
"--move-distance",
|
|
18406
|
-
`-${barrageCWidth.current}px`
|
|
18407
|
-
);
|
|
18408
|
-
index.current = 0;
|
|
18409
|
-
run();
|
|
18379
|
+
domTimer.current = window.setTimeout(() => {
|
|
18380
|
+
init();
|
|
18410
18381
|
}, 300);
|
|
18411
18382
|
return () => {
|
|
18412
|
-
|
|
18383
|
+
clearDomTimeout();
|
|
18413
18384
|
};
|
|
18414
18385
|
}, [list]);
|
|
18415
18386
|
const run = () => {
|
|
18416
|
-
|
|
18387
|
+
clearTimeout(timer.current);
|
|
18417
18388
|
let intervalCache = interval;
|
|
18418
18389
|
const _index = (loop ? index.current % list.length : index.current) % rows;
|
|
18419
18390
|
const result = times.current[_index] - rows * interval;
|
|
@@ -18424,7 +18395,30 @@
|
|
|
18424
18395
|
play();
|
|
18425
18396
|
}, intervalCache);
|
|
18426
18397
|
};
|
|
18427
|
-
const
|
|
18398
|
+
const setStyle = async (el, currentIndex) => {
|
|
18399
|
+
try {
|
|
18400
|
+
if (el) {
|
|
18401
|
+
const refe = await getRectByTaro(el);
|
|
18402
|
+
const width = refe.width;
|
|
18403
|
+
const height = refe.height;
|
|
18404
|
+
el.classList.add("move");
|
|
18405
|
+
const elScrollDuration = Math.round(
|
|
18406
|
+
width / barrageCWidth.current * duration
|
|
18407
|
+
);
|
|
18408
|
+
times.current[currentIndex] = elScrollDuration;
|
|
18409
|
+
el.style.animationDuration = `${duration + elScrollDuration}ms`;
|
|
18410
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18411
|
+
el.style.width = `${width}px`;
|
|
18412
|
+
}
|
|
18413
|
+
} catch (error) {
|
|
18414
|
+
console.log("异常自动流转到下一个", error);
|
|
18415
|
+
barrageContainer.current.removeChild(el);
|
|
18416
|
+
}
|
|
18417
|
+
el.addEventListener("animationend", () => {
|
|
18418
|
+
barrageContainer.current.removeChild(el);
|
|
18419
|
+
});
|
|
18420
|
+
};
|
|
18421
|
+
const play = () => {
|
|
18428
18422
|
if (!loop && index.current >= list.length) {
|
|
18429
18423
|
return;
|
|
18430
18424
|
}
|
|
@@ -18436,25 +18430,9 @@
|
|
|
18436
18430
|
}
|
|
18437
18431
|
historyIndex.current = currentIndex;
|
|
18438
18432
|
el.innerHTML = list[_index];
|
|
18439
|
-
el.classList.add("barrage-item");
|
|
18440
18433
|
barrageContainer.current.appendChild(el);
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
const height = await getNodeWidth(el, "height");
|
|
18444
|
-
el.classList.add("move");
|
|
18445
|
-
const elScrollDuration = width / barrageCWidth.current * duration;
|
|
18446
|
-
times.current[currentIndex] = Math.ceil(elScrollDuration);
|
|
18447
|
-
el.style.animationDuration = `${(duration + elScrollDuration).toFixed(
|
|
18448
|
-
2
|
|
18449
|
-
)}ms`;
|
|
18450
|
-
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18451
|
-
el.style.width = `${width}px`;
|
|
18452
|
-
} catch (error) {
|
|
18453
|
-
console.log("异常自动流转到下一个");
|
|
18454
|
-
}
|
|
18455
|
-
el.addEventListener("animationend", () => {
|
|
18456
|
-
barrageContainer.current.removeChild(el);
|
|
18457
|
-
});
|
|
18434
|
+
el.classList.add("barrage-item");
|
|
18435
|
+
requestAnimationFrame(() => setStyle(el, currentIndex));
|
|
18458
18436
|
index.current++;
|
|
18459
18437
|
run();
|
|
18460
18438
|
};
|