@nutui/nutui-react 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/AnimatingNumbers.js +4 -4
- package/dist/esm/Audio/style/style.css +1 -1
- package/dist/esm/Avatar.js +23 -26
- package/dist/esm/AvatarCropper.js +1 -1
- package/dist/esm/BackTop.js +30 -43
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +3 -3
- package/dist/esm/CalendarCard.js +1 -1
- package/dist/esm/CalendarItem.js +3 -3
- package/dist/esm/Cascader/style/style.css +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 +3 -3
- 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 +12 -12
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/NavBar/style/style.css +1 -1
- package/dist/esm/NavBar.js +7 -2
- 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/RadioGroup.js +5 -4
- package/dist/esm/Range/style/style.css +1 -1
- package/dist/esm/Range.js +49 -44
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/button2.js +2 -2
- package/dist/esm/cascader2.js +1 -1
- package/dist/esm/configprovider2.js +138 -1
- package/dist/esm/menuitem2.js +15 -15
- package/dist/esm/overlay2.js +2 -1
- package/dist/esm/popup2.js +2 -1
- package/dist/esm/radio2.js +19 -16
- package/dist/esm/raf.js +10 -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 +284 -324
- package/dist/nutui.react.umd.js +284 -324
- 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 +5 -5
- package/dist/types/packages/calendar/calendar.d.ts +10 -0
- package/dist/types/packages/calendar/calendar.taro.d.ts +2 -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 +2 -2
- package/package.json +1 -1
- package/dist/esm/configprovider.taro.js +0 -23
- package/dist/esm/zh-CN.js +0 -141
package/dist/nutui.react.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.nutui = {}, global2.React, global2.ReactDOM));
|
|
3
3
|
})(this, function(exports2, React, ReactDOM) {
|
|
4
4
|
"use strict";/*!
|
|
5
|
-
* @nutui/nutui-react v2.6.
|
|
5
|
+
* @nutui/nutui-react v2.6.23 Fri Oct 18 2024 14:16:05 GMT+0800 (China Standard Time)
|
|
6
6
|
* (c) 2023 @jdf2e.
|
|
7
7
|
* Released under the MIT License.
|
|
8
8
|
*/
|
|
@@ -653,7 +653,7 @@
|
|
|
653
653
|
};
|
|
654
654
|
const getStyle = React.useCallback(() => {
|
|
655
655
|
const style2 = {};
|
|
656
|
-
if (
|
|
656
|
+
if (color) {
|
|
657
657
|
if (props.fill === "outline" || props.fill === "dashed") {
|
|
658
658
|
style2.color = color;
|
|
659
659
|
if (!(color == null ? void 0 : color.includes("gradient"))) {
|
|
@@ -666,7 +666,7 @@
|
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
return style2;
|
|
669
|
-
}, [color]);
|
|
669
|
+
}, [color, props.fill]);
|
|
670
670
|
const handleClick2 = (e) => {
|
|
671
671
|
if (!loading && !disabled && onClick) {
|
|
672
672
|
onClick(e);
|
|
@@ -1872,7 +1872,7 @@
|
|
|
1872
1872
|
};
|
|
1873
1873
|
const inBrowser = typeof window !== "undefined";
|
|
1874
1874
|
function requestAniFrame() {
|
|
1875
|
-
if (
|
|
1875
|
+
if (inBrowser) {
|
|
1876
1876
|
const _window = window;
|
|
1877
1877
|
return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
|
|
1878
1878
|
_window.setTimeout(callback, 1e3 / 60);
|
|
@@ -1882,22 +1882,30 @@
|
|
|
1882
1882
|
setTimeout(callback, 1e3 / 60);
|
|
1883
1883
|
};
|
|
1884
1884
|
}
|
|
1885
|
+
function cancelRaf(id) {
|
|
1886
|
+
if (inBrowser) {
|
|
1887
|
+
const _window = window;
|
|
1888
|
+
(_window.cancelAnimationFrame || _window.webkitCancelAnimationFrame)(id);
|
|
1889
|
+
} else {
|
|
1890
|
+
clearTimeout(id);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1885
1893
|
const requestAniFrame$1 = requestAniFrame();
|
|
1886
1894
|
const classPrefix$p = "nut-configprovider";
|
|
1887
|
-
const defaultConfigRef
|
|
1895
|
+
const defaultConfigRef = {
|
|
1888
1896
|
current: {
|
|
1889
1897
|
locale: zhCN
|
|
1890
1898
|
}
|
|
1891
1899
|
};
|
|
1892
1900
|
const setDefaultConfig = (config2) => {
|
|
1893
|
-
defaultConfigRef
|
|
1901
|
+
defaultConfigRef.current = config2;
|
|
1894
1902
|
};
|
|
1895
|
-
const getDefaultConfig
|
|
1896
|
-
return defaultConfigRef
|
|
1903
|
+
const getDefaultConfig = () => {
|
|
1904
|
+
return defaultConfigRef.current;
|
|
1897
1905
|
};
|
|
1898
|
-
const ConfigContext
|
|
1899
|
-
const useConfig
|
|
1900
|
-
return React.useContext(ConfigContext
|
|
1906
|
+
const ConfigContext = React.createContext(null);
|
|
1907
|
+
const useConfig = () => {
|
|
1908
|
+
return React.useContext(ConfigContext) ?? getDefaultConfig();
|
|
1901
1909
|
};
|
|
1902
1910
|
function convertThemeVarsToCSSVars(themeVars) {
|
|
1903
1911
|
const cssVars = {};
|
|
@@ -1907,7 +1915,7 @@
|
|
|
1907
1915
|
return cssVars;
|
|
1908
1916
|
}
|
|
1909
1917
|
const useRtl = () => {
|
|
1910
|
-
const { direction } = useConfig
|
|
1918
|
+
const { direction } = useConfig();
|
|
1911
1919
|
if (direction) {
|
|
1912
1920
|
return direction === "rtl";
|
|
1913
1921
|
}
|
|
@@ -1918,7 +1926,7 @@
|
|
|
1918
1926
|
const mergedConfig = useMemo(
|
|
1919
1927
|
() => {
|
|
1920
1928
|
return {
|
|
1921
|
-
...getDefaultConfig
|
|
1929
|
+
...getDefaultConfig(),
|
|
1922
1930
|
...config2,
|
|
1923
1931
|
direction
|
|
1924
1932
|
};
|
|
@@ -1932,7 +1940,7 @@
|
|
|
1932
1940
|
const cssVarStyle = React.useMemo(() => {
|
|
1933
1941
|
return convertThemeVarsToCSSVars(mergedConfig.theme || {});
|
|
1934
1942
|
}, [mergedConfig.theme]);
|
|
1935
|
-
return /* @__PURE__ */ React.createElement(ConfigContext
|
|
1943
|
+
return /* @__PURE__ */ React.createElement(ConfigContext.Provider, { value: mergedConfig }, /* @__PURE__ */ React.createElement(
|
|
1936
1944
|
"div",
|
|
1937
1945
|
{
|
|
1938
1946
|
className: classNames(classPrefix$p, className),
|
|
@@ -2800,7 +2808,8 @@
|
|
|
2800
2808
|
setInnerVisible(false);
|
|
2801
2809
|
}
|
|
2802
2810
|
}, [visible]);
|
|
2803
|
-
|
|
2811
|
+
const shouldLockScroll = !innerVisible ? false : lockScroll;
|
|
2812
|
+
useLockScroll(nodeRef, shouldLockScroll);
|
|
2804
2813
|
const classes = classNames(classPrefix2, className);
|
|
2805
2814
|
const styles = {
|
|
2806
2815
|
...style
|
|
@@ -3354,31 +3363,36 @@
|
|
|
3354
3363
|
const [scrollTop, SetScrollTop] = React.useState(0);
|
|
3355
3364
|
let startTime = 0;
|
|
3356
3365
|
const scrollEl = React.useRef(null);
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3366
|
+
const cls = classNames(classPrefix2, { show: backTop }, className);
|
|
3367
|
+
const scrollListener = React.useCallback(() => {
|
|
3368
|
+
var _a;
|
|
3369
|
+
let top = null;
|
|
3370
|
+
if (scrollEl.current instanceof Window) {
|
|
3371
|
+
top = scrollEl.current.scrollY;
|
|
3372
|
+
} else {
|
|
3373
|
+
top = (_a = scrollEl.current) == null ? void 0 : _a.scrollTop;
|
|
3374
|
+
}
|
|
3375
|
+
SetScrollTop(top);
|
|
3376
|
+
SetBackTop(top >= threshold);
|
|
3377
|
+
}, [threshold]);
|
|
3378
|
+
const init = React.useCallback(() => {
|
|
3379
|
+
var _a, _b;
|
|
3362
3380
|
if (target && document.getElementById(target)) {
|
|
3363
3381
|
scrollEl.current = document.getElementById(target);
|
|
3364
3382
|
} else {
|
|
3365
3383
|
scrollEl.current = window;
|
|
3366
3384
|
}
|
|
3367
|
-
addEventListener();
|
|
3368
|
-
|
|
3369
|
-
};
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
}
|
|
3379
|
-
const showBtn = top >= threshold;
|
|
3380
|
-
SetBackTop(showBtn);
|
|
3381
|
-
};
|
|
3385
|
+
(_a = scrollEl.current) == null ? void 0 : _a.addEventListener("scroll", scrollListener, false);
|
|
3386
|
+
(_b = scrollEl.current) == null ? void 0 : _b.addEventListener("resize", scrollListener, false);
|
|
3387
|
+
}, [target, scrollListener]);
|
|
3388
|
+
React.useEffect(() => {
|
|
3389
|
+
init();
|
|
3390
|
+
return () => {
|
|
3391
|
+
var _a, _b;
|
|
3392
|
+
(_a = scrollEl.current) == null ? void 0 : _a.removeEventListener("scroll", scrollListener, false);
|
|
3393
|
+
(_b = scrollEl.current) == null ? void 0 : _b.removeEventListener("resize", scrollListener, false);
|
|
3394
|
+
};
|
|
3395
|
+
}, [init, scrollListener]);
|
|
3382
3396
|
const scroll = (y = 0) => {
|
|
3383
3397
|
if (scrollEl.current instanceof Window) {
|
|
3384
3398
|
window.scrollTo(0, y);
|
|
@@ -3394,27 +3408,13 @@
|
|
|
3394
3408
|
scroll(y);
|
|
3395
3409
|
cid = requestAniFrame$1(fn);
|
|
3396
3410
|
if (t === duration || y === 0) {
|
|
3397
|
-
|
|
3411
|
+
cancelRaf(cid);
|
|
3398
3412
|
}
|
|
3399
3413
|
});
|
|
3400
3414
|
};
|
|
3401
|
-
const initCancelAniFrame = () => {
|
|
3402
|
-
window.cancelAnimationFrame = window.webkitCancelAnimationFrame;
|
|
3403
|
-
};
|
|
3404
|
-
function addEventListener() {
|
|
3405
|
-
var _a, _b;
|
|
3406
|
-
(_a = scrollEl.current) == null ? void 0 : _a.addEventListener("scroll", scrollListener, false);
|
|
3407
|
-
(_b = scrollEl.current) == null ? void 0 : _b.addEventListener("resize", scrollListener, false);
|
|
3408
|
-
}
|
|
3409
|
-
function removeEventListener() {
|
|
3410
|
-
var _a, _b;
|
|
3411
|
-
(_a = scrollEl.current) == null ? void 0 : _a.removeEventListener("scroll", scrollListener, false);
|
|
3412
|
-
(_b = scrollEl.current) == null ? void 0 : _b.removeEventListener("resize", scrollListener, false);
|
|
3413
|
-
}
|
|
3414
3415
|
const goTop = (e) => {
|
|
3415
3416
|
onClick && onClick(e);
|
|
3416
|
-
|
|
3417
|
-
startTime = otime;
|
|
3417
|
+
startTime = +/* @__PURE__ */ new Date();
|
|
3418
3418
|
duration > 0 ? scrollAnimation() : scroll();
|
|
3419
3419
|
};
|
|
3420
3420
|
const styles = Object.keys(style || {}).length !== 0 ? {
|
|
@@ -3425,23 +3425,7 @@
|
|
|
3425
3425
|
bottom: "20px",
|
|
3426
3426
|
zIndex
|
|
3427
3427
|
};
|
|
3428
|
-
return /* @__PURE__ */ React.createElement(
|
|
3429
|
-
"div",
|
|
3430
|
-
{
|
|
3431
|
-
className: classNames(
|
|
3432
|
-
classPrefix2,
|
|
3433
|
-
{
|
|
3434
|
-
show: backTop
|
|
3435
|
-
},
|
|
3436
|
-
className
|
|
3437
|
-
),
|
|
3438
|
-
style: styles,
|
|
3439
|
-
onClick: (e) => {
|
|
3440
|
-
goTop(e);
|
|
3441
|
-
}
|
|
3442
|
-
},
|
|
3443
|
-
children || /* @__PURE__ */ React.createElement(s$1, { width: 19, height: 19, className: "nut-backtop-main" })
|
|
3444
|
-
);
|
|
3428
|
+
return /* @__PURE__ */ React.createElement("div", { className: cls, style: styles, onClick: (e) => goTop(e) }, children || /* @__PURE__ */ React.createElement(s$1, { width: 19, height: 19, className: "nut-backtop-main" }));
|
|
3445
3429
|
};
|
|
3446
3430
|
BackTop.displayName = "NutBackTop";
|
|
3447
3431
|
function clamp$2(v, min, max) {
|
|
@@ -8479,7 +8463,7 @@
|
|
|
8479
8463
|
}
|
|
8480
8464
|
};
|
|
8481
8465
|
const FixedNav = (props) => {
|
|
8482
|
-
const { locale } = useConfig
|
|
8466
|
+
const { locale } = useConfig();
|
|
8483
8467
|
const {
|
|
8484
8468
|
className,
|
|
8485
8469
|
overlay,
|
|
@@ -8644,11 +8628,10 @@
|
|
|
8644
8628
|
};
|
|
8645
8629
|
const classes = classNames({
|
|
8646
8630
|
[`${classPrefix2}-fixed`]: fixed,
|
|
8647
|
-
[`${classPrefix2}-safe-area-inset-top`]: safeAreaInsetTop,
|
|
8648
8631
|
[`${classPrefix2}-title-align-${titleAlign}`]: true
|
|
8649
8632
|
});
|
|
8650
8633
|
const cls = classNames(classPrefix2, classes, className);
|
|
8651
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
8634
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
8652
8635
|
};
|
|
8653
8636
|
NavBar.displayName = "NutNavBar";
|
|
8654
8637
|
const defaultProps$1e = {
|
|
@@ -8711,7 +8694,8 @@
|
|
|
8711
8694
|
const [innerVisible, setInnerVisible] = React.useState(visible);
|
|
8712
8695
|
const [showChildren, setShowChildren] = React.useState(true);
|
|
8713
8696
|
const [transitionName, setTransitionName] = React.useState("");
|
|
8714
|
-
|
|
8697
|
+
const shouldLockScroll = !innerVisible ? false : lockScroll;
|
|
8698
|
+
useLockScroll(nodeRef, shouldLockScroll);
|
|
8715
8699
|
const classPrefix2 = "nut-popup";
|
|
8716
8700
|
const baseStyle = {
|
|
8717
8701
|
zIndex: index
|
|
@@ -9577,19 +9561,6 @@
|
|
|
9577
9561
|
return pathNodes;
|
|
9578
9562
|
}
|
|
9579
9563
|
}
|
|
9580
|
-
const defaultConfigRef = {
|
|
9581
|
-
current: {
|
|
9582
|
-
locale: zhCN,
|
|
9583
|
-
direction: "ltr"
|
|
9584
|
-
}
|
|
9585
|
-
};
|
|
9586
|
-
const getDefaultConfig = () => {
|
|
9587
|
-
return defaultConfigRef.current;
|
|
9588
|
-
};
|
|
9589
|
-
const ConfigContext = React.createContext(null);
|
|
9590
|
-
const useConfig = () => {
|
|
9591
|
-
return React.useContext(ConfigContext) ?? getDefaultConfig();
|
|
9592
|
-
};
|
|
9593
9564
|
const defaultProps$16 = {
|
|
9594
9565
|
...ComponentDefaults,
|
|
9595
9566
|
activeColor: "",
|
|
@@ -10006,7 +9977,7 @@
|
|
|
10006
9977
|
custom: false
|
|
10007
9978
|
};
|
|
10008
9979
|
const ExistRender = (props) => {
|
|
10009
|
-
const { locale } = useConfig
|
|
9980
|
+
const { locale } = useConfig();
|
|
10010
9981
|
const {
|
|
10011
9982
|
children,
|
|
10012
9983
|
type,
|
|
@@ -10062,7 +10033,7 @@
|
|
|
10062
10033
|
backIcon: null
|
|
10063
10034
|
};
|
|
10064
10035
|
const InternalAddress = (props, ref) => {
|
|
10065
|
-
const { locale } = useConfig
|
|
10036
|
+
const { locale } = useConfig();
|
|
10066
10037
|
const {
|
|
10067
10038
|
style,
|
|
10068
10039
|
className,
|
|
@@ -10457,7 +10428,7 @@
|
|
|
10457
10428
|
}
|
|
10458
10429
|
};
|
|
10459
10430
|
const CalendarItem = React.forwardRef((props, ref) => {
|
|
10460
|
-
const { locale } = useConfig
|
|
10431
|
+
const { locale } = useConfig();
|
|
10461
10432
|
const {
|
|
10462
10433
|
style,
|
|
10463
10434
|
className,
|
|
@@ -10479,6 +10450,7 @@
|
|
|
10479
10450
|
firstDayOfWeek,
|
|
10480
10451
|
disableDate,
|
|
10481
10452
|
renderHeaderButtons,
|
|
10453
|
+
renderBottomButton,
|
|
10482
10454
|
renderDay,
|
|
10483
10455
|
renderDayTop,
|
|
10484
10456
|
renderDayBottom,
|
|
@@ -11021,7 +10993,7 @@
|
|
|
11021
10993
|
);
|
|
11022
10994
|
};
|
|
11023
10995
|
const renderFooter = () => {
|
|
11024
|
-
return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn"
|
|
10996
|
+
return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, children, /* @__PURE__ */ React.createElement("div", { onClick: confirm2 }, renderBottomButton ? renderBottomButton() : /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn" }, confirmText || locale.confirm)));
|
|
11025
10997
|
};
|
|
11026
10998
|
return /* @__PURE__ */ React.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
11027
10999
|
});
|
|
@@ -11059,7 +11031,7 @@
|
|
|
11059
11031
|
}
|
|
11060
11032
|
};
|
|
11061
11033
|
const Calendar = React.forwardRef((props, ref) => {
|
|
11062
|
-
const { locale } = useConfig
|
|
11034
|
+
const { locale } = useConfig();
|
|
11063
11035
|
const {
|
|
11064
11036
|
style,
|
|
11065
11037
|
className,
|
|
@@ -11080,8 +11052,10 @@
|
|
|
11080
11052
|
showSubTitle,
|
|
11081
11053
|
scrollAnimation,
|
|
11082
11054
|
firstDayOfWeek,
|
|
11055
|
+
closeIcon,
|
|
11083
11056
|
disableDate,
|
|
11084
11057
|
renderHeaderButtons,
|
|
11058
|
+
renderBottomButton,
|
|
11085
11059
|
renderDay,
|
|
11086
11060
|
renderDayTop,
|
|
11087
11061
|
renderDayBottom,
|
|
@@ -11124,6 +11098,7 @@
|
|
|
11124
11098
|
children,
|
|
11125
11099
|
type,
|
|
11126
11100
|
autoBackfill,
|
|
11101
|
+
renderBottomButton,
|
|
11127
11102
|
popup,
|
|
11128
11103
|
title: title || locale.calendaritem.title,
|
|
11129
11104
|
defaultValue,
|
|
@@ -11156,6 +11131,7 @@
|
|
|
11156
11131
|
position: "bottom",
|
|
11157
11132
|
round: true,
|
|
11158
11133
|
closeable: true,
|
|
11134
|
+
closeIcon,
|
|
11159
11135
|
destroyOnClose: true,
|
|
11160
11136
|
onOverlayClick: closePopup,
|
|
11161
11137
|
onCloseIconClick: closePopup,
|
|
@@ -11276,7 +11252,7 @@
|
|
|
11276
11252
|
};
|
|
11277
11253
|
const prefixCls = "nut-calendarcard";
|
|
11278
11254
|
const CalendarCard = React.forwardRef((props, ref) => {
|
|
11279
|
-
const { locale } = useConfig
|
|
11255
|
+
const { locale } = useConfig();
|
|
11280
11256
|
const {
|
|
11281
11257
|
style,
|
|
11282
11258
|
className,
|
|
@@ -12122,7 +12098,7 @@
|
|
|
12122
12098
|
duration: 1e3
|
|
12123
12099
|
};
|
|
12124
12100
|
const InternalPicker = (props, ref) => {
|
|
12125
|
-
const { locale } = useConfig
|
|
12101
|
+
const { locale } = useConfig();
|
|
12126
12102
|
const {
|
|
12127
12103
|
children,
|
|
12128
12104
|
visible,
|
|
@@ -12418,7 +12394,7 @@
|
|
|
12418
12394
|
...defaultProps$Y,
|
|
12419
12395
|
...props
|
|
12420
12396
|
};
|
|
12421
|
-
const { locale } = useConfig
|
|
12397
|
+
const { locale } = useConfig();
|
|
12422
12398
|
const lang = locale.datepicker;
|
|
12423
12399
|
const zhCNType = {
|
|
12424
12400
|
day: lang.day,
|
|
@@ -14225,7 +14201,7 @@
|
|
|
14225
14201
|
const Input = React.forwardRef(
|
|
14226
14202
|
(props, ref) => {
|
|
14227
14203
|
const rtl = useRtl();
|
|
14228
|
-
const { locale } = useConfig
|
|
14204
|
+
const { locale } = useConfig();
|
|
14229
14205
|
const {
|
|
14230
14206
|
type,
|
|
14231
14207
|
name,
|
|
@@ -14697,9 +14673,21 @@
|
|
|
14697
14673
|
React.useEffect(() => {
|
|
14698
14674
|
setShowPopup(show2);
|
|
14699
14675
|
}, [show2]);
|
|
14676
|
+
const getParentOffset = React.useCallback(() => {
|
|
14677
|
+
setTimeout(() => {
|
|
14678
|
+
const p2 = parent.menuRef.current;
|
|
14679
|
+
if (p2) {
|
|
14680
|
+
const rect = p2.getBoundingClientRect();
|
|
14681
|
+
setPosition({
|
|
14682
|
+
height: rect.height,
|
|
14683
|
+
top: rect.top
|
|
14684
|
+
});
|
|
14685
|
+
}
|
|
14686
|
+
});
|
|
14687
|
+
}, [parent.menuRef]);
|
|
14700
14688
|
React.useEffect(() => {
|
|
14701
14689
|
getParentOffset();
|
|
14702
|
-
}, [showPopup]);
|
|
14690
|
+
}, [showPopup, getParentOffset]);
|
|
14703
14691
|
React.useImperativeHandle(ref, () => ({
|
|
14704
14692
|
toggle: (s2) => {
|
|
14705
14693
|
const from = "REF";
|
|
@@ -14733,18 +14721,6 @@
|
|
|
14733
14721
|
const scrollParent = React.useMemo(() => {
|
|
14734
14722
|
return getScrollParent(parent.menuRef, window);
|
|
14735
14723
|
}, [parent.menuRef]);
|
|
14736
|
-
const getParentOffset = () => {
|
|
14737
|
-
setTimeout(() => {
|
|
14738
|
-
const p2 = parent.menuRef.current;
|
|
14739
|
-
if (p2) {
|
|
14740
|
-
const rect = p2.getBoundingClientRect();
|
|
14741
|
-
setPosition({
|
|
14742
|
-
height: rect.height,
|
|
14743
|
-
top: rect.top
|
|
14744
|
-
});
|
|
14745
|
-
}
|
|
14746
|
-
});
|
|
14747
|
-
};
|
|
14748
14724
|
React.useEffect(() => {
|
|
14749
14725
|
if (!parent.lockScroll) {
|
|
14750
14726
|
scrollParent == null ? void 0 : scrollParent.addEventListener("scroll", getParentOffset, false);
|
|
@@ -14752,7 +14728,7 @@
|
|
|
14752
14728
|
scrollParent == null ? void 0 : scrollParent.removeEventListener("scroll", getParentOffset, false);
|
|
14753
14729
|
};
|
|
14754
14730
|
}
|
|
14755
|
-
}, []);
|
|
14731
|
+
}, [parent.lockScroll, scrollParent, getParentOffset]);
|
|
14756
14732
|
const getPosition = () => {
|
|
14757
14733
|
return direction === "down" ? {
|
|
14758
14734
|
top: `${position.top + position.height}px`,
|
|
@@ -14883,24 +14859,29 @@
|
|
|
14883
14859
|
...props
|
|
14884
14860
|
};
|
|
14885
14861
|
const menuRef = React.useRef(null);
|
|
14862
|
+
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
14863
|
+
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
14886
14864
|
const [isScrollFixed, setIsScrollFixed] = React.useState(false);
|
|
14865
|
+
const cls = classNames(`nut-menu`, className, {
|
|
14866
|
+
"scroll-fixed": isScrollFixed
|
|
14867
|
+
});
|
|
14887
14868
|
const getScrollTop = (el) => {
|
|
14888
|
-
return Math.max(
|
|
14869
|
+
return Math.max(
|
|
14870
|
+
0,
|
|
14871
|
+
el === window ? window.scrollY : el.scrollTop
|
|
14872
|
+
);
|
|
14889
14873
|
};
|
|
14890
|
-
const onScroll = () => {
|
|
14891
|
-
const { scrollFixed: scrollFixed2 } = props;
|
|
14874
|
+
const onScroll = React.useCallback(() => {
|
|
14892
14875
|
const scrollTop = getScrollTop(window);
|
|
14893
|
-
const isFixed = scrollTop > (typeof
|
|
14876
|
+
const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
|
|
14894
14877
|
setIsScrollFixed(isFixed);
|
|
14895
|
-
};
|
|
14878
|
+
}, [scrollFixed]);
|
|
14896
14879
|
React.useEffect(() => {
|
|
14897
14880
|
if (scrollFixed) {
|
|
14898
14881
|
window.addEventListener("scroll", onScroll);
|
|
14899
14882
|
}
|
|
14900
14883
|
return () => window.removeEventListener("scroll", onScroll);
|
|
14901
|
-
}, []);
|
|
14902
|
-
const [showMenuItem, setShowMenuItem] = React.useState([]);
|
|
14903
|
-
const [menuItemTitle, setMenuItemTitle] = React.useState([]);
|
|
14884
|
+
}, [scrollFixed, onScroll]);
|
|
14904
14885
|
const toggleMenuItem = (index, from = "NORMAL") => {
|
|
14905
14886
|
showMenuItem[index] = !showMenuItem[index];
|
|
14906
14887
|
if (showMenuItem[index]) {
|
|
@@ -15004,26 +14985,15 @@
|
|
|
15004
14985
|
return null;
|
|
15005
14986
|
});
|
|
15006
14987
|
};
|
|
15007
|
-
return /* @__PURE__ */ React.createElement(
|
|
14988
|
+
return /* @__PURE__ */ React.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React.createElement(
|
|
15008
14989
|
"div",
|
|
15009
14990
|
{
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
}),
|
|
15014
|
-
ref: menuRef
|
|
14991
|
+
className: classNames("nut-menu-bar", {
|
|
14992
|
+
opened: showMenuItem.includes(true)
|
|
14993
|
+
})
|
|
15015
14994
|
},
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
{
|
|
15019
|
-
className: classNames("nut-menu-bar", {
|
|
15020
|
-
opened: showMenuItem.includes(true)
|
|
15021
|
-
})
|
|
15022
|
-
},
|
|
15023
|
-
menuTitle()
|
|
15024
|
-
),
|
|
15025
|
-
cloneChildren()
|
|
15026
|
-
);
|
|
14995
|
+
menuTitle()
|
|
14996
|
+
), cloneChildren());
|
|
15027
14997
|
};
|
|
15028
14998
|
Menu.displayName = "NutMenu";
|
|
15029
14999
|
Menu.Item = MenuItem;
|
|
@@ -15038,7 +15008,7 @@
|
|
|
15038
15008
|
}
|
|
15039
15009
|
};
|
|
15040
15010
|
const NumberKeyboard = (props) => {
|
|
15041
|
-
const { locale } = useConfig
|
|
15011
|
+
const { locale } = useConfig();
|
|
15042
15012
|
const {
|
|
15043
15013
|
title,
|
|
15044
15014
|
rightActions,
|
|
@@ -15220,6 +15190,13 @@
|
|
|
15220
15190
|
disabled,
|
|
15221
15191
|
...rest
|
|
15222
15192
|
} = { ...defaultProps$Q, ...props };
|
|
15193
|
+
const cls = classNames(
|
|
15194
|
+
classPrefix$f,
|
|
15195
|
+
{
|
|
15196
|
+
[`${classPrefix$f}-${props.direction}`]: props.direction
|
|
15197
|
+
},
|
|
15198
|
+
className
|
|
15199
|
+
);
|
|
15223
15200
|
const [val2State, setVal2State] = usePropsValue({
|
|
15224
15201
|
defaultValue: props.defaultValue,
|
|
15225
15202
|
value: props.value,
|
|
@@ -15242,7 +15219,7 @@
|
|
|
15242
15219
|
}
|
|
15243
15220
|
);
|
|
15244
15221
|
});
|
|
15245
|
-
}, [options2]);
|
|
15222
|
+
}, [options2, labelPosition, val2State]);
|
|
15246
15223
|
return /* @__PURE__ */ React.createElement(
|
|
15247
15224
|
RadioContext.Provider,
|
|
15248
15225
|
{
|
|
@@ -15259,20 +15236,7 @@
|
|
|
15259
15236
|
}
|
|
15260
15237
|
}
|
|
15261
15238
|
},
|
|
15262
|
-
/* @__PURE__ */ React.createElement(
|
|
15263
|
-
"div",
|
|
15264
|
-
{
|
|
15265
|
-
className: classNames(
|
|
15266
|
-
classPrefix$f,
|
|
15267
|
-
{
|
|
15268
|
-
[`${classPrefix$f}-${props.direction}`]: props.direction
|
|
15269
|
-
},
|
|
15270
|
-
className
|
|
15271
|
-
),
|
|
15272
|
-
...rest
|
|
15273
|
-
},
|
|
15274
|
-
(options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : children
|
|
15275
|
-
)
|
|
15239
|
+
/* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : children)
|
|
15276
15240
|
);
|
|
15277
15241
|
}
|
|
15278
15242
|
);
|
|
@@ -15330,29 +15294,6 @@
|
|
|
15330
15294
|
}
|
|
15331
15295
|
};
|
|
15332
15296
|
}
|
|
15333
|
-
const renderLabel = () => {
|
|
15334
|
-
return /* @__PURE__ */ React.createElement(
|
|
15335
|
-
"div",
|
|
15336
|
-
{
|
|
15337
|
-
className: classNames(`${classPrefix2}-label`, {
|
|
15338
|
-
[`${classPrefix2}-label-disabled`]: disabled
|
|
15339
|
-
})
|
|
15340
|
-
},
|
|
15341
|
-
children
|
|
15342
|
-
);
|
|
15343
|
-
};
|
|
15344
|
-
const renderButton = () => {
|
|
15345
|
-
return /* @__PURE__ */ React.createElement(
|
|
15346
|
-
"div",
|
|
15347
|
-
{
|
|
15348
|
-
className: classNames(`${classPrefix2}-button`, {
|
|
15349
|
-
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
15350
|
-
[`${classPrefix2}-button-disabled`]: disabled
|
|
15351
|
-
})
|
|
15352
|
-
},
|
|
15353
|
-
children
|
|
15354
|
-
);
|
|
15355
|
-
};
|
|
15356
15297
|
const color = () => {
|
|
15357
15298
|
return {
|
|
15358
15299
|
[`${classPrefix2}-icon-disabled`]: disabled,
|
|
@@ -15376,8 +15317,21 @@
|
|
|
15376
15317
|
className: classNames(color())
|
|
15377
15318
|
}) : /* @__PURE__ */ React.createElement(i$6, { className: classNames(color()) });
|
|
15378
15319
|
};
|
|
15320
|
+
const renderLabel = () => {
|
|
15321
|
+
const labelcls = classNames(`${classPrefix2}-label`, {
|
|
15322
|
+
[`${classPrefix2}-label-disabled`]: disabled
|
|
15323
|
+
});
|
|
15324
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), /* @__PURE__ */ React.createElement("div", { className: labelcls }, children));
|
|
15325
|
+
};
|
|
15326
|
+
const renderButton = () => {
|
|
15327
|
+
const buttoncls = classNames(`${classPrefix2}-button`, {
|
|
15328
|
+
[`${classPrefix2}-button-active`]: checkedStatement,
|
|
15329
|
+
[`${classPrefix2}-button-disabled`]: disabled
|
|
15330
|
+
});
|
|
15331
|
+
return /* @__PURE__ */ React.createElement("div", { className: buttoncls }, children);
|
|
15332
|
+
};
|
|
15379
15333
|
const renderByShape = (shape2) => {
|
|
15380
|
-
return shape2 === "button" ? renderButton() :
|
|
15334
|
+
return shape2 === "button" ? renderButton() : renderLabel();
|
|
15381
15335
|
};
|
|
15382
15336
|
const renderRadioItem = () => {
|
|
15383
15337
|
return renderByShape(context && context.shape ? context.shape : shape);
|
|
@@ -15386,22 +15340,14 @@
|
|
|
15386
15340
|
if (disabled || checkedStatement) return;
|
|
15387
15341
|
setCheckedStatement(!checkedStatement);
|
|
15388
15342
|
};
|
|
15389
|
-
|
|
15390
|
-
|
|
15343
|
+
const cls = classNames(
|
|
15344
|
+
classPrefix2,
|
|
15391
15345
|
{
|
|
15392
|
-
|
|
15393
|
-
classPrefix2,
|
|
15394
|
-
{
|
|
15395
|
-
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
15396
|
-
},
|
|
15397
|
-
className
|
|
15398
|
-
),
|
|
15399
|
-
style,
|
|
15400
|
-
onClick: handleClick2,
|
|
15401
|
-
...rest
|
|
15346
|
+
[`${classPrefix2}-reverse`]: labelPosition === "left"
|
|
15402
15347
|
},
|
|
15403
|
-
|
|
15348
|
+
className
|
|
15404
15349
|
);
|
|
15350
|
+
return /* @__PURE__ */ React.createElement("div", { className: cls, style, onClick: handleClick2, ...rest }, renderRadioItem());
|
|
15405
15351
|
};
|
|
15406
15352
|
Radio.displayName = "NutRadio";
|
|
15407
15353
|
Radio.Group = RadioGroup;
|
|
@@ -15423,9 +15369,6 @@
|
|
|
15423
15369
|
button,
|
|
15424
15370
|
vertical,
|
|
15425
15371
|
marks,
|
|
15426
|
-
onChange,
|
|
15427
|
-
onStart,
|
|
15428
|
-
onEnd,
|
|
15429
15372
|
minDescription,
|
|
15430
15373
|
maxDescription,
|
|
15431
15374
|
currentDescription,
|
|
@@ -15433,7 +15376,10 @@
|
|
|
15433
15376
|
max,
|
|
15434
15377
|
step,
|
|
15435
15378
|
value,
|
|
15436
|
-
defaultValue
|
|
15379
|
+
defaultValue,
|
|
15380
|
+
onChange,
|
|
15381
|
+
onStart,
|
|
15382
|
+
onEnd
|
|
15437
15383
|
} = { ...defaultProps$O, ...props };
|
|
15438
15384
|
const classPrefix2 = "nut-range";
|
|
15439
15385
|
const [buttonIndex, setButtonIndex] = React.useState(0);
|
|
@@ -15451,7 +15397,7 @@
|
|
|
15451
15397
|
finalValue: 0,
|
|
15452
15398
|
onChange: handleChange
|
|
15453
15399
|
});
|
|
15454
|
-
const [exactValue,
|
|
15400
|
+
const [exactValue, setExactValue] = React.useState(
|
|
15455
15401
|
() => value || defaultValue || 0
|
|
15456
15402
|
);
|
|
15457
15403
|
const marksRef = React.useRef({});
|
|
@@ -15469,10 +15415,7 @@
|
|
|
15469
15415
|
setMarksList(list);
|
|
15470
15416
|
}
|
|
15471
15417
|
}
|
|
15472
|
-
}, [marks]);
|
|
15473
|
-
const scope = () => {
|
|
15474
|
-
return max - min;
|
|
15475
|
-
};
|
|
15418
|
+
}, [marks, max, min]);
|
|
15476
15419
|
const classes = classNames(classPrefix2, {
|
|
15477
15420
|
[`${classPrefix2}-disabled`]: disabled,
|
|
15478
15421
|
[`${classPrefix2}-vertical`]: vertical
|
|
@@ -15484,41 +15427,38 @@
|
|
|
15484
15427
|
},
|
|
15485
15428
|
className
|
|
15486
15429
|
);
|
|
15487
|
-
const markClassName =
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
},
|
|
15504
|
-
[range2, current, min, max]
|
|
15505
|
-
);
|
|
15430
|
+
const markClassName = (mark) => {
|
|
15431
|
+
const classPrefix22 = "nut-range-mark";
|
|
15432
|
+
let lowerBound = min;
|
|
15433
|
+
let upperBound = max;
|
|
15434
|
+
if (range2 && Array.isArray(current)) {
|
|
15435
|
+
lowerBound = current[0];
|
|
15436
|
+
upperBound = current[1];
|
|
15437
|
+
} else {
|
|
15438
|
+
upperBound = current;
|
|
15439
|
+
}
|
|
15440
|
+
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
15441
|
+
return [
|
|
15442
|
+
`${classPrefix22}-text`,
|
|
15443
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
15444
|
+
].join(" ");
|
|
15445
|
+
};
|
|
15506
15446
|
const isRange = (val) => {
|
|
15507
15447
|
return !!range2 && Array.isArray(val);
|
|
15508
15448
|
};
|
|
15449
|
+
const scope = React.useMemo(() => {
|
|
15450
|
+
if (max < min || max === min) {
|
|
15451
|
+
console.log("max 的值需要大于 min的值");
|
|
15452
|
+
}
|
|
15453
|
+
return max - min;
|
|
15454
|
+
}, [max, min]);
|
|
15509
15455
|
const calcMainAxis = () => {
|
|
15510
15456
|
const modelVal = current;
|
|
15511
|
-
|
|
15512
|
-
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
15513
|
-
}
|
|
15514
|
-
return `${(modelVal - min) * 100 / scope()}%`;
|
|
15457
|
+
return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
|
|
15515
15458
|
};
|
|
15516
15459
|
const calcOffset = () => {
|
|
15517
15460
|
const modelVal = current;
|
|
15518
|
-
|
|
15519
|
-
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
15520
|
-
}
|
|
15521
|
-
return `0%`;
|
|
15461
|
+
return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
|
|
15522
15462
|
};
|
|
15523
15463
|
const barStyle = () => {
|
|
15524
15464
|
if (vertical) {
|
|
@@ -15538,11 +15478,11 @@
|
|
|
15538
15478
|
const marksStyle = (mark) => {
|
|
15539
15479
|
const dir = rtl ? "right" : "left";
|
|
15540
15480
|
let style = {
|
|
15541
|
-
[dir]: `${(mark - min) / scope
|
|
15481
|
+
[dir]: `${(mark - min) / scope * 100}%`
|
|
15542
15482
|
};
|
|
15543
15483
|
if (vertical) {
|
|
15544
15484
|
style = {
|
|
15545
|
-
top: `${(mark - min) / scope
|
|
15485
|
+
top: `${(mark - min) / scope * 100}%`
|
|
15546
15486
|
};
|
|
15547
15487
|
}
|
|
15548
15488
|
return style;
|
|
@@ -15589,8 +15529,8 @@
|
|
|
15589
15529
|
delta = event.clientY - rect.top;
|
|
15590
15530
|
total = rect.height;
|
|
15591
15531
|
}
|
|
15592
|
-
const value2 = min + delta / total * scope
|
|
15593
|
-
|
|
15532
|
+
const value2 = min + delta / total * scope;
|
|
15533
|
+
setExactValue(current);
|
|
15594
15534
|
if (isRange(current)) {
|
|
15595
15535
|
const [left, right] = current;
|
|
15596
15536
|
const middle = (left + right) / 2;
|
|
@@ -15608,7 +15548,7 @@
|
|
|
15608
15548
|
return;
|
|
15609
15549
|
}
|
|
15610
15550
|
touch.start(event);
|
|
15611
|
-
|
|
15551
|
+
setExactValue(current);
|
|
15612
15552
|
if (isRange(current)) {
|
|
15613
15553
|
setStartValue(current.map(format2));
|
|
15614
15554
|
} else {
|
|
@@ -15629,12 +15569,12 @@
|
|
|
15629
15569
|
const rect = getRect(root2.current);
|
|
15630
15570
|
let delta = touch.deltaX.current;
|
|
15631
15571
|
let total = rect.width;
|
|
15632
|
-
let diff = delta / total * scope
|
|
15572
|
+
let diff = delta / total * scope;
|
|
15633
15573
|
diff = rtl ? -diff : diff;
|
|
15634
15574
|
if (vertical) {
|
|
15635
15575
|
delta = touch.deltaY.current;
|
|
15636
15576
|
total = rect.height;
|
|
15637
|
-
diff = delta / total * scope
|
|
15577
|
+
diff = delta / total * scope;
|
|
15638
15578
|
}
|
|
15639
15579
|
let newValue;
|
|
15640
15580
|
if (isRange(startValue)) {
|
|
@@ -15643,7 +15583,7 @@
|
|
|
15643
15583
|
} else {
|
|
15644
15584
|
newValue = startValue + diff;
|
|
15645
15585
|
}
|
|
15646
|
-
|
|
15586
|
+
setExactValue(newValue);
|
|
15647
15587
|
updateValue(newValue);
|
|
15648
15588
|
};
|
|
15649
15589
|
const onTouchEnd = () => {
|
|
@@ -15663,56 +15603,64 @@
|
|
|
15663
15603
|
const renderButton = (index) => {
|
|
15664
15604
|
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))));
|
|
15665
15605
|
};
|
|
15666
|
-
|
|
15667
|
-
return
|
|
15668
|
-
"
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
style: marksStyle(mark)
|
|
15673
|
-
},
|
|
15674
|
-
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
15675
|
-
/* @__PURE__ */ React.createElement(
|
|
15676
|
-
"span",
|
|
15606
|
+
const renderRangeButton = () => {
|
|
15607
|
+
return [0, 1].map((item, index) => {
|
|
15608
|
+
const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
15609
|
+
${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
|
|
15610
|
+
return /* @__PURE__ */ React.createElement(
|
|
15611
|
+
"div",
|
|
15677
15612
|
{
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15613
|
+
key: index,
|
|
15614
|
+
className: cls,
|
|
15615
|
+
onTouchStart: (e) => {
|
|
15616
|
+
setButtonIndex(index);
|
|
15617
|
+
onTouchStart(e);
|
|
15618
|
+
},
|
|
15619
|
+
onTouchMove,
|
|
15620
|
+
onTouchEnd,
|
|
15621
|
+
onTouchCancel: onTouchEnd,
|
|
15622
|
+
onClick: (e) => e.stopPropagation()
|
|
15623
|
+
},
|
|
15624
|
+
renderButton(index)
|
|
15625
|
+
);
|
|
15626
|
+
});
|
|
15627
|
+
};
|
|
15628
|
+
const renderSingleButton = () => {
|
|
15685
15629
|
return /* @__PURE__ */ React.createElement(
|
|
15686
15630
|
"div",
|
|
15687
15631
|
{
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
onTouchStart: (e) => {
|
|
15692
|
-
if (typeof index === "number") {
|
|
15693
|
-
setButtonIndex(index);
|
|
15694
|
-
}
|
|
15695
|
-
onTouchStart(e);
|
|
15696
|
-
},
|
|
15697
|
-
onTouchMove: (e) => onTouchMove(e),
|
|
15632
|
+
className: "nut-range-button-wrapper",
|
|
15633
|
+
onTouchStart,
|
|
15634
|
+
onTouchMove,
|
|
15698
15635
|
onTouchEnd,
|
|
15699
15636
|
onTouchCancel: onTouchEnd,
|
|
15700
15637
|
onClick: (e) => e.stopPropagation()
|
|
15701
15638
|
},
|
|
15702
|
-
renderButton(
|
|
15639
|
+
renderButton()
|
|
15703
15640
|
);
|
|
15704
|
-
}
|
|
15705
|
-
|
|
15706
|
-
{
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15641
|
+
};
|
|
15642
|
+
const renderMark = () => {
|
|
15643
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
|
|
15644
|
+
return /* @__PURE__ */ React.createElement(
|
|
15645
|
+
"span",
|
|
15646
|
+
{
|
|
15647
|
+
key: mark,
|
|
15648
|
+
className: markClassName(mark),
|
|
15649
|
+
style: marksStyle(mark)
|
|
15650
|
+
},
|
|
15651
|
+
Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
|
|
15652
|
+
/* @__PURE__ */ React.createElement(
|
|
15653
|
+
"span",
|
|
15654
|
+
{
|
|
15655
|
+
className: classNames("nut-range-tick", {
|
|
15656
|
+
active: tickClass(mark)
|
|
15657
|
+
})
|
|
15658
|
+
}
|
|
15659
|
+
)
|
|
15660
|
+
);
|
|
15661
|
+
})));
|
|
15662
|
+
};
|
|
15663
|
+
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: (e) => click(e) }, renderMark(), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? renderRangeButton() : renderSingleButton())), maxDescription !== null && /* @__PURE__ */ React.createElement("div", { className: "max" }, maxDescription || max));
|
|
15716
15664
|
};
|
|
15717
15665
|
Range.displayName = "NutRange";
|
|
15718
15666
|
const defaultProps$N = {
|
|
@@ -15926,7 +15874,7 @@
|
|
|
15926
15874
|
};
|
|
15927
15875
|
const SearchBar = (props) => {
|
|
15928
15876
|
const classPrefix2 = "nut-searchbar";
|
|
15929
|
-
const { locale } = useConfig
|
|
15877
|
+
const { locale } = useConfig();
|
|
15930
15878
|
const searchRef = React.useRef(null);
|
|
15931
15879
|
const {
|
|
15932
15880
|
value: outerValue,
|
|
@@ -16079,7 +16027,7 @@
|
|
|
16079
16027
|
autoFocus: false
|
|
16080
16028
|
};
|
|
16081
16029
|
const InternalShortPassword = (props, ref) => {
|
|
16082
|
-
const { locale } = useConfig
|
|
16030
|
+
const { locale } = useConfig();
|
|
16083
16031
|
const {
|
|
16084
16032
|
title,
|
|
16085
16033
|
description,
|
|
@@ -16177,7 +16125,7 @@
|
|
|
16177
16125
|
unsupported: ""
|
|
16178
16126
|
};
|
|
16179
16127
|
const InternalSignature = (props, ref) => {
|
|
16180
|
-
const { locale } = useConfig
|
|
16128
|
+
const { locale } = useConfig();
|
|
16181
16129
|
const {
|
|
16182
16130
|
type,
|
|
16183
16131
|
lineWidth,
|
|
@@ -16358,7 +16306,7 @@
|
|
|
16358
16306
|
autoSize: false
|
|
16359
16307
|
};
|
|
16360
16308
|
const TextArea = (props) => {
|
|
16361
|
-
const { locale } = useConfig
|
|
16309
|
+
const { locale } = useConfig();
|
|
16362
16310
|
const {
|
|
16363
16311
|
className,
|
|
16364
16312
|
value,
|
|
@@ -16782,7 +16730,7 @@
|
|
|
16782
16730
|
}
|
|
16783
16731
|
};
|
|
16784
16732
|
const InternalUploader = (props, ref) => {
|
|
16785
|
-
const { locale } = useConfig
|
|
16733
|
+
const { locale } = useConfig();
|
|
16786
16734
|
const fileListRef = React.useRef([]);
|
|
16787
16735
|
const {
|
|
16788
16736
|
children,
|
|
@@ -17363,6 +17311,18 @@
|
|
|
17363
17311
|
);
|
|
17364
17312
|
};
|
|
17365
17313
|
Content.displayName = "NutContent";
|
|
17314
|
+
const defaultDialogProps = {
|
|
17315
|
+
...ComponentDefaults,
|
|
17316
|
+
overlay: true,
|
|
17317
|
+
overlayStyle: {},
|
|
17318
|
+
overlayClassName: "",
|
|
17319
|
+
onCancel: () => {
|
|
17320
|
+
},
|
|
17321
|
+
onClose: () => {
|
|
17322
|
+
},
|
|
17323
|
+
onOverlayClick: (e) => true,
|
|
17324
|
+
...defaultOverlayProps
|
|
17325
|
+
};
|
|
17366
17326
|
const DialogWrap = (props) => {
|
|
17367
17327
|
const {
|
|
17368
17328
|
visible,
|
|
@@ -17374,7 +17334,7 @@
|
|
|
17374
17334
|
onClose,
|
|
17375
17335
|
onCancel,
|
|
17376
17336
|
onOverlayClick
|
|
17377
|
-
} = props;
|
|
17337
|
+
} = mergeProps(defaultDialogProps, props);
|
|
17378
17338
|
const onHandleClickOverlay = (e) => {
|
|
17379
17339
|
if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
|
|
17380
17340
|
const closed = onOverlayClick && onOverlayClick(e);
|
|
@@ -17422,7 +17382,7 @@
|
|
|
17422
17382
|
beforeClose: () => true
|
|
17423
17383
|
};
|
|
17424
17384
|
const BaseDialog = (props, ref) => {
|
|
17425
|
-
const { locale } = useConfig
|
|
17385
|
+
const { locale } = useConfig();
|
|
17426
17386
|
const {
|
|
17427
17387
|
visible,
|
|
17428
17388
|
footer,
|
|
@@ -17719,7 +17679,7 @@
|
|
|
17719
17679
|
};
|
|
17720
17680
|
const classPrefix$d = `nut-infiniteloading`;
|
|
17721
17681
|
const InfiniteLoading = (props) => {
|
|
17722
|
-
const { locale } = useConfig
|
|
17682
|
+
const { locale } = useConfig();
|
|
17723
17683
|
const {
|
|
17724
17684
|
children,
|
|
17725
17685
|
type,
|
|
@@ -18789,7 +18749,7 @@
|
|
|
18789
18749
|
};
|
|
18790
18750
|
const PullToRefresh = (p2) => {
|
|
18791
18751
|
const classPrefix2 = "nut-pulltorefresh";
|
|
18792
|
-
const { locale } = useConfig
|
|
18752
|
+
const { locale } = useConfig();
|
|
18793
18753
|
const props = {
|
|
18794
18754
|
...defaultProps$x,
|
|
18795
18755
|
...p2,
|
|
@@ -18970,7 +18930,6 @@
|
|
|
18970
18930
|
};
|
|
18971
18931
|
const classPrefix$9 = `nut-avatar`;
|
|
18972
18932
|
const Avatar = (props) => {
|
|
18973
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
18974
18933
|
const {
|
|
18975
18934
|
children,
|
|
18976
18935
|
size,
|
|
@@ -18996,9 +18955,10 @@
|
|
|
18996
18955
|
const avatarRef = React.useRef(null);
|
|
18997
18956
|
const parent = React.useContext(AvatarContext);
|
|
18998
18957
|
const sizeValue = ["large", "normal", "small"];
|
|
18958
|
+
const { propAvatarGroup, avatarGroupRef } = parent;
|
|
18999
18959
|
const classes = classNames({
|
|
19000
|
-
[`nut-avatar-${(
|
|
19001
|
-
[`nut-avatar-${(
|
|
18960
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
|
|
18961
|
+
[`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
|
|
19002
18962
|
});
|
|
19003
18963
|
const cls = classNames(classPrefix$9, classes, className);
|
|
19004
18964
|
const styles = {
|
|
@@ -19006,45 +18966,45 @@
|
|
|
19006
18966
|
height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
|
|
19007
18967
|
backgroundColor: `${background}`,
|
|
19008
18968
|
color,
|
|
19009
|
-
marginLeft: avatarIndex !== 1 && (
|
|
19010
|
-
zIndex: (
|
|
18969
|
+
marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
|
|
18970
|
+
zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
|
|
19011
18971
|
...style
|
|
19012
18972
|
};
|
|
19013
18973
|
const maxStyles = {
|
|
19014
|
-
backgroundColor: `${
|
|
19015
|
-
color: `${
|
|
19016
|
-
};
|
|
18974
|
+
backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
|
|
18975
|
+
color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
|
|
18976
|
+
};
|
|
18977
|
+
const avatarLength = React.useCallback(
|
|
18978
|
+
(children2) => {
|
|
18979
|
+
var _a, _b;
|
|
18980
|
+
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
18981
|
+
if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
|
|
18982
|
+
children2[i2].setAttribute("data-index", i2 + 1);
|
|
18983
|
+
}
|
|
18984
|
+
}
|
|
18985
|
+
const index = Number((_b = (_a = avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
|
|
18986
|
+
const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
|
|
18987
|
+
setMaxSum(children2.length);
|
|
18988
|
+
setAvatarIndex(index);
|
|
18989
|
+
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
18990
|
+
setShowMax(true);
|
|
18991
|
+
}
|
|
18992
|
+
},
|
|
18993
|
+
[propAvatarGroup == null ? void 0 : propAvatarGroup.max]
|
|
18994
|
+
);
|
|
19017
18995
|
React.useEffect(() => {
|
|
19018
|
-
|
|
19019
|
-
const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
|
|
18996
|
+
const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
|
|
19020
18997
|
if (avatarChildren) {
|
|
19021
18998
|
avatarLength(avatarChildren);
|
|
19022
18999
|
}
|
|
19023
|
-
}, []);
|
|
19024
|
-
const avatarLength = (children2) => {
|
|
19025
|
-
var _a2, _b2, _c2;
|
|
19026
|
-
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
19027
|
-
if (children2[i2] && children2[i2].classList && children2[i2].classList[0] === "nut-avatar") {
|
|
19028
|
-
children2[i2].setAttribute("data-index", i2 + 1);
|
|
19029
|
-
}
|
|
19030
|
-
}
|
|
19031
|
-
const index = Number((_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index);
|
|
19032
|
-
const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
|
|
19033
|
-
setMaxSum(children2.length);
|
|
19034
|
-
setAvatarIndex(index);
|
|
19035
|
-
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
19036
|
-
setShowMax(true);
|
|
19037
|
-
}
|
|
19038
|
-
};
|
|
19000
|
+
}, [avatarLength, avatarGroupRef]);
|
|
19039
19001
|
const errorEvent = () => {
|
|
19040
|
-
|
|
19041
|
-
onError();
|
|
19042
|
-
}
|
|
19002
|
+
onError && onError();
|
|
19043
19003
|
};
|
|
19044
19004
|
const clickAvatar = (e) => {
|
|
19045
19005
|
onClick && onClick(e);
|
|
19046
19006
|
};
|
|
19047
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(
|
|
19007
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(
|
|
19048
19008
|
"div",
|
|
19049
19009
|
{
|
|
19050
19010
|
className: cls,
|
|
@@ -19053,7 +19013,7 @@
|
|
|
19053
19013
|
onClick: clickAvatar,
|
|
19054
19014
|
ref: avatarRef
|
|
19055
19015
|
},
|
|
19056
|
-
(!(
|
|
19016
|
+
(!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React.createElement(React.Fragment, null, src && /* @__PURE__ */ React.createElement(
|
|
19057
19017
|
Image$1,
|
|
19058
19018
|
{
|
|
19059
19019
|
className: "avatar-img",
|
|
@@ -19066,7 +19026,7 @@
|
|
|
19066
19026
|
...icon.props,
|
|
19067
19027
|
className: `${icon.props.className || ""} icon`
|
|
19068
19028
|
}) : null, children && /* @__PURE__ */ React.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React.createElement(i, { className: "icon" })),
|
|
19069
|
-
showMax && /* @__PURE__ */ React.createElement("div", { className: "text" }, (
|
|
19029
|
+
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)}`)
|
|
19070
19030
|
));
|
|
19071
19031
|
};
|
|
19072
19032
|
Avatar.displayName = "NutAvatar";
|
|
@@ -19575,7 +19535,7 @@
|
|
|
19575
19535
|
className,
|
|
19576
19536
|
thousands,
|
|
19577
19537
|
style,
|
|
19578
|
-
...
|
|
19538
|
+
...rest
|
|
19579
19539
|
} = mergeProps(defaultProps$r, props);
|
|
19580
19540
|
const classPrefix2 = "nut-countup";
|
|
19581
19541
|
const countupRef = React.useRef(null);
|
|
@@ -19588,7 +19548,7 @@
|
|
|
19588
19548
|
return currNumber.split("");
|
|
19589
19549
|
};
|
|
19590
19550
|
const numerArr = React.useMemo(getShowNumber, [value, length, thousands]);
|
|
19591
|
-
const setNumberTransform = () => {
|
|
19551
|
+
const setNumberTransform = React.useCallback(() => {
|
|
19592
19552
|
if (countupRef.current) {
|
|
19593
19553
|
const numberItems = countupRef.current.querySelectorAll(
|
|
19594
19554
|
".nut-countup-number"
|
|
@@ -19606,7 +19566,7 @@
|
|
|
19606
19566
|
}
|
|
19607
19567
|
});
|
|
19608
19568
|
}
|
|
19609
|
-
};
|
|
19569
|
+
}, [numerArr]);
|
|
19610
19570
|
const numberEaseStyle = {
|
|
19611
19571
|
transition: `transform ${duration}s ease-in-out`
|
|
19612
19572
|
};
|
|
@@ -19617,7 +19577,7 @@
|
|
|
19617
19577
|
return () => {
|
|
19618
19578
|
window.clearTimeout(timerRef.current);
|
|
19619
19579
|
};
|
|
19620
|
-
}, [numerArr]);
|
|
19580
|
+
}, [numerArr, delay, setNumberTransform]);
|
|
19621
19581
|
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
|
|
19622
19582
|
return /* @__PURE__ */ React.createElement(
|
|
19623
19583
|
"li",
|
|
@@ -19678,7 +19638,7 @@
|
|
|
19678
19638
|
}
|
|
19679
19639
|
};
|
|
19680
19640
|
const Audio = (props) => {
|
|
19681
|
-
const { locale } = useConfig
|
|
19641
|
+
const { locale } = useConfig();
|
|
19682
19642
|
const {
|
|
19683
19643
|
className,
|
|
19684
19644
|
src,
|
|
@@ -21367,7 +21327,7 @@
|
|
|
21367
21327
|
ellipse: false
|
|
21368
21328
|
};
|
|
21369
21329
|
const Pagination = (props) => {
|
|
21370
|
-
const { locale } = useConfig
|
|
21330
|
+
const { locale } = useConfig();
|
|
21371
21331
|
const {
|
|
21372
21332
|
value,
|
|
21373
21333
|
mode,
|
|
@@ -21714,7 +21674,7 @@
|
|
|
21714
21674
|
showHeader: true
|
|
21715
21675
|
};
|
|
21716
21676
|
const Table = (props) => {
|
|
21717
|
-
const { locale } = useConfig
|
|
21677
|
+
const { locale } = useConfig();
|
|
21718
21678
|
const rtl = useRtl();
|
|
21719
21679
|
defaultProps$a.noData = locale.noData;
|
|
21720
21680
|
const {
|
|
@@ -21984,7 +21944,7 @@
|
|
|
21984
21944
|
};
|
|
21985
21945
|
const classPrefix$2 = "nut-tour";
|
|
21986
21946
|
const Tour = (props) => {
|
|
21987
|
-
const { locale } = useConfig
|
|
21947
|
+
const { locale } = useConfig();
|
|
21988
21948
|
const {
|
|
21989
21949
|
children,
|
|
21990
21950
|
className,
|
|
@@ -22639,7 +22599,7 @@
|
|
|
22639
22599
|
}
|
|
22640
22600
|
};
|
|
22641
22601
|
const TimeSelect = (props) => {
|
|
22642
|
-
const { locale } = useConfig
|
|
22602
|
+
const { locale } = useConfig();
|
|
22643
22603
|
const {
|
|
22644
22604
|
visible,
|
|
22645
22605
|
className,
|
|
@@ -22864,7 +22824,7 @@
|
|
|
22864
22824
|
fontSize: 14
|
|
22865
22825
|
};
|
|
22866
22826
|
const WaterMark = (props) => {
|
|
22867
|
-
const { locale } = useConfig
|
|
22827
|
+
const { locale } = useConfig();
|
|
22868
22828
|
const {
|
|
22869
22829
|
content,
|
|
22870
22830
|
fullPage,
|
|
@@ -23422,9 +23382,9 @@
|
|
|
23422
23382
|
exports2.Video = Video;
|
|
23423
23383
|
exports2.VirtualList = VirtualList;
|
|
23424
23384
|
exports2.WaterMark = WaterMark;
|
|
23425
|
-
exports2.getDefaultConfig = getDefaultConfig
|
|
23385
|
+
exports2.getDefaultConfig = getDefaultConfig;
|
|
23426
23386
|
exports2.setDefaultConfig = setDefaultConfig;
|
|
23427
|
-
exports2.useConfig = useConfig
|
|
23387
|
+
exports2.useConfig = useConfig;
|
|
23428
23388
|
exports2.useRtl = useRtl;
|
|
23429
23389
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
23430
23390
|
});
|