@nutui/nutui-react-taro 2.6.21 → 2.6.23
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 +32 -5
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Address/style/style.css +1 -1
- 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/Button.js +1 -1
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +1 -1
- package/dist/esm/CalendarItem.js +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/Empty.js +1 -1
- package/dist/esm/FixedNav/style/style.css +1 -1
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/Menu.js +1 -1
- package/dist/esm/MenuItem/style/style.css +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/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/Overlay/style/style.css +1 -1
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popup/style/style.css +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/ShortPassword/style/style.css +1 -1
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Tour/style/style.css +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/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
- package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-MkErd99P.js} +4 -4
- package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-BGbbuJOS.js} +3 -3
- 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 +19 -19
- 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-DZyZiEi2.js → uploader.taro-CceZ5Y4t.js} +1 -1
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/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 +218 -253
- package/dist/nutui.react.umd.js +218 -253
- package/dist/packages/navbar/navbar.scss +0 -5
- package/dist/packages/overlay/overlay.scss +0 -4
- 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/calendar/calendar.d.ts +2 -0
- package/dist/types/packages/calendar/calendar.taro.d.ts +10 -0
- package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -0
- package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -0
- package/dist/types/packages/overlay/overlay.d.ts +1 -1
- 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.23 Fri Oct 18 2024 14:18:42 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);
|
|
@@ -6527,6 +6516,7 @@
|
|
|
6527
6516
|
renderDay,
|
|
6528
6517
|
renderDayTop,
|
|
6529
6518
|
renderDayBottom,
|
|
6519
|
+
renderBottomButton,
|
|
6530
6520
|
value,
|
|
6531
6521
|
onConfirm,
|
|
6532
6522
|
onUpdate,
|
|
@@ -7077,7 +7067,7 @@
|
|
|
7077
7067
|
);
|
|
7078
7068
|
};
|
|
7079
7069
|
const renderFooter = () => {
|
|
7080
|
-
return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn"
|
|
7070
|
+
return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React.createElement("div", { onClick: confirm }, renderBottomButton ? renderBottomButton() : /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn" }, confirmText || locale.confirm)));
|
|
7081
7071
|
};
|
|
7082
7072
|
return /* @__PURE__ */ React.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
7083
7073
|
});
|
|
@@ -7136,8 +7126,10 @@
|
|
|
7136
7126
|
showSubTitle,
|
|
7137
7127
|
scrollAnimation,
|
|
7138
7128
|
firstDayOfWeek,
|
|
7129
|
+
closeIcon,
|
|
7139
7130
|
disableDate,
|
|
7140
7131
|
renderHeaderButtons,
|
|
7132
|
+
renderBottomButton,
|
|
7141
7133
|
renderDay,
|
|
7142
7134
|
renderDayTop,
|
|
7143
7135
|
renderDayBottom,
|
|
@@ -7195,6 +7187,7 @@
|
|
|
7195
7187
|
firstDayOfWeek,
|
|
7196
7188
|
disableDate,
|
|
7197
7189
|
renderHeaderButtons,
|
|
7190
|
+
renderBottomButton,
|
|
7198
7191
|
renderDay,
|
|
7199
7192
|
renderDayTop,
|
|
7200
7193
|
renderDayBottom,
|
|
@@ -7215,7 +7208,8 @@
|
|
|
7215
7208
|
destroyOnClose: true,
|
|
7216
7209
|
onOverlayClick: closePopup,
|
|
7217
7210
|
onCloseIconClick: closePopup,
|
|
7218
|
-
style: { height: "83%" }
|
|
7211
|
+
style: { height: "83%" },
|
|
7212
|
+
closeIcon
|
|
7219
7213
|
},
|
|
7220
7214
|
renderItem()
|
|
7221
7215
|
) : renderItem());
|
|
@@ -10775,9 +10769,19 @@
|
|
|
10775
10769
|
React.useEffect(() => {
|
|
10776
10770
|
setShowPopup(show2);
|
|
10777
10771
|
}, [show2]);
|
|
10772
|
+
const getParentOffset = React.useCallback(() => {
|
|
10773
|
+
setTimeout(async () => {
|
|
10774
|
+
const p = parent.menuRef.current;
|
|
10775
|
+
const rect = await getRectByTaro(p);
|
|
10776
|
+
setPosition({
|
|
10777
|
+
height: rect.height,
|
|
10778
|
+
top: rect.top
|
|
10779
|
+
});
|
|
10780
|
+
}, 100);
|
|
10781
|
+
}, [parent.menuRef]);
|
|
10778
10782
|
React.useEffect(() => {
|
|
10779
10783
|
getParentOffset();
|
|
10780
|
-
}, [showPopup]);
|
|
10784
|
+
}, [showPopup, getParentOffset]);
|
|
10781
10785
|
const windowHeight = React.useMemo(() => Taro.getSystemInfoSync().windowHeight, []);
|
|
10782
10786
|
const updateItemOffset = React.useCallback(() => {
|
|
10783
10787
|
if (!parent.lockScroll) return;
|
|
@@ -10790,7 +10794,7 @@
|
|
|
10790
10794
|
});
|
|
10791
10795
|
}
|
|
10792
10796
|
});
|
|
10793
|
-
}, [direction, windowHeight]);
|
|
10797
|
+
}, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
|
|
10794
10798
|
Taro.usePageScroll(updateItemOffset);
|
|
10795
10799
|
React.useImperativeHandle(ref, () => ({
|
|
10796
10800
|
toggle: (s) => {
|
|
@@ -10818,16 +10822,6 @@
|
|
|
10818
10822
|
top: 0,
|
|
10819
10823
|
height: 0
|
|
10820
10824
|
});
|
|
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
10825
|
const isShow = () => {
|
|
10832
10826
|
if (showPopup) return {};
|
|
10833
10827
|
return { display: "none" };
|
|
@@ -10972,24 +10966,29 @@
|
|
|
10972
10966
|
...props
|
|
10973
10967
|
};
|
|
10974
10968
|
const menuRef = React.useRef(null);
|
|
10969
|
+
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
10970
|
+
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
10975
10971
|
const [isScrollFixed, setIsScrollFixed] = React.useState(false);
|
|
10972
|
+
const cls = classNames(`nut-menu`, className, {
|
|
10973
|
+
"scroll-fixed": isScrollFixed
|
|
10974
|
+
});
|
|
10976
10975
|
const getScrollTop = (el) => {
|
|
10977
|
-
return Math.max(
|
|
10976
|
+
return Math.max(
|
|
10977
|
+
0,
|
|
10978
|
+
el === window ? window.scrollY : el.scrollTop
|
|
10979
|
+
);
|
|
10978
10980
|
};
|
|
10979
|
-
const onScroll = () => {
|
|
10980
|
-
const { scrollFixed: scrollFixed2 } = props;
|
|
10981
|
+
const onScroll = React.useCallback(() => {
|
|
10981
10982
|
const scrollTop = getScrollTop(window);
|
|
10982
|
-
const isFixed = scrollTop > (typeof
|
|
10983
|
+
const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
|
|
10983
10984
|
setIsScrollFixed(isFixed);
|
|
10984
|
-
};
|
|
10985
|
+
}, [scrollFixed]);
|
|
10985
10986
|
React.useEffect(() => {
|
|
10986
10987
|
if (scrollFixed) {
|
|
10987
10988
|
window.addEventListener("scroll", onScroll);
|
|
10988
10989
|
}
|
|
10989
10990
|
return () => window.removeEventListener("scroll", onScroll);
|
|
10990
|
-
}, []);
|
|
10991
|
-
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
10992
|
-
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
10991
|
+
}, [scrollFixed, onScroll]);
|
|
10993
10992
|
const toggleMenuItem = (index, from = "NORMAL") => {
|
|
10994
10993
|
showMenuItem[index] = !showMenuItem[index];
|
|
10995
10994
|
if (showMenuItem[index]) {
|
|
@@ -11092,26 +11091,15 @@
|
|
|
11092
11091
|
return null;
|
|
11093
11092
|
});
|
|
11094
11093
|
};
|
|
11095
|
-
return /* @__PURE__ */ React.createElement(
|
|
11094
|
+
return /* @__PURE__ */ React.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React.createElement(
|
|
11096
11095
|
"div",
|
|
11097
11096
|
{
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
}),
|
|
11102
|
-
ref: menuRef
|
|
11097
|
+
className: classNames("nut-menu-bar", {
|
|
11098
|
+
opened: showMenuItem.includes(true)
|
|
11099
|
+
})
|
|
11103
11100
|
},
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
{
|
|
11107
|
-
className: classNames("nut-menu-bar", {
|
|
11108
|
-
opened: showMenuItem.includes(true)
|
|
11109
|
-
})
|
|
11110
|
-
},
|
|
11111
|
-
menuTitle()
|
|
11112
|
-
),
|
|
11113
|
-
cloneChildren()
|
|
11114
|
-
);
|
|
11101
|
+
menuTitle()
|
|
11102
|
+
), cloneChildren());
|
|
11115
11103
|
};
|
|
11116
11104
|
Menu.displayName = "NutMenu";
|
|
11117
11105
|
Menu.Item = MenuItem;
|
|
@@ -11302,6 +11290,13 @@
|
|
|
11302
11290
|
disabled,
|
|
11303
11291
|
...rest
|
|
11304
11292
|
} = { ...defaultProps$R, ...props };
|
|
11293
|
+
const cls = classNames(
|
|
11294
|
+
classPrefix$g,
|
|
11295
|
+
{
|
|
11296
|
+
[`${classPrefix$g}-${props.direction}`]: props.direction
|
|
11297
|
+
},
|
|
11298
|
+
className
|
|
11299
|
+
);
|
|
11305
11300
|
const [val2State, setVal2State] = usePropsValue({
|
|
11306
11301
|
defaultValue: props.defaultValue,
|
|
11307
11302
|
value: props.value,
|
|
@@ -11324,7 +11319,7 @@
|
|
|
11324
11319
|
}
|
|
11325
11320
|
);
|
|
11326
11321
|
});
|
|
11327
|
-
}, [options]);
|
|
11322
|
+
}, [options, labelPosition, val2State]);
|
|
11328
11323
|
return /* @__PURE__ */ React.createElement(
|
|
11329
11324
|
RadioContext.Provider,
|
|
11330
11325
|
{
|
|
@@ -11341,20 +11336,7 @@
|
|
|
11341
11336
|
}
|
|
11342
11337
|
}
|
|
11343
11338
|
},
|
|
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
|
-
)
|
|
11339
|
+
/* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : children)
|
|
11358
11340
|
);
|
|
11359
11341
|
}
|
|
11360
11342
|
);
|
|
@@ -11412,29 +11394,6 @@
|
|
|
11412
11394
|
}
|
|
11413
11395
|
};
|
|
11414
11396
|
}
|
|
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
11397
|
const color = () => {
|
|
11439
11398
|
return {
|
|
11440
11399
|
[`${classPrefix2}-icon-disabled`]: disabled,
|
|
@@ -11458,8 +11417,21 @@
|
|
|
11458
11417
|
className: classNames(color())
|
|
11459
11418
|
}) : /* @__PURE__ */ React.createElement(A, { className: classNames(color()) });
|
|
11460
11419
|
};
|
|
11420
|
+
const renderLabel = () => {
|
|
11421
|
+
const labelcls = classNames(`${classPrefix2}-label`, {
|
|
11422
|
+
[`${classPrefix2}-label-disabled`]: disabled
|
|
11423
|
+
});
|
|
11424
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), /* @__PURE__ */ React.createElement("div", { className: labelcls }, children));
|
|
11425
|
+
};
|
|
11426
|
+
const renderButton = () => {
|
|
11427
|
+
const buttoncls = classNames(`${classPrefix2}-button`, {
|
|
11428
|
+
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
11429
|
+
[`${classPrefix2}-button-disabled`]: disabled
|
|
11430
|
+
});
|
|
11431
|
+
return /* @__PURE__ */ React.createElement("div", { className: buttoncls }, children);
|
|
11432
|
+
};
|
|
11461
11433
|
const renderByShape = (shape2) => {
|
|
11462
|
-
return shape2 === "button" ? renderButton() :
|
|
11434
|
+
return shape2 === "button" ? renderButton() : renderLabel();
|
|
11463
11435
|
};
|
|
11464
11436
|
const renderRadioItem = () => {
|
|
11465
11437
|
return renderByShape(context && context.shape ? context.shape : shape);
|
|
@@ -11468,22 +11440,14 @@
|
|
|
11468
11440
|
if (disabled || checkedStatement) return;
|
|
11469
11441
|
setCheckedStatement(!checkedStatement);
|
|
11470
11442
|
};
|
|
11471
|
-
|
|
11472
|
-
|
|
11443
|
+
const cls = classNames(
|
|
11444
|
+
classPrefix2,
|
|
11473
11445
|
{
|
|
11474
|
-
|
|
11475
|
-
classPrefix2,
|
|
11476
|
-
{
|
|
11477
|
-
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11478
|
-
},
|
|
11479
|
-
className
|
|
11480
|
-
),
|
|
11481
|
-
style,
|
|
11482
|
-
onClick: handleClick,
|
|
11483
|
-
...rest
|
|
11446
|
+
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11484
11447
|
},
|
|
11485
|
-
|
|
11448
|
+
className
|
|
11486
11449
|
);
|
|
11450
|
+
return /* @__PURE__ */ React.createElement("div", { className: cls, style, onClick: handleClick, ...rest }, renderRadioItem());
|
|
11487
11451
|
};
|
|
11488
11452
|
Radio.displayName = "NutRadio";
|
|
11489
11453
|
Radio.Group = RadioGroup;
|
|
@@ -11505,9 +11469,6 @@
|
|
|
11505
11469
|
button,
|
|
11506
11470
|
vertical,
|
|
11507
11471
|
marks,
|
|
11508
|
-
onChange,
|
|
11509
|
-
onStart,
|
|
11510
|
-
onEnd,
|
|
11511
11472
|
minDescription,
|
|
11512
11473
|
maxDescription,
|
|
11513
11474
|
currentDescription,
|
|
@@ -11515,7 +11476,10 @@
|
|
|
11515
11476
|
max,
|
|
11516
11477
|
step,
|
|
11517
11478
|
value,
|
|
11518
|
-
defaultValue
|
|
11479
|
+
defaultValue,
|
|
11480
|
+
onChange,
|
|
11481
|
+
onStart,
|
|
11482
|
+
onEnd
|
|
11519
11483
|
} = { ...defaultProps$P, ...props };
|
|
11520
11484
|
const classPrefix2 = "nut-range";
|
|
11521
11485
|
const [buttonIndex, setButtonIndex] = React.useState(0);
|
|
@@ -11533,7 +11497,7 @@
|
|
|
11533
11497
|
finalValue: 0,
|
|
11534
11498
|
onChange: handleChange
|
|
11535
11499
|
});
|
|
11536
|
-
const [exactValue,
|
|
11500
|
+
const [exactValue, setExactValue] = React.useState(
|
|
11537
11501
|
() => value || defaultValue || 0
|
|
11538
11502
|
);
|
|
11539
11503
|
const marksRef = React.useRef({});
|
|
@@ -11551,10 +11515,7 @@
|
|
|
11551
11515
|
setMarksList(list);
|
|
11552
11516
|
}
|
|
11553
11517
|
}
|
|
11554
|
-
}, [marks]);
|
|
11555
|
-
const scope = () => {
|
|
11556
|
-
return max - min;
|
|
11557
|
-
};
|
|
11518
|
+
}, [marks, max, min]);
|
|
11558
11519
|
const classes = classNames(classPrefix2, {
|
|
11559
11520
|
[`${classPrefix2}-disabled`]: disabled,
|
|
11560
11521
|
[`${classPrefix2}-vertical`]: vertical
|
|
@@ -11566,41 +11527,38 @@
|
|
|
11566
11527
|
},
|
|
11567
11528
|
className
|
|
11568
11529
|
);
|
|
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
|
-
);
|
|
11530
|
+
const markClassName = (mark) => {
|
|
11531
|
+
const classPrefix22 = "nut-range-mark";
|
|
11532
|
+
let lowerBound = min;
|
|
11533
|
+
let upperBound = max;
|
|
11534
|
+
if (range2 && Array.isArray(current)) {
|
|
11535
|
+
lowerBound = current[0];
|
|
11536
|
+
upperBound = current[1];
|
|
11537
|
+
} else {
|
|
11538
|
+
upperBound = current;
|
|
11539
|
+
}
|
|
11540
|
+
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
11541
|
+
return [
|
|
11542
|
+
`${classPrefix22}-text`,
|
|
11543
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
11544
|
+
].join(" ");
|
|
11545
|
+
};
|
|
11588
11546
|
const isRange = (val) => {
|
|
11589
11547
|
return !!range2 && Array.isArray(val);
|
|
11590
11548
|
};
|
|
11549
|
+
const scope = React.useMemo(() => {
|
|
11550
|
+
if (max < min || max === min) {
|
|
11551
|
+
console.log("max 的值需要大于 min的值");
|
|
11552
|
+
}
|
|
11553
|
+
return max - min;
|
|
11554
|
+
}, [max, min]);
|
|
11591
11555
|
const calcMainAxis = () => {
|
|
11592
11556
|
const modelVal = current;
|
|
11593
|
-
|
|
11594
|
-
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
11595
|
-
}
|
|
11596
|
-
return `${(modelVal - min) * 100 / scope()}%`;
|
|
11557
|
+
return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
|
|
11597
11558
|
};
|
|
11598
11559
|
const calcOffset = () => {
|
|
11599
11560
|
const modelVal = current;
|
|
11600
|
-
|
|
11601
|
-
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
11602
|
-
}
|
|
11603
|
-
return `0%`;
|
|
11561
|
+
return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
|
|
11604
11562
|
};
|
|
11605
11563
|
const barStyle = () => {
|
|
11606
11564
|
if (vertical) {
|
|
@@ -11620,11 +11578,11 @@
|
|
|
11620
11578
|
const marksStyle = (mark) => {
|
|
11621
11579
|
const dir = rtl ? "right" : "left";
|
|
11622
11580
|
let style = {
|
|
11623
|
-
[dir]: `${(mark - min) / scope
|
|
11581
|
+
[dir]: `${(mark - min) / scope * 100}%`
|
|
11624
11582
|
};
|
|
11625
11583
|
if (vertical) {
|
|
11626
11584
|
style = {
|
|
11627
|
-
top: `${(mark - min) / scope
|
|
11585
|
+
top: `${(mark - min) / scope * 100}%`
|
|
11628
11586
|
};
|
|
11629
11587
|
}
|
|
11630
11588
|
return style;
|
|
@@ -11671,8 +11629,8 @@
|
|
|
11671
11629
|
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
11672
11630
|
total = rect.height;
|
|
11673
11631
|
}
|
|
11674
|
-
const value2 = min + delta / total * scope
|
|
11675
|
-
|
|
11632
|
+
const value2 = min + delta / total * scope;
|
|
11633
|
+
setExactValue(current);
|
|
11676
11634
|
if (isRange(current)) {
|
|
11677
11635
|
const [left2, right2] = current;
|
|
11678
11636
|
const middle = (left2 + right2) / 2;
|
|
@@ -11690,7 +11648,7 @@
|
|
|
11690
11648
|
return;
|
|
11691
11649
|
}
|
|
11692
11650
|
touch.start(event);
|
|
11693
|
-
|
|
11651
|
+
setExactValue(current);
|
|
11694
11652
|
if (isRange(current)) {
|
|
11695
11653
|
setStartValue(current.map(format2));
|
|
11696
11654
|
} else {
|
|
@@ -11711,12 +11669,12 @@
|
|
|
11711
11669
|
if (!rect) return;
|
|
11712
11670
|
let delta = touch.deltaX.current;
|
|
11713
11671
|
let total = rect.width;
|
|
11714
|
-
let diff = delta / total * scope
|
|
11672
|
+
let diff = delta / total * scope;
|
|
11715
11673
|
diff = rtl ? -diff : diff;
|
|
11716
11674
|
if (vertical) {
|
|
11717
11675
|
delta = touch.deltaY.current;
|
|
11718
11676
|
total = rect.height;
|
|
11719
|
-
diff = delta / total * scope
|
|
11677
|
+
diff = delta / total * scope;
|
|
11720
11678
|
}
|
|
11721
11679
|
let newValue;
|
|
11722
11680
|
if (isRange(startValue)) {
|
|
@@ -11725,7 +11683,7 @@
|
|
|
11725
11683
|
} else {
|
|
11726
11684
|
newValue = startValue + diff;
|
|
11727
11685
|
}
|
|
11728
|
-
|
|
11686
|
+
setExactValue(newValue);
|
|
11729
11687
|
updateValue(newValue);
|
|
11730
11688
|
};
|
|
11731
11689
|
const onTouchEnd = () => {
|
|
@@ -11745,57 +11703,65 @@
|
|
|
11745
11703
|
const renderButton = (index) => {
|
|
11746
11704
|
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
11705
|
};
|
|
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",
|
|
11706
|
+
const renderRangeButton = () => {
|
|
11707
|
+
return [0, 1].map((item, index) => {
|
|
11708
|
+
const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
11709
|
+
${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
|
|
11710
|
+
return /* @__PURE__ */ React.createElement(
|
|
11711
|
+
"div",
|
|
11759
11712
|
{
|
|
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") {
|
|
11713
|
+
key: index,
|
|
11714
|
+
className: cls,
|
|
11715
|
+
onTouchStart: (e2) => {
|
|
11775
11716
|
setButtonIndex(index);
|
|
11776
|
-
|
|
11777
|
-
|
|
11717
|
+
onTouchStart(e2);
|
|
11718
|
+
},
|
|
11719
|
+
onTouchMove,
|
|
11720
|
+
onTouchEnd,
|
|
11721
|
+
onTouchCancel: onTouchEnd,
|
|
11722
|
+
onClick: (e2) => e2.stopPropagation()
|
|
11778
11723
|
},
|
|
11779
|
-
|
|
11724
|
+
renderButton(index)
|
|
11725
|
+
);
|
|
11726
|
+
});
|
|
11727
|
+
};
|
|
11728
|
+
const renderSingleButton = () => {
|
|
11729
|
+
return /* @__PURE__ */ React.createElement(
|
|
11730
|
+
components.View,
|
|
11731
|
+
{
|
|
11732
|
+
catchMove: true,
|
|
11733
|
+
className: "nut-range-button-wrapper",
|
|
11734
|
+
onTouchStart,
|
|
11735
|
+
onTouchMove,
|
|
11780
11736
|
onTouchEnd,
|
|
11781
11737
|
onTouchCancel: onTouchEnd,
|
|
11782
11738
|
onClick: (e2) => e2.stopPropagation()
|
|
11783
11739
|
},
|
|
11784
|
-
renderButton(
|
|
11740
|
+
renderButton()
|
|
11785
11741
|
);
|
|
11786
|
-
}
|
|
11787
|
-
|
|
11788
|
-
{
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11742
|
+
};
|
|
11743
|
+
const renderMark = () => {
|
|
11744
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
|
|
11745
|
+
return /* @__PURE__ */ React.createElement(
|
|
11746
|
+
"span",
|
|
11747
|
+
{
|
|
11748
|
+
key: mark,
|
|
11749
|
+
className: markClassName(mark),
|
|
11750
|
+
style: marksStyle(mark)
|
|
11751
|
+
},
|
|
11752
|
+
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
11753
|
+
/* @__PURE__ */ React.createElement(
|
|
11754
|
+
"span",
|
|
11755
|
+
{
|
|
11756
|
+
className: classNames("nut-range-tick", {
|
|
11757
|
+
active: tickClass(mark)
|
|
11758
|
+
})
|
|
11759
|
+
}
|
|
11760
|
+
)
|
|
11761
|
+
);
|
|
11762
|
+
})));
|
|
11763
|
+
};
|
|
11764
|
+
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
11765
|
};
|
|
11800
11766
|
Range.displayName = "NutRange";
|
|
11801
11767
|
const defaultProps$O = {
|
|
@@ -15065,15 +15031,14 @@
|
|
|
15065
15031
|
size: "",
|
|
15066
15032
|
shape: "round",
|
|
15067
15033
|
icon: "",
|
|
15068
|
-
fit: "cover",
|
|
15069
15034
|
background: "#eee",
|
|
15070
15035
|
color: "#666",
|
|
15036
|
+
fit: "cover",
|
|
15071
15037
|
src: "",
|
|
15072
15038
|
alt: ""
|
|
15073
15039
|
};
|
|
15074
15040
|
const classPrefix$a = `nut-avatar`;
|
|
15075
15041
|
const Avatar = (props) => {
|
|
15076
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
15077
15042
|
const {
|
|
15078
15043
|
children,
|
|
15079
15044
|
size,
|
|
@@ -15081,9 +15046,9 @@
|
|
|
15081
15046
|
background,
|
|
15082
15047
|
color,
|
|
15083
15048
|
src,
|
|
15049
|
+
alt,
|
|
15084
15050
|
icon,
|
|
15085
15051
|
fit,
|
|
15086
|
-
alt,
|
|
15087
15052
|
className,
|
|
15088
15053
|
style,
|
|
15089
15054
|
onClick,
|
|
@@ -15099,9 +15064,10 @@
|
|
|
15099
15064
|
const avatarRef = React.useRef(null);
|
|
15100
15065
|
const parent = React.useContext(AvatarContext);
|
|
15101
15066
|
const sizeValue = ["large", "normal", "small"];
|
|
15067
|
+
const { propAvatarGroup, avatarGroupRef } = parent;
|
|
15102
15068
|
const classes = classNames({
|
|
15103
|
-
[`nut-avatar-${(
|
|
15104
|
-
[`nut-avatar-${(
|
|
15069
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
|
|
15070
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
|
|
15105
15071
|
});
|
|
15106
15072
|
const cls = classNames(classPrefix$a, classes, className);
|
|
15107
15073
|
const styles = {
|
|
@@ -15109,52 +15075,52 @@
|
|
|
15109
15075
|
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
15110
15076
|
backgroundColor: `${background}`,
|
|
15111
15077
|
color,
|
|
15112
|
-
marginLeft: avatarIndex !== 1 && (
|
|
15113
|
-
zIndex: (
|
|
15078
|
+
marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
|
|
15079
|
+
zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
|
|
15114
15080
|
...style
|
|
15115
15081
|
};
|
|
15116
15082
|
const maxStyles = {
|
|
15117
|
-
backgroundColor: `${
|
|
15118
|
-
color: `${
|
|
15083
|
+
backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
|
|
15084
|
+
color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
|
|
15119
15085
|
};
|
|
15086
|
+
const avatarLength = React.useCallback(
|
|
15087
|
+
(children2) => {
|
|
15088
|
+
var _a, _b;
|
|
15089
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15090
|
+
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15091
|
+
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
const index = Number((_b = (_a = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
|
|
15095
|
+
const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
|
|
15096
|
+
setMaxSum(children2.length);
|
|
15097
|
+
setAvatarIndex(index);
|
|
15098
|
+
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15099
|
+
setShowMax(true);
|
|
15100
|
+
}
|
|
15101
|
+
},
|
|
15102
|
+
[propAvatarGroup == null ? void 0 : propAvatarGroup.max]
|
|
15103
|
+
);
|
|
15120
15104
|
React.useEffect(() => {
|
|
15121
|
-
|
|
15122
|
-
const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
|
|
15105
|
+
const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
|
|
15123
15106
|
if (avatarChildren) {
|
|
15124
15107
|
avatarLength(avatarChildren);
|
|
15125
15108
|
}
|
|
15126
|
-
}, []);
|
|
15109
|
+
}, [avatarLength, avatarGroupRef]);
|
|
15127
15110
|
const isAvatarInClassList = (element) => {
|
|
15128
|
-
var
|
|
15111
|
+
var _a, _b;
|
|
15129
15112
|
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
15130
15113
|
return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
|
|
15131
15114
|
}
|
|
15132
|
-
return ((
|
|
15133
|
-
};
|
|
15134
|
-
const avatarLength = (children2) => {
|
|
15135
|
-
var _a2, _b2, _c2;
|
|
15136
|
-
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15137
|
-
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15138
|
-
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15139
|
-
}
|
|
15140
|
-
}
|
|
15141
|
-
const index = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
|
|
15142
|
-
const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
|
|
15143
|
-
setMaxSum(children2.length);
|
|
15144
|
-
setAvatarIndex(index);
|
|
15145
|
-
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15146
|
-
setShowMax(true);
|
|
15147
|
-
}
|
|
15115
|
+
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";
|
|
15148
15116
|
};
|
|
15149
15117
|
const errorEvent = () => {
|
|
15150
|
-
|
|
15151
|
-
onError();
|
|
15152
|
-
}
|
|
15118
|
+
onError && onError();
|
|
15153
15119
|
};
|
|
15154
15120
|
const clickAvatar = (e2) => {
|
|
15155
15121
|
onClick && onClick(e2);
|
|
15156
15122
|
};
|
|
15157
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(
|
|
15123
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(
|
|
15158
15124
|
"div",
|
|
15159
15125
|
{
|
|
15160
15126
|
className: cls,
|
|
@@ -15163,7 +15129,7 @@
|
|
|
15163
15129
|
onClick: clickAvatar,
|
|
15164
15130
|
ref: avatarRef
|
|
15165
15131
|
},
|
|
15166
|
-
(!(
|
|
15132
|
+
(!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(
|
|
15167
15133
|
Image$1,
|
|
15168
15134
|
{
|
|
15169
15135
|
className: "avatar-img",
|
|
@@ -15175,7 +15141,7 @@
|
|
|
15175
15141
|
...icon.props,
|
|
15176
15142
|
className: `${icon.props.className || ""} icon`
|
|
15177
15143
|
}) : null, children && /* @__PURE__ */ React.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(D, { className: "icon" })),
|
|
15178
|
-
showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, (
|
|
15144
|
+
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)}`)
|
|
15179
15145
|
));
|
|
15180
15146
|
};
|
|
15181
15147
|
Avatar.displayName = "NutAvatar";
|
|
@@ -15640,22 +15606,22 @@
|
|
|
15640
15606
|
className,
|
|
15641
15607
|
thousands,
|
|
15642
15608
|
style,
|
|
15643
|
-
...
|
|
15609
|
+
...rest
|
|
15644
15610
|
} = mergeProps(defaultProps$q, props);
|
|
15645
15611
|
const classPrefix2 = "nut-countup";
|
|
15646
15612
|
const countupRef = React.useRef(null);
|
|
15647
15613
|
const timerRef = React.useRef(0);
|
|
15648
15614
|
const numbers = Array.from({ length: 10 }, (v, i2) => i2);
|
|
15649
|
-
const getShowNumber = () => {
|
|
15615
|
+
const getShowNumber = React.useCallback(() => {
|
|
15650
15616
|
const splitArr = value.split(".");
|
|
15651
15617
|
const intNumber = length && splitArr[0].length < length ? (Array(length).join("0") + splitArr[0]).slice(-length) : splitArr[0];
|
|
15652
15618
|
const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
|
|
15653
15619
|
return currNumber.split("");
|
|
15654
|
-
};
|
|
15620
|
+
}, [length, thousands, value]);
|
|
15655
15621
|
const [numerArr, setNumerArr] = React.useState([]);
|
|
15656
15622
|
const [transformArr, setTransformArr] = React.useState([]);
|
|
15657
15623
|
const isLoaded = React.useRef(false);
|
|
15658
|
-
const setNumberTransform = () => {
|
|
15624
|
+
const setNumberTransform = React.useCallback(() => {
|
|
15659
15625
|
if (countupRef.current && numerArr.length) {
|
|
15660
15626
|
Taro.createSelectorQuery().selectAll(".nut-countup-listitem").node((numberItems) => {
|
|
15661
15627
|
const transformArrCache = [];
|
|
@@ -15670,7 +15636,7 @@
|
|
|
15670
15636
|
setTransformArr([...transformArrCache]);
|
|
15671
15637
|
}).exec();
|
|
15672
15638
|
}
|
|
15673
|
-
};
|
|
15639
|
+
}, [numerArr]);
|
|
15674
15640
|
const numberEaseStyle = (idx) => {
|
|
15675
15641
|
return {
|
|
15676
15642
|
transition: `transform ${duration}s ease-in-out`,
|
|
@@ -15679,7 +15645,7 @@
|
|
|
15679
15645
|
};
|
|
15680
15646
|
React.useEffect(() => {
|
|
15681
15647
|
setNumberTransform();
|
|
15682
|
-
}, [numerArr]);
|
|
15648
|
+
}, [numerArr, setNumberTransform]);
|
|
15683
15649
|
React.useEffect(() => {
|
|
15684
15650
|
if (!isLoaded.current) {
|
|
15685
15651
|
isLoaded.current = true;
|
|
@@ -15692,7 +15658,7 @@
|
|
|
15692
15658
|
return () => {
|
|
15693
15659
|
window.clearTimeout(timerRef.current);
|
|
15694
15660
|
};
|
|
15695
|
-
}, [value]);
|
|
15661
|
+
}, [value, delay, getShowNumber]);
|
|
15696
15662
|
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
|
|
15697
15663
|
return /* @__PURE__ */ React.createElement(
|
|
15698
15664
|
"li",
|
|
@@ -15807,7 +15773,7 @@
|
|
|
15807
15773
|
onPlay == null ? void 0 : onPlay(audioCtx);
|
|
15808
15774
|
});
|
|
15809
15775
|
audioCtx.onCanplay(() => {
|
|
15810
|
-
const intervalID = setInterval(
|
|
15776
|
+
const intervalID = setInterval(() => {
|
|
15811
15777
|
if (audioCtx.duration !== 0) {
|
|
15812
15778
|
setTotalSeconds(audioCtx.duration);
|
|
15813
15779
|
clearInterval(intervalID);
|
|
@@ -15824,8 +15790,7 @@
|
|
|
15824
15790
|
setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
|
|
15825
15791
|
});
|
|
15826
15792
|
audioCtx.onError((res) => {
|
|
15827
|
-
console.warn("
|
|
15828
|
-
console.warn("message", res.errMsg);
|
|
15793
|
+
console.warn("onError", res.errCode, res.errMsg);
|
|
15829
15794
|
});
|
|
15830
15795
|
function formatSeconds(value) {
|
|
15831
15796
|
if (!value) {
|