@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.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v2.6.
|
|
2
|
+
* @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:18:42 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -304,7 +304,7 @@ const Button = React__default.forwardRef(
|
|
|
304
304
|
};
|
|
305
305
|
const getStyle = useCallback(() => {
|
|
306
306
|
const style2 = {};
|
|
307
|
-
if (
|
|
307
|
+
if (color) {
|
|
308
308
|
if (props.fill === "outline" || props.fill === "dashed") {
|
|
309
309
|
style2.color = color;
|
|
310
310
|
if (!(color == null ? void 0 : color.includes("gradient"))) {
|
|
@@ -317,7 +317,7 @@ const Button = React__default.forwardRef(
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
return style2;
|
|
320
|
-
}, [color]);
|
|
320
|
+
}, [color, props.fill]);
|
|
321
321
|
const handleClick = (e2) => {
|
|
322
322
|
if (!loading && !disabled && onClick) {
|
|
323
323
|
onClick(e2);
|
|
@@ -3945,7 +3945,7 @@ function useWatch(dep, callback, config2 = { immediate: false }) {
|
|
|
3945
3945
|
stop.current = true;
|
|
3946
3946
|
};
|
|
3947
3947
|
}
|
|
3948
|
-
const inBrowser = typeof document !== "undefined" && !!document.scripts;
|
|
3948
|
+
const inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
|
|
3949
3949
|
function isWindow(val) {
|
|
3950
3950
|
return val === window;
|
|
3951
3951
|
}
|
|
@@ -3987,7 +3987,7 @@ function makeRect(width, height) {
|
|
|
3987
3987
|
}
|
|
3988
3988
|
const getRectByTaro = async (element) => {
|
|
3989
3989
|
if (element) {
|
|
3990
|
-
if (inBrowser) {
|
|
3990
|
+
if (inBrowser$1) {
|
|
3991
3991
|
return Promise.resolve(getRect(element));
|
|
3992
3992
|
}
|
|
3993
3993
|
return new Promise((resolve, reject) => {
|
|
@@ -4152,11 +4152,16 @@ const BackTop = (props) => {
|
|
|
4152
4152
|
...props
|
|
4153
4153
|
};
|
|
4154
4154
|
const classPrefix2 = "nut-backtop";
|
|
4155
|
-
const [backTop,
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4155
|
+
const [backTop, setBackTop] = useState(false);
|
|
4156
|
+
const cls = classNames(classPrefix2, { show: backTop }, className);
|
|
4157
|
+
const handleScroll = useCallback(
|
|
4158
|
+
(res) => {
|
|
4159
|
+
const { scrollTop } = res;
|
|
4160
|
+
setBackTop(scrollTop >= threshold);
|
|
4161
|
+
},
|
|
4162
|
+
[threshold]
|
|
4163
|
+
);
|
|
4164
|
+
usePageScroll(handleScroll);
|
|
4160
4165
|
const goTop = (e2) => {
|
|
4161
4166
|
onClick && onClick(e2);
|
|
4162
4167
|
pageScrollTo({
|
|
@@ -4172,23 +4177,7 @@ const BackTop = (props) => {
|
|
|
4172
4177
|
bottom: "20px",
|
|
4173
4178
|
zIndex
|
|
4174
4179
|
};
|
|
4175
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
4176
|
-
"div",
|
|
4177
|
-
{
|
|
4178
|
-
className: classNames(
|
|
4179
|
-
classPrefix2,
|
|
4180
|
-
{
|
|
4181
|
-
show: backTop
|
|
4182
|
-
},
|
|
4183
|
-
className
|
|
4184
|
-
),
|
|
4185
|
-
style: styles,
|
|
4186
|
-
onClick: (e2) => {
|
|
4187
|
-
goTop(e2);
|
|
4188
|
-
}
|
|
4189
|
-
},
|
|
4190
|
-
children || /* @__PURE__ */ React__default.createElement(N, { size: 19, className: "nut-backtop-main" })
|
|
4191
|
-
);
|
|
4180
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: cls, style: styles, onClick: (e2) => goTop(e2) }, children || /* @__PURE__ */ React__default.createElement(N, { size: 19, className: "nut-backtop-main" }));
|
|
4192
4181
|
};
|
|
4193
4182
|
BackTop.displayName = "NutBackTop";
|
|
4194
4183
|
const elevatorContext = createContext({});
|
|
@@ -4612,11 +4601,10 @@ const NavBar = (props) => {
|
|
|
4612
4601
|
};
|
|
4613
4602
|
const classes = classNames({
|
|
4614
4603
|
[`${classPrefix2}-fixed`]: fixed,
|
|
4615
|
-
[`${classPrefix2}-safe-area-inset-top`]: safeAreaInsetTop,
|
|
4616
4604
|
[`${classPrefix2}-title-align-${titleAlign}`]: true
|
|
4617
4605
|
});
|
|
4618
4606
|
const cls = classNames(classPrefix2, classes, className);
|
|
4619
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4607
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React__default.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4620
4608
|
};
|
|
4621
4609
|
NavBar.displayName = "NutNavBar";
|
|
4622
4610
|
const defaultProps$1f = {
|
|
@@ -5204,8 +5192,9 @@ const TabPane = (props) => {
|
|
|
5204
5192
|
);
|
|
5205
5193
|
return children ? /* @__PURE__ */ React__default.createElement("div", { className: classes }, !disabled && children) : null;
|
|
5206
5194
|
};
|
|
5195
|
+
const inBrowser = typeof window !== "undefined";
|
|
5207
5196
|
function requestAniFrame() {
|
|
5208
|
-
if (
|
|
5197
|
+
if (inBrowser) {
|
|
5209
5198
|
const _window = window;
|
|
5210
5199
|
return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
|
|
5211
5200
|
_window.setTimeout(callback, 1e3 / 60);
|
|
@@ -6511,6 +6500,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6511
6500
|
renderDay,
|
|
6512
6501
|
renderDayTop,
|
|
6513
6502
|
renderDayBottom,
|
|
6503
|
+
renderBottomButton,
|
|
6514
6504
|
value,
|
|
6515
6505
|
onConfirm,
|
|
6516
6506
|
onUpdate,
|
|
@@ -7061,7 +7051,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
7061
7051
|
);
|
|
7062
7052
|
};
|
|
7063
7053
|
const renderFooter = () => {
|
|
7064
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React__default.createElement("div", { className: "calendar-confirm-btn"
|
|
7054
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React__default.createElement("div", { onClick: confirm }, renderBottomButton ? renderBottomButton() : /* @__PURE__ */ React__default.createElement("div", { className: "calendar-confirm-btn" }, confirmText || locale.confirm)));
|
|
7065
7055
|
};
|
|
7066
7056
|
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
7067
7057
|
});
|
|
@@ -7120,8 +7110,10 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7120
7110
|
showSubTitle,
|
|
7121
7111
|
scrollAnimation,
|
|
7122
7112
|
firstDayOfWeek,
|
|
7113
|
+
closeIcon,
|
|
7123
7114
|
disableDate,
|
|
7124
7115
|
renderHeaderButtons,
|
|
7116
|
+
renderBottomButton,
|
|
7125
7117
|
renderDay,
|
|
7126
7118
|
renderDayTop,
|
|
7127
7119
|
renderDayBottom,
|
|
@@ -7179,6 +7171,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7179
7171
|
firstDayOfWeek,
|
|
7180
7172
|
disableDate,
|
|
7181
7173
|
renderHeaderButtons,
|
|
7174
|
+
renderBottomButton,
|
|
7182
7175
|
renderDay,
|
|
7183
7176
|
renderDayTop,
|
|
7184
7177
|
renderDayBottom,
|
|
@@ -7199,7 +7192,8 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7199
7192
|
destroyOnClose: true,
|
|
7200
7193
|
onOverlayClick: closePopup,
|
|
7201
7194
|
onCloseIconClick: closePopup,
|
|
7202
|
-
style: { height: "83%" }
|
|
7195
|
+
style: { height: "83%" },
|
|
7196
|
+
closeIcon
|
|
7203
7197
|
},
|
|
7204
7198
|
renderItem()
|
|
7205
7199
|
) : renderItem());
|
|
@@ -10759,9 +10753,19 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10759
10753
|
useEffect(() => {
|
|
10760
10754
|
setShowPopup(show2);
|
|
10761
10755
|
}, [show2]);
|
|
10756
|
+
const getParentOffset = useCallback(() => {
|
|
10757
|
+
setTimeout(async () => {
|
|
10758
|
+
const p = parent.menuRef.current;
|
|
10759
|
+
const rect = await getRectByTaro(p);
|
|
10760
|
+
setPosition({
|
|
10761
|
+
height: rect.height,
|
|
10762
|
+
top: rect.top
|
|
10763
|
+
});
|
|
10764
|
+
}, 100);
|
|
10765
|
+
}, [parent.menuRef]);
|
|
10762
10766
|
useEffect(() => {
|
|
10763
10767
|
getParentOffset();
|
|
10764
|
-
}, [showPopup]);
|
|
10768
|
+
}, [showPopup, getParentOffset]);
|
|
10765
10769
|
const windowHeight = useMemo$1(() => getSystemInfoSync().windowHeight, []);
|
|
10766
10770
|
const updateItemOffset = useCallback(() => {
|
|
10767
10771
|
if (!parent.lockScroll) return;
|
|
@@ -10774,7 +10778,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10774
10778
|
});
|
|
10775
10779
|
}
|
|
10776
10780
|
});
|
|
10777
|
-
}, [direction, windowHeight]);
|
|
10781
|
+
}, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
|
|
10778
10782
|
usePageScroll(updateItemOffset);
|
|
10779
10783
|
useImperativeHandle(ref, () => ({
|
|
10780
10784
|
toggle: (s) => {
|
|
@@ -10802,16 +10806,6 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10802
10806
|
top: 0,
|
|
10803
10807
|
height: 0
|
|
10804
10808
|
});
|
|
10805
|
-
const getParentOffset = () => {
|
|
10806
|
-
setTimeout(async () => {
|
|
10807
|
-
const p = parent.menuRef.current;
|
|
10808
|
-
const rect = await getRectByTaro(p);
|
|
10809
|
-
setPosition({
|
|
10810
|
-
height: rect.height,
|
|
10811
|
-
top: rect.top
|
|
10812
|
-
});
|
|
10813
|
-
}, 100);
|
|
10814
|
-
};
|
|
10815
10809
|
const isShow = () => {
|
|
10816
10810
|
if (showPopup) return {};
|
|
10817
10811
|
return { display: "none" };
|
|
@@ -10956,24 +10950,29 @@ const Menu = (props) => {
|
|
|
10956
10950
|
...props
|
|
10957
10951
|
};
|
|
10958
10952
|
const menuRef = useRef(null);
|
|
10953
|
+
const [showMenuItem, setShowMenuItem] = useState([]);
|
|
10954
|
+
const [menuItemTitle, setMenuItemTitle] = useState([]);
|
|
10959
10955
|
const [isScrollFixed, setIsScrollFixed] = useState(false);
|
|
10956
|
+
const cls = classNames(`nut-menu`, className, {
|
|
10957
|
+
"scroll-fixed": isScrollFixed
|
|
10958
|
+
});
|
|
10960
10959
|
const getScrollTop = (el) => {
|
|
10961
|
-
return Math.max(
|
|
10960
|
+
return Math.max(
|
|
10961
|
+
0,
|
|
10962
|
+
el === window ? window.scrollY : el.scrollTop
|
|
10963
|
+
);
|
|
10962
10964
|
};
|
|
10963
|
-
const onScroll = () => {
|
|
10964
|
-
const { scrollFixed: scrollFixed2 } = props;
|
|
10965
|
+
const onScroll = useCallback(() => {
|
|
10965
10966
|
const scrollTop = getScrollTop(window);
|
|
10966
|
-
const isFixed = scrollTop > (typeof
|
|
10967
|
+
const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
|
|
10967
10968
|
setIsScrollFixed(isFixed);
|
|
10968
|
-
};
|
|
10969
|
+
}, [scrollFixed]);
|
|
10969
10970
|
useEffect(() => {
|
|
10970
10971
|
if (scrollFixed) {
|
|
10971
10972
|
window.addEventListener("scroll", onScroll);
|
|
10972
10973
|
}
|
|
10973
10974
|
return () => window.removeEventListener("scroll", onScroll);
|
|
10974
|
-
}, []);
|
|
10975
|
-
const [showMenuItem, setShowMenuItem] = useState([]);
|
|
10976
|
-
const [menuItemTitle, setMenuItemTitle] = useState([]);
|
|
10975
|
+
}, [scrollFixed, onScroll]);
|
|
10977
10976
|
const toggleMenuItem = (index, from = "NORMAL") => {
|
|
10978
10977
|
showMenuItem[index] = !showMenuItem[index];
|
|
10979
10978
|
if (showMenuItem[index]) {
|
|
@@ -11076,26 +11075,15 @@ const Menu = (props) => {
|
|
|
11076
11075
|
return null;
|
|
11077
11076
|
});
|
|
11078
11077
|
};
|
|
11079
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11078
|
+
return /* @__PURE__ */ React__default.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React__default.createElement(
|
|
11080
11079
|
"div",
|
|
11081
11080
|
{
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
}),
|
|
11086
|
-
ref: menuRef
|
|
11081
|
+
className: classNames("nut-menu-bar", {
|
|
11082
|
+
opened: showMenuItem.includes(true)
|
|
11083
|
+
})
|
|
11087
11084
|
},
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
{
|
|
11091
|
-
className: classNames("nut-menu-bar", {
|
|
11092
|
-
opened: showMenuItem.includes(true)
|
|
11093
|
-
})
|
|
11094
|
-
},
|
|
11095
|
-
menuTitle()
|
|
11096
|
-
),
|
|
11097
|
-
cloneChildren()
|
|
11098
|
-
);
|
|
11085
|
+
menuTitle()
|
|
11086
|
+
), cloneChildren());
|
|
11099
11087
|
};
|
|
11100
11088
|
Menu.displayName = "NutMenu";
|
|
11101
11089
|
Menu.Item = MenuItem;
|
|
@@ -11286,6 +11274,13 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11286
11274
|
disabled,
|
|
11287
11275
|
...rest
|
|
11288
11276
|
} = { ...defaultProps$R, ...props };
|
|
11277
|
+
const cls = classNames(
|
|
11278
|
+
classPrefix$g,
|
|
11279
|
+
{
|
|
11280
|
+
[`${classPrefix$g}-${props.direction}`]: props.direction
|
|
11281
|
+
},
|
|
11282
|
+
className
|
|
11283
|
+
);
|
|
11289
11284
|
const [val2State, setVal2State] = usePropsValue({
|
|
11290
11285
|
defaultValue: props.defaultValue,
|
|
11291
11286
|
value: props.value,
|
|
@@ -11308,7 +11303,7 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11308
11303
|
}
|
|
11309
11304
|
);
|
|
11310
11305
|
});
|
|
11311
|
-
}, [options]);
|
|
11306
|
+
}, [options, labelPosition, val2State]);
|
|
11312
11307
|
return /* @__PURE__ */ React__default.createElement(
|
|
11313
11308
|
RadioContext.Provider,
|
|
11314
11309
|
{
|
|
@@ -11325,20 +11320,7 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11325
11320
|
}
|
|
11326
11321
|
}
|
|
11327
11322
|
},
|
|
11328
|
-
/* @__PURE__ */ React__default.createElement(
|
|
11329
|
-
"div",
|
|
11330
|
-
{
|
|
11331
|
-
className: classNames(
|
|
11332
|
-
classPrefix$g,
|
|
11333
|
-
{
|
|
11334
|
-
[`${classPrefix$g}-${props.direction}`]: props.direction
|
|
11335
|
-
},
|
|
11336
|
-
className
|
|
11337
|
-
),
|
|
11338
|
-
...rest
|
|
11339
|
-
},
|
|
11340
|
-
(options == null ? void 0 : options.length) ? renderOptionsChildren() : children
|
|
11341
|
-
)
|
|
11323
|
+
/* @__PURE__ */ React__default.createElement("div", { className: cls, ...rest }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : children)
|
|
11342
11324
|
);
|
|
11343
11325
|
}
|
|
11344
11326
|
);
|
|
@@ -11396,29 +11378,6 @@ const Radio = (props) => {
|
|
|
11396
11378
|
}
|
|
11397
11379
|
};
|
|
11398
11380
|
}
|
|
11399
|
-
const renderLabel = () => {
|
|
11400
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11401
|
-
"div",
|
|
11402
|
-
{
|
|
11403
|
-
className: classNames(`${classPrefix2}-label`, {
|
|
11404
|
-
[`${classPrefix2}-label-disabled`]: disabled
|
|
11405
|
-
})
|
|
11406
|
-
},
|
|
11407
|
-
children
|
|
11408
|
-
);
|
|
11409
|
-
};
|
|
11410
|
-
const renderButton = () => {
|
|
11411
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11412
|
-
"div",
|
|
11413
|
-
{
|
|
11414
|
-
className: classNames(`${classPrefix2}-button`, {
|
|
11415
|
-
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
11416
|
-
[`${classPrefix2}-button-disabled`]: disabled
|
|
11417
|
-
})
|
|
11418
|
-
},
|
|
11419
|
-
children
|
|
11420
|
-
);
|
|
11421
|
-
};
|
|
11422
11381
|
const color = () => {
|
|
11423
11382
|
return {
|
|
11424
11383
|
[`${classPrefix2}-icon-disabled`]: disabled,
|
|
@@ -11442,8 +11401,21 @@ const Radio = (props) => {
|
|
|
11442
11401
|
className: classNames(color())
|
|
11443
11402
|
}) : /* @__PURE__ */ React__default.createElement(A, { className: classNames(color()) });
|
|
11444
11403
|
};
|
|
11404
|
+
const renderLabel = () => {
|
|
11405
|
+
const labelcls = classNames(`${classPrefix2}-label`, {
|
|
11406
|
+
[`${classPrefix2}-label-disabled`]: disabled
|
|
11407
|
+
});
|
|
11408
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), /* @__PURE__ */ React__default.createElement("div", { className: labelcls }, children));
|
|
11409
|
+
};
|
|
11410
|
+
const renderButton = () => {
|
|
11411
|
+
const buttoncls = classNames(`${classPrefix2}-button`, {
|
|
11412
|
+
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
11413
|
+
[`${classPrefix2}-button-disabled`]: disabled
|
|
11414
|
+
});
|
|
11415
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: buttoncls }, children);
|
|
11416
|
+
};
|
|
11445
11417
|
const renderByShape = (shape2) => {
|
|
11446
|
-
return shape2 === "button" ? renderButton() :
|
|
11418
|
+
return shape2 === "button" ? renderButton() : renderLabel();
|
|
11447
11419
|
};
|
|
11448
11420
|
const renderRadioItem = () => {
|
|
11449
11421
|
return renderByShape(context && context.shape ? context.shape : shape);
|
|
@@ -11452,22 +11424,14 @@ const Radio = (props) => {
|
|
|
11452
11424
|
if (disabled || checkedStatement) return;
|
|
11453
11425
|
setCheckedStatement(!checkedStatement);
|
|
11454
11426
|
};
|
|
11455
|
-
|
|
11456
|
-
|
|
11427
|
+
const cls = classNames(
|
|
11428
|
+
classPrefix2,
|
|
11457
11429
|
{
|
|
11458
|
-
|
|
11459
|
-
classPrefix2,
|
|
11460
|
-
{
|
|
11461
|
-
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11462
|
-
},
|
|
11463
|
-
className
|
|
11464
|
-
),
|
|
11465
|
-
style,
|
|
11466
|
-
onClick: handleClick,
|
|
11467
|
-
...rest
|
|
11430
|
+
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11468
11431
|
},
|
|
11469
|
-
|
|
11432
|
+
className
|
|
11470
11433
|
);
|
|
11434
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: cls, style, onClick: handleClick, ...rest }, renderRadioItem());
|
|
11471
11435
|
};
|
|
11472
11436
|
Radio.displayName = "NutRadio";
|
|
11473
11437
|
Radio.Group = RadioGroup;
|
|
@@ -11489,9 +11453,6 @@ const Range = (props) => {
|
|
|
11489
11453
|
button,
|
|
11490
11454
|
vertical,
|
|
11491
11455
|
marks,
|
|
11492
|
-
onChange,
|
|
11493
|
-
onStart,
|
|
11494
|
-
onEnd,
|
|
11495
11456
|
minDescription,
|
|
11496
11457
|
maxDescription,
|
|
11497
11458
|
currentDescription,
|
|
@@ -11499,7 +11460,10 @@ const Range = (props) => {
|
|
|
11499
11460
|
max,
|
|
11500
11461
|
step,
|
|
11501
11462
|
value,
|
|
11502
|
-
defaultValue
|
|
11463
|
+
defaultValue,
|
|
11464
|
+
onChange,
|
|
11465
|
+
onStart,
|
|
11466
|
+
onEnd
|
|
11503
11467
|
} = { ...defaultProps$P, ...props };
|
|
11504
11468
|
const classPrefix2 = "nut-range";
|
|
11505
11469
|
const [buttonIndex, setButtonIndex] = useState(0);
|
|
@@ -11517,7 +11481,7 @@ const Range = (props) => {
|
|
|
11517
11481
|
finalValue: 0,
|
|
11518
11482
|
onChange: handleChange
|
|
11519
11483
|
});
|
|
11520
|
-
const [exactValue,
|
|
11484
|
+
const [exactValue, setExactValue] = useState(
|
|
11521
11485
|
() => value || defaultValue || 0
|
|
11522
11486
|
);
|
|
11523
11487
|
const marksRef = useRef({});
|
|
@@ -11535,10 +11499,7 @@ const Range = (props) => {
|
|
|
11535
11499
|
setMarksList(list);
|
|
11536
11500
|
}
|
|
11537
11501
|
}
|
|
11538
|
-
}, [marks]);
|
|
11539
|
-
const scope = () => {
|
|
11540
|
-
return max - min;
|
|
11541
|
-
};
|
|
11502
|
+
}, [marks, max, min]);
|
|
11542
11503
|
const classes = classNames(classPrefix2, {
|
|
11543
11504
|
[`${classPrefix2}-disabled`]: disabled,
|
|
11544
11505
|
[`${classPrefix2}-vertical`]: vertical
|
|
@@ -11550,41 +11511,38 @@ const Range = (props) => {
|
|
|
11550
11511
|
},
|
|
11551
11512
|
className
|
|
11552
11513
|
);
|
|
11553
|
-
const markClassName =
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
},
|
|
11570
|
-
[range3, current, min, max]
|
|
11571
|
-
);
|
|
11514
|
+
const markClassName = (mark) => {
|
|
11515
|
+
const classPrefix22 = "nut-range-mark";
|
|
11516
|
+
let lowerBound = min;
|
|
11517
|
+
let upperBound = max;
|
|
11518
|
+
if (range3 && Array.isArray(current)) {
|
|
11519
|
+
lowerBound = current[0];
|
|
11520
|
+
upperBound = current[1];
|
|
11521
|
+
} else {
|
|
11522
|
+
upperBound = current;
|
|
11523
|
+
}
|
|
11524
|
+
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
11525
|
+
return [
|
|
11526
|
+
`${classPrefix22}-text`,
|
|
11527
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
11528
|
+
].join(" ");
|
|
11529
|
+
};
|
|
11572
11530
|
const isRange = (val) => {
|
|
11573
11531
|
return !!range3 && Array.isArray(val);
|
|
11574
11532
|
};
|
|
11533
|
+
const scope = useMemo$1(() => {
|
|
11534
|
+
if (max < min || max === min) {
|
|
11535
|
+
console.log("max 的值需要大于 min的值");
|
|
11536
|
+
}
|
|
11537
|
+
return max - min;
|
|
11538
|
+
}, [max, min]);
|
|
11575
11539
|
const calcMainAxis = () => {
|
|
11576
11540
|
const modelVal = current;
|
|
11577
|
-
|
|
11578
|
-
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
11579
|
-
}
|
|
11580
|
-
return `${(modelVal - min) * 100 / scope()}%`;
|
|
11541
|
+
return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
|
|
11581
11542
|
};
|
|
11582
11543
|
const calcOffset = () => {
|
|
11583
11544
|
const modelVal = current;
|
|
11584
|
-
|
|
11585
|
-
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
11586
|
-
}
|
|
11587
|
-
return `0%`;
|
|
11545
|
+
return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
|
|
11588
11546
|
};
|
|
11589
11547
|
const barStyle = () => {
|
|
11590
11548
|
if (vertical) {
|
|
@@ -11604,11 +11562,11 @@ const Range = (props) => {
|
|
|
11604
11562
|
const marksStyle = (mark) => {
|
|
11605
11563
|
const dir = rtl ? "right" : "left";
|
|
11606
11564
|
let style = {
|
|
11607
|
-
[dir]: `${(mark - min) / scope
|
|
11565
|
+
[dir]: `${(mark - min) / scope * 100}%`
|
|
11608
11566
|
};
|
|
11609
11567
|
if (vertical) {
|
|
11610
11568
|
style = {
|
|
11611
|
-
top: `${(mark - min) / scope
|
|
11569
|
+
top: `${(mark - min) / scope * 100}%`
|
|
11612
11570
|
};
|
|
11613
11571
|
}
|
|
11614
11572
|
return style;
|
|
@@ -11655,8 +11613,8 @@ const Range = (props) => {
|
|
|
11655
11613
|
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
11656
11614
|
total = rect.height;
|
|
11657
11615
|
}
|
|
11658
|
-
const value2 = min + delta / total * scope
|
|
11659
|
-
|
|
11616
|
+
const value2 = min + delta / total * scope;
|
|
11617
|
+
setExactValue(current);
|
|
11660
11618
|
if (isRange(current)) {
|
|
11661
11619
|
const [left2, right2] = current;
|
|
11662
11620
|
const middle = (left2 + right2) / 2;
|
|
@@ -11674,7 +11632,7 @@ const Range = (props) => {
|
|
|
11674
11632
|
return;
|
|
11675
11633
|
}
|
|
11676
11634
|
touch.start(event);
|
|
11677
|
-
|
|
11635
|
+
setExactValue(current);
|
|
11678
11636
|
if (isRange(current)) {
|
|
11679
11637
|
setStartValue(current.map(format2));
|
|
11680
11638
|
} else {
|
|
@@ -11695,12 +11653,12 @@ const Range = (props) => {
|
|
|
11695
11653
|
if (!rect) return;
|
|
11696
11654
|
let delta = touch.deltaX.current;
|
|
11697
11655
|
let total = rect.width;
|
|
11698
|
-
let diff = delta / total * scope
|
|
11656
|
+
let diff = delta / total * scope;
|
|
11699
11657
|
diff = rtl ? -diff : diff;
|
|
11700
11658
|
if (vertical) {
|
|
11701
11659
|
delta = touch.deltaY.current;
|
|
11702
11660
|
total = rect.height;
|
|
11703
|
-
diff = delta / total * scope
|
|
11661
|
+
diff = delta / total * scope;
|
|
11704
11662
|
}
|
|
11705
11663
|
let newValue;
|
|
11706
11664
|
if (isRange(startValue)) {
|
|
@@ -11709,7 +11667,7 @@ const Range = (props) => {
|
|
|
11709
11667
|
} else {
|
|
11710
11668
|
newValue = startValue + diff;
|
|
11711
11669
|
}
|
|
11712
|
-
|
|
11670
|
+
setExactValue(newValue);
|
|
11713
11671
|
updateValue(newValue);
|
|
11714
11672
|
};
|
|
11715
11673
|
const onTouchEnd = () => {
|
|
@@ -11729,57 +11687,65 @@ const Range = (props) => {
|
|
|
11729
11687
|
const renderButton = (index) => {
|
|
11730
11688
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, button || /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-button" }, currentDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
|
|
11731
11689
|
};
|
|
11732
|
-
|
|
11733
|
-
return
|
|
11734
|
-
"
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
style: marksStyle(mark)
|
|
11739
|
-
},
|
|
11740
|
-
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
11741
|
-
/* @__PURE__ */ React__default.createElement(
|
|
11742
|
-
"span",
|
|
11690
|
+
const renderRangeButton = () => {
|
|
11691
|
+
return [0, 1].map((item, index) => {
|
|
11692
|
+
const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
11693
|
+
${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
|
|
11694
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11695
|
+
"div",
|
|
11743
11696
|
{
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
}
|
|
11748
|
-
)
|
|
11749
|
-
);
|
|
11750
|
-
})), /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? [0, 1].map((item, index) => {
|
|
11751
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11752
|
-
"div",
|
|
11753
|
-
{
|
|
11754
|
-
key: index,
|
|
11755
|
-
className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
11756
|
-
${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
|
|
11757
|
-
onTouchStart: (e2) => {
|
|
11758
|
-
if (typeof index === "number") {
|
|
11697
|
+
key: index,
|
|
11698
|
+
className: cls,
|
|
11699
|
+
onTouchStart: (e2) => {
|
|
11759
11700
|
setButtonIndex(index);
|
|
11760
|
-
|
|
11761
|
-
|
|
11701
|
+
onTouchStart(e2);
|
|
11702
|
+
},
|
|
11703
|
+
onTouchMove,
|
|
11704
|
+
onTouchEnd,
|
|
11705
|
+
onTouchCancel: onTouchEnd,
|
|
11706
|
+
onClick: (e2) => e2.stopPropagation()
|
|
11762
11707
|
},
|
|
11763
|
-
|
|
11708
|
+
renderButton(index)
|
|
11709
|
+
);
|
|
11710
|
+
});
|
|
11711
|
+
};
|
|
11712
|
+
const renderSingleButton = () => {
|
|
11713
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11714
|
+
View,
|
|
11715
|
+
{
|
|
11716
|
+
catchMove: true,
|
|
11717
|
+
className: "nut-range-button-wrapper",
|
|
11718
|
+
onTouchStart,
|
|
11719
|
+
onTouchMove,
|
|
11764
11720
|
onTouchEnd,
|
|
11765
11721
|
onTouchCancel: onTouchEnd,
|
|
11766
11722
|
onClick: (e2) => e2.stopPropagation()
|
|
11767
11723
|
},
|
|
11768
|
-
renderButton(
|
|
11724
|
+
renderButton()
|
|
11769
11725
|
);
|
|
11770
|
-
}
|
|
11771
|
-
|
|
11772
|
-
{
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11726
|
+
};
|
|
11727
|
+
const renderMark = () => {
|
|
11728
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
|
|
11729
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11730
|
+
"span",
|
|
11731
|
+
{
|
|
11732
|
+
key: mark,
|
|
11733
|
+
className: markClassName(mark),
|
|
11734
|
+
style: marksStyle(mark)
|
|
11735
|
+
},
|
|
11736
|
+
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
11737
|
+
/* @__PURE__ */ React__default.createElement(
|
|
11738
|
+
"span",
|
|
11739
|
+
{
|
|
11740
|
+
className: classNames("nut-range-tick", {
|
|
11741
|
+
active: tickClass(mark)
|
|
11742
|
+
})
|
|
11743
|
+
}
|
|
11744
|
+
)
|
|
11745
|
+
);
|
|
11746
|
+
})));
|
|
11747
|
+
};
|
|
11748
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React__default.createElement("div", { ref: root2, className: classes, onClick: (e2) => click(e2) }, renderMark(), /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? renderRangeButton() : renderSingleButton())), maxDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "max" }, maxDescription || max));
|
|
11783
11749
|
};
|
|
11784
11750
|
Range.displayName = "NutRange";
|
|
11785
11751
|
const defaultProps$O = {
|
|
@@ -15049,15 +15015,14 @@ const defaultProps$v = {
|
|
|
15049
15015
|
size: "",
|
|
15050
15016
|
shape: "round",
|
|
15051
15017
|
icon: "",
|
|
15052
|
-
fit: "cover",
|
|
15053
15018
|
background: "#eee",
|
|
15054
15019
|
color: "#666",
|
|
15020
|
+
fit: "cover",
|
|
15055
15021
|
src: "",
|
|
15056
15022
|
alt: ""
|
|
15057
15023
|
};
|
|
15058
15024
|
const classPrefix$a = `nut-avatar`;
|
|
15059
15025
|
const Avatar = (props) => {
|
|
15060
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
15061
15026
|
const {
|
|
15062
15027
|
children,
|
|
15063
15028
|
size,
|
|
@@ -15065,9 +15030,9 @@ const Avatar = (props) => {
|
|
|
15065
15030
|
background,
|
|
15066
15031
|
color,
|
|
15067
15032
|
src,
|
|
15033
|
+
alt,
|
|
15068
15034
|
icon,
|
|
15069
15035
|
fit,
|
|
15070
|
-
alt,
|
|
15071
15036
|
className,
|
|
15072
15037
|
style,
|
|
15073
15038
|
onClick,
|
|
@@ -15083,9 +15048,10 @@ const Avatar = (props) => {
|
|
|
15083
15048
|
const avatarRef = useRef(null);
|
|
15084
15049
|
const parent = useContext(AvatarContext);
|
|
15085
15050
|
const sizeValue = ["large", "normal", "small"];
|
|
15051
|
+
const { propAvatarGroup, avatarGroupRef } = parent;
|
|
15086
15052
|
const classes = classNames({
|
|
15087
|
-
[`nut-avatar-${(
|
|
15088
|
-
[`nut-avatar-${(
|
|
15053
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
|
|
15054
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
|
|
15089
15055
|
});
|
|
15090
15056
|
const cls = classNames(classPrefix$a, classes, className);
|
|
15091
15057
|
const styles = {
|
|
@@ -15093,52 +15059,52 @@ const Avatar = (props) => {
|
|
|
15093
15059
|
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
15094
15060
|
backgroundColor: `${background}`,
|
|
15095
15061
|
color,
|
|
15096
|
-
marginLeft: avatarIndex !== 1 && (
|
|
15097
|
-
zIndex: (
|
|
15062
|
+
marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
|
|
15063
|
+
zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
|
|
15098
15064
|
...style
|
|
15099
15065
|
};
|
|
15100
15066
|
const maxStyles = {
|
|
15101
|
-
backgroundColor: `${
|
|
15102
|
-
color: `${
|
|
15067
|
+
backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
|
|
15068
|
+
color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
|
|
15103
15069
|
};
|
|
15070
|
+
const avatarLength = useCallback(
|
|
15071
|
+
(children2) => {
|
|
15072
|
+
var _a, _b;
|
|
15073
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15074
|
+
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15075
|
+
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15076
|
+
}
|
|
15077
|
+
}
|
|
15078
|
+
const index = Number((_b = (_a = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
|
|
15079
|
+
const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
|
|
15080
|
+
setMaxSum(children2.length);
|
|
15081
|
+
setAvatarIndex(index);
|
|
15082
|
+
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15083
|
+
setShowMax(true);
|
|
15084
|
+
}
|
|
15085
|
+
},
|
|
15086
|
+
[propAvatarGroup == null ? void 0 : propAvatarGroup.max]
|
|
15087
|
+
);
|
|
15104
15088
|
useEffect(() => {
|
|
15105
|
-
|
|
15106
|
-
const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
|
|
15089
|
+
const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
|
|
15107
15090
|
if (avatarChildren) {
|
|
15108
15091
|
avatarLength(avatarChildren);
|
|
15109
15092
|
}
|
|
15110
|
-
}, []);
|
|
15093
|
+
}, [avatarLength, avatarGroupRef]);
|
|
15111
15094
|
const isAvatarInClassList = (element) => {
|
|
15112
|
-
var
|
|
15095
|
+
var _a, _b;
|
|
15113
15096
|
if (getEnv() === Taro.ENV_TYPE.WEB) {
|
|
15114
15097
|
return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
|
|
15115
15098
|
}
|
|
15116
|
-
return ((
|
|
15117
|
-
};
|
|
15118
|
-
const avatarLength = (children2) => {
|
|
15119
|
-
var _a2, _b2, _c2;
|
|
15120
|
-
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15121
|
-
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15122
|
-
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15123
|
-
}
|
|
15124
|
-
}
|
|
15125
|
-
const index = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
|
|
15126
|
-
const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
|
|
15127
|
-
setMaxSum(children2.length);
|
|
15128
|
-
setAvatarIndex(index);
|
|
15129
|
-
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15130
|
-
setShowMax(true);
|
|
15131
|
-
}
|
|
15099
|
+
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";
|
|
15132
15100
|
};
|
|
15133
15101
|
const errorEvent = () => {
|
|
15134
|
-
|
|
15135
|
-
onError();
|
|
15136
|
-
}
|
|
15102
|
+
onError && onError();
|
|
15137
15103
|
};
|
|
15138
15104
|
const clickAvatar = (e2) => {
|
|
15139
15105
|
onClick && onClick(e2);
|
|
15140
15106
|
};
|
|
15141
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !(
|
|
15107
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React__default.createElement(
|
|
15142
15108
|
"div",
|
|
15143
15109
|
{
|
|
15144
15110
|
className: cls,
|
|
@@ -15147,7 +15113,7 @@ const Avatar = (props) => {
|
|
|
15147
15113
|
onClick: clickAvatar,
|
|
15148
15114
|
ref: avatarRef
|
|
15149
15115
|
},
|
|
15150
|
-
(!(
|
|
15116
|
+
(!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, src && /* @__PURE__ */ React__default.createElement(
|
|
15151
15117
|
Image$1,
|
|
15152
15118
|
{
|
|
15153
15119
|
className: "avatar-img",
|
|
@@ -15159,7 +15125,7 @@ const Avatar = (props) => {
|
|
|
15159
15125
|
...icon.props,
|
|
15160
15126
|
className: `${icon.props.className || ""} icon`
|
|
15161
15127
|
}) : null, children && /* @__PURE__ */ React__default.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React__default.createElement(D, { className: "icon" })),
|
|
15162
|
-
showMax && /* @__PURE__ */ React__default.createElement("div", { className: "text" }, (
|
|
15128
|
+
showMax && /* @__PURE__ */ React__default.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)}`)
|
|
15163
15129
|
));
|
|
15164
15130
|
};
|
|
15165
15131
|
Avatar.displayName = "NutAvatar";
|
|
@@ -15624,22 +15590,22 @@ const CountUp = (props) => {
|
|
|
15624
15590
|
className,
|
|
15625
15591
|
thousands,
|
|
15626
15592
|
style,
|
|
15627
|
-
...
|
|
15593
|
+
...rest
|
|
15628
15594
|
} = mergeProps(defaultProps$q, props);
|
|
15629
15595
|
const classPrefix2 = "nut-countup";
|
|
15630
15596
|
const countupRef = useRef(null);
|
|
15631
15597
|
const timerRef = useRef(0);
|
|
15632
15598
|
const numbers = Array.from({ length: 10 }, (v, i2) => i2);
|
|
15633
|
-
const getShowNumber = () => {
|
|
15599
|
+
const getShowNumber = useCallback(() => {
|
|
15634
15600
|
const splitArr = value.split(".");
|
|
15635
15601
|
const intNumber = length && splitArr[0].length < length ? (Array(length).join("0") + splitArr[0]).slice(-length) : splitArr[0];
|
|
15636
15602
|
const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
|
|
15637
15603
|
return currNumber.split("");
|
|
15638
|
-
};
|
|
15604
|
+
}, [length, thousands, value]);
|
|
15639
15605
|
const [numerArr, setNumerArr] = useState([]);
|
|
15640
15606
|
const [transformArr, setTransformArr] = useState([]);
|
|
15641
15607
|
const isLoaded = useRef(false);
|
|
15642
|
-
const setNumberTransform = () => {
|
|
15608
|
+
const setNumberTransform = useCallback(() => {
|
|
15643
15609
|
if (countupRef.current && numerArr.length) {
|
|
15644
15610
|
createSelectorQuery().selectAll(".nut-countup-listitem").node((numberItems) => {
|
|
15645
15611
|
const transformArrCache = [];
|
|
@@ -15654,7 +15620,7 @@ const CountUp = (props) => {
|
|
|
15654
15620
|
setTransformArr([...transformArrCache]);
|
|
15655
15621
|
}).exec();
|
|
15656
15622
|
}
|
|
15657
|
-
};
|
|
15623
|
+
}, [numerArr]);
|
|
15658
15624
|
const numberEaseStyle = (idx) => {
|
|
15659
15625
|
return {
|
|
15660
15626
|
transition: `transform ${duration}s ease-in-out`,
|
|
@@ -15663,7 +15629,7 @@ const CountUp = (props) => {
|
|
|
15663
15629
|
};
|
|
15664
15630
|
useEffect(() => {
|
|
15665
15631
|
setNumberTransform();
|
|
15666
|
-
}, [numerArr]);
|
|
15632
|
+
}, [numerArr, setNumberTransform]);
|
|
15667
15633
|
useEffect(() => {
|
|
15668
15634
|
if (!isLoaded.current) {
|
|
15669
15635
|
isLoaded.current = true;
|
|
@@ -15676,7 +15642,7 @@ const CountUp = (props) => {
|
|
|
15676
15642
|
return () => {
|
|
15677
15643
|
window.clearTimeout(timerRef.current);
|
|
15678
15644
|
};
|
|
15679
|
-
}, [value]);
|
|
15645
|
+
}, [value, delay, getShowNumber]);
|
|
15680
15646
|
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React__default.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
|
|
15681
15647
|
return /* @__PURE__ */ React__default.createElement(
|
|
15682
15648
|
"li",
|
|
@@ -15791,7 +15757,7 @@ const Audio = (props) => {
|
|
|
15791
15757
|
onPlay == null ? void 0 : onPlay(audioCtx);
|
|
15792
15758
|
});
|
|
15793
15759
|
audioCtx.onCanplay(() => {
|
|
15794
|
-
const intervalID = setInterval(
|
|
15760
|
+
const intervalID = setInterval(() => {
|
|
15795
15761
|
if (audioCtx.duration !== 0) {
|
|
15796
15762
|
setTotalSeconds(audioCtx.duration);
|
|
15797
15763
|
clearInterval(intervalID);
|
|
@@ -15808,8 +15774,7 @@ const Audio = (props) => {
|
|
|
15808
15774
|
setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
|
|
15809
15775
|
});
|
|
15810
15776
|
audioCtx.onError((res) => {
|
|
15811
|
-
console.warn("
|
|
15812
|
-
console.warn("message", res.errMsg);
|
|
15777
|
+
console.warn("onError", res.errCode, res.errMsg);
|
|
15813
15778
|
});
|
|
15814
15779
|
function formatSeconds(value) {
|
|
15815
15780
|
if (!value) {
|