@nutui/nutui-react-taro 2.6.21 → 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 +22 -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/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/{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 +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 +211 -251
- package/dist/nutui.react.umd.js +211 -251
- 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/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.22 Sat Oct 12 2024 15:01:29 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);
|
|
@@ -10759,9 +10748,19 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10759
10748
|
useEffect(() => {
|
|
10760
10749
|
setShowPopup(show2);
|
|
10761
10750
|
}, [show2]);
|
|
10751
|
+
const getParentOffset = useCallback(() => {
|
|
10752
|
+
setTimeout(async () => {
|
|
10753
|
+
const p = parent.menuRef.current;
|
|
10754
|
+
const rect = await getRectByTaro(p);
|
|
10755
|
+
setPosition({
|
|
10756
|
+
height: rect.height,
|
|
10757
|
+
top: rect.top
|
|
10758
|
+
});
|
|
10759
|
+
}, 100);
|
|
10760
|
+
}, [parent.menuRef]);
|
|
10762
10761
|
useEffect(() => {
|
|
10763
10762
|
getParentOffset();
|
|
10764
|
-
}, [showPopup]);
|
|
10763
|
+
}, [showPopup, getParentOffset]);
|
|
10765
10764
|
const windowHeight = useMemo$1(() => getSystemInfoSync().windowHeight, []);
|
|
10766
10765
|
const updateItemOffset = useCallback(() => {
|
|
10767
10766
|
if (!parent.lockScroll) return;
|
|
@@ -10774,7 +10773,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10774
10773
|
});
|
|
10775
10774
|
}
|
|
10776
10775
|
});
|
|
10777
|
-
}, [direction, windowHeight]);
|
|
10776
|
+
}, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
|
|
10778
10777
|
usePageScroll(updateItemOffset);
|
|
10779
10778
|
useImperativeHandle(ref, () => ({
|
|
10780
10779
|
toggle: (s) => {
|
|
@@ -10802,16 +10801,6 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10802
10801
|
top: 0,
|
|
10803
10802
|
height: 0
|
|
10804
10803
|
});
|
|
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
10804
|
const isShow = () => {
|
|
10816
10805
|
if (showPopup) return {};
|
|
10817
10806
|
return { display: "none" };
|
|
@@ -10956,24 +10945,29 @@ const Menu = (props) => {
|
|
|
10956
10945
|
...props
|
|
10957
10946
|
};
|
|
10958
10947
|
const menuRef = useRef(null);
|
|
10948
|
+
const [showMenuItem, setShowMenuItem] = useState([]);
|
|
10949
|
+
const [menuItemTitle, setMenuItemTitle] = useState([]);
|
|
10959
10950
|
const [isScrollFixed, setIsScrollFixed] = useState(false);
|
|
10951
|
+
const cls = classNames(`nut-menu`, className, {
|
|
10952
|
+
"scroll-fixed": isScrollFixed
|
|
10953
|
+
});
|
|
10960
10954
|
const getScrollTop = (el) => {
|
|
10961
|
-
return Math.max(
|
|
10955
|
+
return Math.max(
|
|
10956
|
+
0,
|
|
10957
|
+
el === window ? window.scrollY : el.scrollTop
|
|
10958
|
+
);
|
|
10962
10959
|
};
|
|
10963
|
-
const onScroll = () => {
|
|
10964
|
-
const { scrollFixed: scrollFixed2 } = props;
|
|
10960
|
+
const onScroll = useCallback(() => {
|
|
10965
10961
|
const scrollTop = getScrollTop(window);
|
|
10966
|
-
const isFixed = scrollTop > (typeof
|
|
10962
|
+
const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
|
|
10967
10963
|
setIsScrollFixed(isFixed);
|
|
10968
|
-
};
|
|
10964
|
+
}, [scrollFixed]);
|
|
10969
10965
|
useEffect(() => {
|
|
10970
10966
|
if (scrollFixed) {
|
|
10971
10967
|
window.addEventListener("scroll", onScroll);
|
|
10972
10968
|
}
|
|
10973
10969
|
return () => window.removeEventListener("scroll", onScroll);
|
|
10974
|
-
}, []);
|
|
10975
|
-
const [showMenuItem, setShowMenuItem] = useState([]);
|
|
10976
|
-
const [menuItemTitle, setMenuItemTitle] = useState([]);
|
|
10970
|
+
}, [scrollFixed, onScroll]);
|
|
10977
10971
|
const toggleMenuItem = (index, from = "NORMAL") => {
|
|
10978
10972
|
showMenuItem[index] = !showMenuItem[index];
|
|
10979
10973
|
if (showMenuItem[index]) {
|
|
@@ -11076,26 +11070,15 @@ const Menu = (props) => {
|
|
|
11076
11070
|
return null;
|
|
11077
11071
|
});
|
|
11078
11072
|
};
|
|
11079
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
11073
|
+
return /* @__PURE__ */ React__default.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React__default.createElement(
|
|
11080
11074
|
"div",
|
|
11081
11075
|
{
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
}),
|
|
11086
|
-
ref: menuRef
|
|
11076
|
+
className: classNames("nut-menu-bar", {
|
|
11077
|
+
opened: showMenuItem.includes(true)
|
|
11078
|
+
})
|
|
11087
11079
|
},
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
{
|
|
11091
|
-
className: classNames("nut-menu-bar", {
|
|
11092
|
-
opened: showMenuItem.includes(true)
|
|
11093
|
-
})
|
|
11094
|
-
},
|
|
11095
|
-
menuTitle()
|
|
11096
|
-
),
|
|
11097
|
-
cloneChildren()
|
|
11098
|
-
);
|
|
11080
|
+
menuTitle()
|
|
11081
|
+
), cloneChildren());
|
|
11099
11082
|
};
|
|
11100
11083
|
Menu.displayName = "NutMenu";
|
|
11101
11084
|
Menu.Item = MenuItem;
|
|
@@ -11286,6 +11269,13 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11286
11269
|
disabled,
|
|
11287
11270
|
...rest
|
|
11288
11271
|
} = { ...defaultProps$R, ...props };
|
|
11272
|
+
const cls = classNames(
|
|
11273
|
+
classPrefix$g,
|
|
11274
|
+
{
|
|
11275
|
+
[`${classPrefix$g}-${props.direction}`]: props.direction
|
|
11276
|
+
},
|
|
11277
|
+
className
|
|
11278
|
+
);
|
|
11289
11279
|
const [val2State, setVal2State] = usePropsValue({
|
|
11290
11280
|
defaultValue: props.defaultValue,
|
|
11291
11281
|
value: props.value,
|
|
@@ -11308,7 +11298,7 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11308
11298
|
}
|
|
11309
11299
|
);
|
|
11310
11300
|
});
|
|
11311
|
-
}, [options]);
|
|
11301
|
+
}, [options, labelPosition, val2State]);
|
|
11312
11302
|
return /* @__PURE__ */ React__default.createElement(
|
|
11313
11303
|
RadioContext.Provider,
|
|
11314
11304
|
{
|
|
@@ -11325,20 +11315,7 @@ const RadioGroup = React__default.forwardRef(
|
|
|
11325
11315
|
}
|
|
11326
11316
|
}
|
|
11327
11317
|
},
|
|
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
|
-
)
|
|
11318
|
+
/* @__PURE__ */ React__default.createElement("div", { className: cls, ...rest }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : children)
|
|
11342
11319
|
);
|
|
11343
11320
|
}
|
|
11344
11321
|
);
|
|
@@ -11396,29 +11373,6 @@ const Radio = (props) => {
|
|
|
11396
11373
|
}
|
|
11397
11374
|
};
|
|
11398
11375
|
}
|
|
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
11376
|
const color = () => {
|
|
11423
11377
|
return {
|
|
11424
11378
|
[`${classPrefix2}-icon-disabled`]: disabled,
|
|
@@ -11442,8 +11396,21 @@ const Radio = (props) => {
|
|
|
11442
11396
|
className: classNames(color())
|
|
11443
11397
|
}) : /* @__PURE__ */ React__default.createElement(A, { className: classNames(color()) });
|
|
11444
11398
|
};
|
|
11399
|
+
const renderLabel = () => {
|
|
11400
|
+
const labelcls = classNames(`${classPrefix2}-label`, {
|
|
11401
|
+
[`${classPrefix2}-label-disabled`]: disabled
|
|
11402
|
+
});
|
|
11403
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), /* @__PURE__ */ React__default.createElement("div", { className: labelcls }, children));
|
|
11404
|
+
};
|
|
11405
|
+
const renderButton = () => {
|
|
11406
|
+
const buttoncls = classNames(`${classPrefix2}-button`, {
|
|
11407
|
+
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
11408
|
+
[`${classPrefix2}-button-disabled`]: disabled
|
|
11409
|
+
});
|
|
11410
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: buttoncls }, children);
|
|
11411
|
+
};
|
|
11445
11412
|
const renderByShape = (shape2) => {
|
|
11446
|
-
return shape2 === "button" ? renderButton() :
|
|
11413
|
+
return shape2 === "button" ? renderButton() : renderLabel();
|
|
11447
11414
|
};
|
|
11448
11415
|
const renderRadioItem = () => {
|
|
11449
11416
|
return renderByShape(context && context.shape ? context.shape : shape);
|
|
@@ -11452,22 +11419,14 @@ const Radio = (props) => {
|
|
|
11452
11419
|
if (disabled || checkedStatement) return;
|
|
11453
11420
|
setCheckedStatement(!checkedStatement);
|
|
11454
11421
|
};
|
|
11455
|
-
|
|
11456
|
-
|
|
11422
|
+
const cls = classNames(
|
|
11423
|
+
classPrefix2,
|
|
11457
11424
|
{
|
|
11458
|
-
|
|
11459
|
-
classPrefix2,
|
|
11460
|
-
{
|
|
11461
|
-
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11462
|
-
},
|
|
11463
|
-
className
|
|
11464
|
-
),
|
|
11465
|
-
style,
|
|
11466
|
-
onClick: handleClick,
|
|
11467
|
-
...rest
|
|
11425
|
+
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
11468
11426
|
},
|
|
11469
|
-
|
|
11427
|
+
className
|
|
11470
11428
|
);
|
|
11429
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: cls, style, onClick: handleClick, ...rest }, renderRadioItem());
|
|
11471
11430
|
};
|
|
11472
11431
|
Radio.displayName = "NutRadio";
|
|
11473
11432
|
Radio.Group = RadioGroup;
|
|
@@ -11489,9 +11448,6 @@ const Range = (props) => {
|
|
|
11489
11448
|
button,
|
|
11490
11449
|
vertical,
|
|
11491
11450
|
marks,
|
|
11492
|
-
onChange,
|
|
11493
|
-
onStart,
|
|
11494
|
-
onEnd,
|
|
11495
11451
|
minDescription,
|
|
11496
11452
|
maxDescription,
|
|
11497
11453
|
currentDescription,
|
|
@@ -11499,7 +11455,10 @@ const Range = (props) => {
|
|
|
11499
11455
|
max,
|
|
11500
11456
|
step,
|
|
11501
11457
|
value,
|
|
11502
|
-
defaultValue
|
|
11458
|
+
defaultValue,
|
|
11459
|
+
onChange,
|
|
11460
|
+
onStart,
|
|
11461
|
+
onEnd
|
|
11503
11462
|
} = { ...defaultProps$P, ...props };
|
|
11504
11463
|
const classPrefix2 = "nut-range";
|
|
11505
11464
|
const [buttonIndex, setButtonIndex] = useState(0);
|
|
@@ -11517,7 +11476,7 @@ const Range = (props) => {
|
|
|
11517
11476
|
finalValue: 0,
|
|
11518
11477
|
onChange: handleChange
|
|
11519
11478
|
});
|
|
11520
|
-
const [exactValue,
|
|
11479
|
+
const [exactValue, setExactValue] = useState(
|
|
11521
11480
|
() => value || defaultValue || 0
|
|
11522
11481
|
);
|
|
11523
11482
|
const marksRef = useRef({});
|
|
@@ -11535,10 +11494,7 @@ const Range = (props) => {
|
|
|
11535
11494
|
setMarksList(list);
|
|
11536
11495
|
}
|
|
11537
11496
|
}
|
|
11538
|
-
}, [marks]);
|
|
11539
|
-
const scope = () => {
|
|
11540
|
-
return max - min;
|
|
11541
|
-
};
|
|
11497
|
+
}, [marks, max, min]);
|
|
11542
11498
|
const classes = classNames(classPrefix2, {
|
|
11543
11499
|
[`${classPrefix2}-disabled`]: disabled,
|
|
11544
11500
|
[`${classPrefix2}-vertical`]: vertical
|
|
@@ -11550,41 +11506,38 @@ const Range = (props) => {
|
|
|
11550
11506
|
},
|
|
11551
11507
|
className
|
|
11552
11508
|
);
|
|
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
|
-
);
|
|
11509
|
+
const markClassName = (mark) => {
|
|
11510
|
+
const classPrefix22 = "nut-range-mark";
|
|
11511
|
+
let lowerBound = min;
|
|
11512
|
+
let upperBound = max;
|
|
11513
|
+
if (range3 && Array.isArray(current)) {
|
|
11514
|
+
lowerBound = current[0];
|
|
11515
|
+
upperBound = current[1];
|
|
11516
|
+
} else {
|
|
11517
|
+
upperBound = current;
|
|
11518
|
+
}
|
|
11519
|
+
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
11520
|
+
return [
|
|
11521
|
+
`${classPrefix22}-text`,
|
|
11522
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
11523
|
+
].join(" ");
|
|
11524
|
+
};
|
|
11572
11525
|
const isRange = (val) => {
|
|
11573
11526
|
return !!range3 && Array.isArray(val);
|
|
11574
11527
|
};
|
|
11528
|
+
const scope = useMemo$1(() => {
|
|
11529
|
+
if (max < min || max === min) {
|
|
11530
|
+
console.log("max 的值需要大于 min的值");
|
|
11531
|
+
}
|
|
11532
|
+
return max - min;
|
|
11533
|
+
}, [max, min]);
|
|
11575
11534
|
const calcMainAxis = () => {
|
|
11576
11535
|
const modelVal = current;
|
|
11577
|
-
|
|
11578
|
-
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
11579
|
-
}
|
|
11580
|
-
return `${(modelVal - min) * 100 / scope()}%`;
|
|
11536
|
+
return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
|
|
11581
11537
|
};
|
|
11582
11538
|
const calcOffset = () => {
|
|
11583
11539
|
const modelVal = current;
|
|
11584
|
-
|
|
11585
|
-
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
11586
|
-
}
|
|
11587
|
-
return `0%`;
|
|
11540
|
+
return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
|
|
11588
11541
|
};
|
|
11589
11542
|
const barStyle = () => {
|
|
11590
11543
|
if (vertical) {
|
|
@@ -11604,11 +11557,11 @@ const Range = (props) => {
|
|
|
11604
11557
|
const marksStyle = (mark) => {
|
|
11605
11558
|
const dir = rtl ? "right" : "left";
|
|
11606
11559
|
let style = {
|
|
11607
|
-
[dir]: `${(mark - min) / scope
|
|
11560
|
+
[dir]: `${(mark - min) / scope * 100}%`
|
|
11608
11561
|
};
|
|
11609
11562
|
if (vertical) {
|
|
11610
11563
|
style = {
|
|
11611
|
-
top: `${(mark - min) / scope
|
|
11564
|
+
top: `${(mark - min) / scope * 100}%`
|
|
11612
11565
|
};
|
|
11613
11566
|
}
|
|
11614
11567
|
return style;
|
|
@@ -11655,8 +11608,8 @@ const Range = (props) => {
|
|
|
11655
11608
|
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
11656
11609
|
total = rect.height;
|
|
11657
11610
|
}
|
|
11658
|
-
const value2 = min + delta / total * scope
|
|
11659
|
-
|
|
11611
|
+
const value2 = min + delta / total * scope;
|
|
11612
|
+
setExactValue(current);
|
|
11660
11613
|
if (isRange(current)) {
|
|
11661
11614
|
const [left2, right2] = current;
|
|
11662
11615
|
const middle = (left2 + right2) / 2;
|
|
@@ -11674,7 +11627,7 @@ const Range = (props) => {
|
|
|
11674
11627
|
return;
|
|
11675
11628
|
}
|
|
11676
11629
|
touch.start(event);
|
|
11677
|
-
|
|
11630
|
+
setExactValue(current);
|
|
11678
11631
|
if (isRange(current)) {
|
|
11679
11632
|
setStartValue(current.map(format2));
|
|
11680
11633
|
} else {
|
|
@@ -11695,12 +11648,12 @@ const Range = (props) => {
|
|
|
11695
11648
|
if (!rect) return;
|
|
11696
11649
|
let delta = touch.deltaX.current;
|
|
11697
11650
|
let total = rect.width;
|
|
11698
|
-
let diff = delta / total * scope
|
|
11651
|
+
let diff = delta / total * scope;
|
|
11699
11652
|
diff = rtl ? -diff : diff;
|
|
11700
11653
|
if (vertical) {
|
|
11701
11654
|
delta = touch.deltaY.current;
|
|
11702
11655
|
total = rect.height;
|
|
11703
|
-
diff = delta / total * scope
|
|
11656
|
+
diff = delta / total * scope;
|
|
11704
11657
|
}
|
|
11705
11658
|
let newValue;
|
|
11706
11659
|
if (isRange(startValue)) {
|
|
@@ -11709,7 +11662,7 @@ const Range = (props) => {
|
|
|
11709
11662
|
} else {
|
|
11710
11663
|
newValue = startValue + diff;
|
|
11711
11664
|
}
|
|
11712
|
-
|
|
11665
|
+
setExactValue(newValue);
|
|
11713
11666
|
updateValue(newValue);
|
|
11714
11667
|
};
|
|
11715
11668
|
const onTouchEnd = () => {
|
|
@@ -11729,57 +11682,65 @@ const Range = (props) => {
|
|
|
11729
11682
|
const renderButton = (index) => {
|
|
11730
11683
|
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
11684
|
};
|
|
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",
|
|
11685
|
+
const renderRangeButton = () => {
|
|
11686
|
+
return [0, 1].map((item, index) => {
|
|
11687
|
+
const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
11688
|
+
${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
|
|
11689
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11690
|
+
"div",
|
|
11743
11691
|
{
|
|
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") {
|
|
11692
|
+
key: index,
|
|
11693
|
+
className: cls,
|
|
11694
|
+
onTouchStart: (e2) => {
|
|
11759
11695
|
setButtonIndex(index);
|
|
11760
|
-
|
|
11761
|
-
|
|
11696
|
+
onTouchStart(e2);
|
|
11697
|
+
},
|
|
11698
|
+
onTouchMove,
|
|
11699
|
+
onTouchEnd,
|
|
11700
|
+
onTouchCancel: onTouchEnd,
|
|
11701
|
+
onClick: (e2) => e2.stopPropagation()
|
|
11762
11702
|
},
|
|
11763
|
-
|
|
11703
|
+
renderButton(index)
|
|
11704
|
+
);
|
|
11705
|
+
});
|
|
11706
|
+
};
|
|
11707
|
+
const renderSingleButton = () => {
|
|
11708
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11709
|
+
View,
|
|
11710
|
+
{
|
|
11711
|
+
catchMove: true,
|
|
11712
|
+
className: "nut-range-button-wrapper",
|
|
11713
|
+
onTouchStart,
|
|
11714
|
+
onTouchMove,
|
|
11764
11715
|
onTouchEnd,
|
|
11765
11716
|
onTouchCancel: onTouchEnd,
|
|
11766
11717
|
onClick: (e2) => e2.stopPropagation()
|
|
11767
11718
|
},
|
|
11768
|
-
renderButton(
|
|
11719
|
+
renderButton()
|
|
11769
11720
|
);
|
|
11770
|
-
}
|
|
11771
|
-
|
|
11772
|
-
{
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11721
|
+
};
|
|
11722
|
+
const renderMark = () => {
|
|
11723
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
|
|
11724
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
11725
|
+
"span",
|
|
11726
|
+
{
|
|
11727
|
+
key: mark,
|
|
11728
|
+
className: markClassName(mark),
|
|
11729
|
+
style: marksStyle(mark)
|
|
11730
|
+
},
|
|
11731
|
+
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
11732
|
+
/* @__PURE__ */ React__default.createElement(
|
|
11733
|
+
"span",
|
|
11734
|
+
{
|
|
11735
|
+
className: classNames("nut-range-tick", {
|
|
11736
|
+
active: tickClass(mark)
|
|
11737
|
+
})
|
|
11738
|
+
}
|
|
11739
|
+
)
|
|
11740
|
+
);
|
|
11741
|
+
})));
|
|
11742
|
+
};
|
|
11743
|
+
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
11744
|
};
|
|
11784
11745
|
Range.displayName = "NutRange";
|
|
11785
11746
|
const defaultProps$O = {
|
|
@@ -15049,15 +15010,14 @@ const defaultProps$v = {
|
|
|
15049
15010
|
size: "",
|
|
15050
15011
|
shape: "round",
|
|
15051
15012
|
icon: "",
|
|
15052
|
-
fit: "cover",
|
|
15053
15013
|
background: "#eee",
|
|
15054
15014
|
color: "#666",
|
|
15015
|
+
fit: "cover",
|
|
15055
15016
|
src: "",
|
|
15056
15017
|
alt: ""
|
|
15057
15018
|
};
|
|
15058
15019
|
const classPrefix$a = `nut-avatar`;
|
|
15059
15020
|
const Avatar = (props) => {
|
|
15060
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
15061
15021
|
const {
|
|
15062
15022
|
children,
|
|
15063
15023
|
size,
|
|
@@ -15065,9 +15025,9 @@ const Avatar = (props) => {
|
|
|
15065
15025
|
background,
|
|
15066
15026
|
color,
|
|
15067
15027
|
src,
|
|
15028
|
+
alt,
|
|
15068
15029
|
icon,
|
|
15069
15030
|
fit,
|
|
15070
|
-
alt,
|
|
15071
15031
|
className,
|
|
15072
15032
|
style,
|
|
15073
15033
|
onClick,
|
|
@@ -15083,9 +15043,10 @@ const Avatar = (props) => {
|
|
|
15083
15043
|
const avatarRef = useRef(null);
|
|
15084
15044
|
const parent = useContext(AvatarContext);
|
|
15085
15045
|
const sizeValue = ["large", "normal", "small"];
|
|
15046
|
+
const { propAvatarGroup, avatarGroupRef } = parent;
|
|
15086
15047
|
const classes = classNames({
|
|
15087
|
-
[`nut-avatar-${(
|
|
15088
|
-
[`nut-avatar-${(
|
|
15048
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
|
|
15049
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
|
|
15089
15050
|
});
|
|
15090
15051
|
const cls = classNames(classPrefix$a, classes, className);
|
|
15091
15052
|
const styles = {
|
|
@@ -15093,52 +15054,52 @@ const Avatar = (props) => {
|
|
|
15093
15054
|
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
15094
15055
|
backgroundColor: `${background}`,
|
|
15095
15056
|
color,
|
|
15096
|
-
marginLeft: avatarIndex !== 1 && (
|
|
15097
|
-
zIndex: (
|
|
15057
|
+
marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
|
|
15058
|
+
zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
|
|
15098
15059
|
...style
|
|
15099
15060
|
};
|
|
15100
15061
|
const maxStyles = {
|
|
15101
|
-
backgroundColor: `${
|
|
15102
|
-
color: `${
|
|
15062
|
+
backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
|
|
15063
|
+
color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
|
|
15103
15064
|
};
|
|
15065
|
+
const avatarLength = useCallback(
|
|
15066
|
+
(children2) => {
|
|
15067
|
+
var _a, _b;
|
|
15068
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
15069
|
+
if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
|
|
15070
|
+
children2[i2].setAttribute("data-index", i2 + 1);
|
|
15071
|
+
}
|
|
15072
|
+
}
|
|
15073
|
+
const index = Number((_b = (_a = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
|
|
15074
|
+
const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
|
|
15075
|
+
setMaxSum(children2.length);
|
|
15076
|
+
setAvatarIndex(index);
|
|
15077
|
+
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
15078
|
+
setShowMax(true);
|
|
15079
|
+
}
|
|
15080
|
+
},
|
|
15081
|
+
[propAvatarGroup == null ? void 0 : propAvatarGroup.max]
|
|
15082
|
+
);
|
|
15104
15083
|
useEffect(() => {
|
|
15105
|
-
|
|
15106
|
-
const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
|
|
15084
|
+
const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
|
|
15107
15085
|
if (avatarChildren) {
|
|
15108
15086
|
avatarLength(avatarChildren);
|
|
15109
15087
|
}
|
|
15110
|
-
}, []);
|
|
15088
|
+
}, [avatarLength, avatarGroupRef]);
|
|
15111
15089
|
const isAvatarInClassList = (element) => {
|
|
15112
|
-
var
|
|
15090
|
+
var _a, _b;
|
|
15113
15091
|
if (getEnv() === Taro.ENV_TYPE.WEB) {
|
|
15114
15092
|
return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
|
|
15115
15093
|
}
|
|
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
|
-
}
|
|
15094
|
+
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
15095
|
};
|
|
15133
15096
|
const errorEvent = () => {
|
|
15134
|
-
|
|
15135
|
-
onError();
|
|
15136
|
-
}
|
|
15097
|
+
onError && onError();
|
|
15137
15098
|
};
|
|
15138
15099
|
const clickAvatar = (e2) => {
|
|
15139
15100
|
onClick && onClick(e2);
|
|
15140
15101
|
};
|
|
15141
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !(
|
|
15102
|
+
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
15103
|
"div",
|
|
15143
15104
|
{
|
|
15144
15105
|
className: cls,
|
|
@@ -15147,7 +15108,7 @@ const Avatar = (props) => {
|
|
|
15147
15108
|
onClick: clickAvatar,
|
|
15148
15109
|
ref: avatarRef
|
|
15149
15110
|
},
|
|
15150
|
-
(!(
|
|
15111
|
+
(!(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
15112
|
Image$1,
|
|
15152
15113
|
{
|
|
15153
15114
|
className: "avatar-img",
|
|
@@ -15159,7 +15120,7 @@ const Avatar = (props) => {
|
|
|
15159
15120
|
...icon.props,
|
|
15160
15121
|
className: `${icon.props.className || ""} icon`
|
|
15161
15122
|
}) : 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" }, (
|
|
15123
|
+
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
15124
|
));
|
|
15164
15125
|
};
|
|
15165
15126
|
Avatar.displayName = "NutAvatar";
|
|
@@ -15624,22 +15585,22 @@ const CountUp = (props) => {
|
|
|
15624
15585
|
className,
|
|
15625
15586
|
thousands,
|
|
15626
15587
|
style,
|
|
15627
|
-
...
|
|
15588
|
+
...rest
|
|
15628
15589
|
} = mergeProps(defaultProps$q, props);
|
|
15629
15590
|
const classPrefix2 = "nut-countup";
|
|
15630
15591
|
const countupRef = useRef(null);
|
|
15631
15592
|
const timerRef = useRef(0);
|
|
15632
15593
|
const numbers = Array.from({ length: 10 }, (v, i2) => i2);
|
|
15633
|
-
const getShowNumber = () => {
|
|
15594
|
+
const getShowNumber = useCallback(() => {
|
|
15634
15595
|
const splitArr = value.split(".");
|
|
15635
15596
|
const intNumber = length && splitArr[0].length < length ? (Array(length).join("0") + splitArr[0]).slice(-length) : splitArr[0];
|
|
15636
15597
|
const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
|
|
15637
15598
|
return currNumber.split("");
|
|
15638
|
-
};
|
|
15599
|
+
}, [length, thousands, value]);
|
|
15639
15600
|
const [numerArr, setNumerArr] = useState([]);
|
|
15640
15601
|
const [transformArr, setTransformArr] = useState([]);
|
|
15641
15602
|
const isLoaded = useRef(false);
|
|
15642
|
-
const setNumberTransform = () => {
|
|
15603
|
+
const setNumberTransform = useCallback(() => {
|
|
15643
15604
|
if (countupRef.current && numerArr.length) {
|
|
15644
15605
|
createSelectorQuery().selectAll(".nut-countup-listitem").node((numberItems) => {
|
|
15645
15606
|
const transformArrCache = [];
|
|
@@ -15654,7 +15615,7 @@ const CountUp = (props) => {
|
|
|
15654
15615
|
setTransformArr([...transformArrCache]);
|
|
15655
15616
|
}).exec();
|
|
15656
15617
|
}
|
|
15657
|
-
};
|
|
15618
|
+
}, [numerArr]);
|
|
15658
15619
|
const numberEaseStyle = (idx) => {
|
|
15659
15620
|
return {
|
|
15660
15621
|
transition: `transform ${duration}s ease-in-out`,
|
|
@@ -15663,7 +15624,7 @@ const CountUp = (props) => {
|
|
|
15663
15624
|
};
|
|
15664
15625
|
useEffect(() => {
|
|
15665
15626
|
setNumberTransform();
|
|
15666
|
-
}, [numerArr]);
|
|
15627
|
+
}, [numerArr, setNumberTransform]);
|
|
15667
15628
|
useEffect(() => {
|
|
15668
15629
|
if (!isLoaded.current) {
|
|
15669
15630
|
isLoaded.current = true;
|
|
@@ -15676,7 +15637,7 @@ const CountUp = (props) => {
|
|
|
15676
15637
|
return () => {
|
|
15677
15638
|
window.clearTimeout(timerRef.current);
|
|
15678
15639
|
};
|
|
15679
|
-
}, [value]);
|
|
15640
|
+
}, [value, delay, getShowNumber]);
|
|
15680
15641
|
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React__default.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
|
|
15681
15642
|
return /* @__PURE__ */ React__default.createElement(
|
|
15682
15643
|
"li",
|
|
@@ -15791,7 +15752,7 @@ const Audio = (props) => {
|
|
|
15791
15752
|
onPlay == null ? void 0 : onPlay(audioCtx);
|
|
15792
15753
|
});
|
|
15793
15754
|
audioCtx.onCanplay(() => {
|
|
15794
|
-
const intervalID = setInterval(
|
|
15755
|
+
const intervalID = setInterval(() => {
|
|
15795
15756
|
if (audioCtx.duration !== 0) {
|
|
15796
15757
|
setTotalSeconds(audioCtx.duration);
|
|
15797
15758
|
clearInterval(intervalID);
|
|
@@ -15808,8 +15769,7 @@ const Audio = (props) => {
|
|
|
15808
15769
|
setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
|
|
15809
15770
|
});
|
|
15810
15771
|
audioCtx.onError((res) => {
|
|
15811
|
-
console.warn("
|
|
15812
|
-
console.warn("message", res.errMsg);
|
|
15772
|
+
console.warn("onError", res.errCode, res.errMsg);
|
|
15813
15773
|
});
|
|
15814
15774
|
function formatSeconds(value) {
|
|
15815
15775
|
if (!value) {
|