@nutui/nutui-react 2.0.21 → 2.0.23-beta.0
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 +24 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +4 -0
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +4 -0
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/CalendarCard/style/css.js +1 -0
- package/dist/esm/CalendarCard/style/index.js +2 -0
- package/dist/esm/CalendarCard/style/style.css +1 -0
- package/dist/esm/CalendarCard.js +513 -0
- package/dist/esm/CalendarItem.js +2 -0
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +4 -0
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/DatePicker.js +4 -4
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Dialog.js +4 -0
- package/dist/esm/FixedNav/style/style.css +1 -1
- package/dist/esm/Image.js +24 -10
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/Menu.js +4 -2
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +4 -2
- package/dist/esm/NoticeBar/style/style.css +1 -1
- package/dist/esm/NoticeBar.js +9 -6
- package/dist/esm/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/Overlay/style/style.css +1 -1
- package/dist/esm/Overlay.js +4 -0
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Picker.js +32 -9
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popup/style/style.css +1 -1
- package/dist/esm/Popup.js +4 -0
- package/dist/esm/PullToRefresh.js +2 -14
- package/dist/esm/Range.js +2 -2
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/Swipe.js +8 -5
- package/dist/esm/TabPane/style/style.css +1 -1
- package/dist/esm/Tabs/style/style.css +1 -1
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Toast.js +4 -0
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/nutui-react.es.js +136 -134
- package/dist/esm/overlay2.js +76 -15
- package/dist/esm/popup2.js +5 -4
- package/dist/esm/supports-passive.js +17 -0
- package/dist/esm/types/src/packages/calendarcard/__tests__/calendarcard.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/calendarcard/calendarcard.d.ts +24 -0
- package/dist/esm/types/src/packages/calendarcard/calendarcard.taro.d.ts +24 -0
- package/dist/esm/types/src/packages/calendarcard/demo.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/demo.taro.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/icon.d.ts +5 -0
- package/dist/esm/types/src/packages/calendarcard/icon.taro.d.ts +5 -0
- package/dist/esm/types/src/packages/calendarcard/index.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/index.taro.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/types.d.ts +11 -0
- package/dist/esm/types/src/packages/calendarcard/utils.d.ts +19 -0
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +2 -1
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/image/demo.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/nutui.react.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +2 -0
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +2 -0
- package/dist/esm/types/src/utils/use-lock-scoll-taro.d.ts +2 -0
- package/dist/esm/types/src/utils/use-lock-scroll.d.ts +2 -0
- package/dist/esm/types/src/utils/use-props-value.d.ts +1 -1
- package/dist/esm/types/src/utils/use-touch.d.ts +8 -9
- package/dist/esm/use-props-value.js +3 -2
- package/dist/esm/use-touch.js +23 -32
- 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 +733 -228
- package/dist/nutui.react.umd.js +733 -228
- package/dist/packages/calendarcard/calendarcard.scss +104 -0
- package/dist/packages/noticebar/noticebar.scss +1 -0
- package/dist/packages/overlay/overlay.scss +5 -0
- package/dist/packages/tabpane/tabpane.scss +0 -8
- package/dist/packages/tabs/tabs.scss +6 -8
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/packages/calendarcard/calendarcard.d.ts +76 -0
- package/dist/types/packages/calendarcard/icon.d.ts +5 -0
- package/dist/types/packages/calendarcard/index.d.ts +3 -0
- package/dist/types/packages/calendarcard/types.d.ts +11 -0
- package/dist/types/packages/calendarcard/utils.d.ts +19 -0
- package/dist/types/packages/datepicker/datepicker.d.ts +6 -1
- package/dist/types/packages/picker/picker.d.ts +6 -0
- package/dist/types/utils/use-lock-scroll.d.ts +2 -0
- package/dist/types/utils/use-props-value.d.ts +1 -1
- package/dist/types/utils/use-touch.d.ts +8 -9
- package/package.json +1 -1
- package/dist/esm/types/src/packages/dialog/dialogwrap.taro.d.ts +0 -14
package/dist/nutui.react.es.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
var _a;
|
|
8
8
|
/*!
|
|
9
|
-
* @nutui/nutui-react v2.0.
|
|
9
|
+
* @nutui/nutui-react v2.0.23 Fri Nov 03 2023 19:51:24 GMT+0800 (中国标准时间)
|
|
10
10
|
* (c) 2023 @jdf2e.
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*/
|
|
@@ -2438,7 +2438,7 @@ const ComponentDefaults = {
|
|
|
2438
2438
|
style: {}
|
|
2439
2439
|
};
|
|
2440
2440
|
const prefixCls$1 = "nut-button";
|
|
2441
|
-
const defaultProps$
|
|
2441
|
+
const defaultProps$1t = {
|
|
2442
2442
|
...ComponentDefaults,
|
|
2443
2443
|
color: "",
|
|
2444
2444
|
type: "default",
|
|
@@ -2472,7 +2472,7 @@ const Button = React__default.forwardRef(
|
|
|
2472
2472
|
nativeType,
|
|
2473
2473
|
...rest
|
|
2474
2474
|
} = {
|
|
2475
|
-
...defaultProps$
|
|
2475
|
+
...defaultProps$1t,
|
|
2476
2476
|
...props
|
|
2477
2477
|
};
|
|
2478
2478
|
const getStyle = useCallback(() => {
|
|
@@ -2524,7 +2524,7 @@ const Button = React__default.forwardRef(
|
|
|
2524
2524
|
);
|
|
2525
2525
|
Button.displayName = "NutButton";
|
|
2526
2526
|
const CellGroupContext = createContext(null);
|
|
2527
|
-
const defaultProps$
|
|
2527
|
+
const defaultProps$1s = {
|
|
2528
2528
|
...ComponentDefaults,
|
|
2529
2529
|
title: "",
|
|
2530
2530
|
description: "",
|
|
@@ -2533,7 +2533,7 @@ const defaultProps$1r = {
|
|
|
2533
2533
|
const classPrefix$p = "nut-cell-group";
|
|
2534
2534
|
const CellGroup = (props) => {
|
|
2535
2535
|
const { children, className, style, title, description, divider, ...rest } = {
|
|
2536
|
-
...defaultProps$
|
|
2536
|
+
...defaultProps$1s,
|
|
2537
2537
|
...props
|
|
2538
2538
|
};
|
|
2539
2539
|
return /* @__PURE__ */ React__default.createElement("div", { className: classNames(classPrefix$p, className), ...rest }, title ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$p}__title` }, title) : null, description ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$p}__description` }, description) : null, /* @__PURE__ */ React__default.createElement(
|
|
@@ -2544,9 +2544,9 @@ const CellGroup = (props) => {
|
|
|
2544
2544
|
/* @__PURE__ */ React__default.createElement(CellGroupContext.Provider, { value: { divider } }, children)
|
|
2545
2545
|
));
|
|
2546
2546
|
};
|
|
2547
|
-
CellGroup.defaultProps = defaultProps$
|
|
2547
|
+
CellGroup.defaultProps = defaultProps$1s;
|
|
2548
2548
|
CellGroup.displayName = "NutCellGroup";
|
|
2549
|
-
const defaultProps$
|
|
2549
|
+
const defaultProps$1r = {
|
|
2550
2550
|
...ComponentDefaults,
|
|
2551
2551
|
title: null,
|
|
2552
2552
|
description: null,
|
|
@@ -2571,7 +2571,7 @@ const Cell = (props) => {
|
|
|
2571
2571
|
style,
|
|
2572
2572
|
...rest
|
|
2573
2573
|
} = {
|
|
2574
|
-
...defaultProps$
|
|
2574
|
+
...defaultProps$1r,
|
|
2575
2575
|
...props
|
|
2576
2576
|
};
|
|
2577
2577
|
const handleClick2 = (event) => {
|
|
@@ -2604,7 +2604,7 @@ const Cell = (props) => {
|
|
|
2604
2604
|
(ctx2 == null ? void 0 : ctx2.divider) ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$o}__divider` }) : null
|
|
2605
2605
|
);
|
|
2606
2606
|
};
|
|
2607
|
-
Cell.defaultProps = defaultProps$
|
|
2607
|
+
Cell.defaultProps = defaultProps$1r;
|
|
2608
2608
|
Cell.displayName = "NutCell";
|
|
2609
2609
|
Cell.Group = CellGroup;
|
|
2610
2610
|
var INFINITY = 1 / 0;
|
|
@@ -3745,7 +3745,7 @@ ConfigProvider.displayName = "NutConfigProvider";
|
|
|
3745
3745
|
const pxCheck = (value) => {
|
|
3746
3746
|
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
3747
3747
|
};
|
|
3748
|
-
const defaultProps$
|
|
3748
|
+
const defaultProps$1q = {
|
|
3749
3749
|
...ComponentDefaults,
|
|
3750
3750
|
fit: "fill",
|
|
3751
3751
|
position: "center",
|
|
@@ -3774,26 +3774,40 @@ const Image$1 = (props) => {
|
|
|
3774
3774
|
onClick,
|
|
3775
3775
|
onLoad,
|
|
3776
3776
|
onError
|
|
3777
|
-
} = { ...defaultProps$
|
|
3778
|
-
const [innerLoading, setInnerLoading] = useState(
|
|
3777
|
+
} = { ...defaultProps$1q, ...props };
|
|
3778
|
+
const [innerLoading, setInnerLoading] = useState(false);
|
|
3779
3779
|
const [isError, setIsError] = useState(false);
|
|
3780
|
+
const [complete, setComplete] = useState(false);
|
|
3780
3781
|
const imgRef = useRef(null);
|
|
3781
3782
|
useEffect(() => {
|
|
3782
|
-
if (imgRef.current && imgRef.current.complete
|
|
3783
|
-
|
|
3784
|
-
|
|
3783
|
+
if (imgRef.current && imgRef.current.complete) {
|
|
3784
|
+
if (imgRef.current.naturalHeight === 0) {
|
|
3785
|
+
handleError();
|
|
3786
|
+
} else {
|
|
3787
|
+
handleLoad();
|
|
3788
|
+
}
|
|
3789
|
+
} else {
|
|
3785
3790
|
setInnerLoading(true);
|
|
3786
3791
|
}
|
|
3792
|
+
}, [imgRef]);
|
|
3793
|
+
useEffect(() => {
|
|
3794
|
+
setComplete(false);
|
|
3787
3795
|
}, [src]);
|
|
3788
3796
|
const handleLoad = () => {
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3797
|
+
if (!complete) {
|
|
3798
|
+
setIsError(false);
|
|
3799
|
+
setInnerLoading(false);
|
|
3800
|
+
onLoad && onLoad();
|
|
3801
|
+
setComplete(true);
|
|
3802
|
+
}
|
|
3792
3803
|
};
|
|
3793
3804
|
const handleError = () => {
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3805
|
+
if (!complete) {
|
|
3806
|
+
setIsError(true);
|
|
3807
|
+
setInnerLoading(false);
|
|
3808
|
+
onError && onError();
|
|
3809
|
+
setComplete(true);
|
|
3810
|
+
}
|
|
3797
3811
|
};
|
|
3798
3812
|
const containerStyle = {
|
|
3799
3813
|
height: height ? pxCheck(height) : "",
|
|
@@ -3901,7 +3915,7 @@ const Image$1 = (props) => {
|
|
|
3901
3915
|
renderErrorImg()
|
|
3902
3916
|
);
|
|
3903
3917
|
};
|
|
3904
|
-
Image$1.defaultProps = defaultProps$
|
|
3918
|
+
Image$1.defaultProps = defaultProps$1q;
|
|
3905
3919
|
Image$1.displayName = "NutImage";
|
|
3906
3920
|
function _extends$4() {
|
|
3907
3921
|
_extends$4 = Object.assign ? Object.assign.bind() : function(target) {
|
|
@@ -5644,6 +5658,171 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$4({},
|
|
|
5644
5658
|
onExited: propTypesExports.func
|
|
5645
5659
|
}) : {};
|
|
5646
5660
|
const CSSTransition$1 = CSSTransition;
|
|
5661
|
+
const MIN_DISTANCE = 10;
|
|
5662
|
+
function getDirection(x2, y2) {
|
|
5663
|
+
if (x2 > y2 && x2 > MIN_DISTANCE) {
|
|
5664
|
+
return "horizontal";
|
|
5665
|
+
}
|
|
5666
|
+
if (y2 > x2 && y2 > MIN_DISTANCE) {
|
|
5667
|
+
return "vertical";
|
|
5668
|
+
}
|
|
5669
|
+
return "";
|
|
5670
|
+
}
|
|
5671
|
+
function useTouch() {
|
|
5672
|
+
const startX = useRef(0);
|
|
5673
|
+
const startY = useRef(0);
|
|
5674
|
+
const deltaX = useRef(0);
|
|
5675
|
+
const deltaY = useRef(0);
|
|
5676
|
+
const offsetX = useRef(0);
|
|
5677
|
+
const offsetY = useRef(0);
|
|
5678
|
+
const direction = useRef("");
|
|
5679
|
+
const isVertical = () => direction.current === "vertical";
|
|
5680
|
+
const isHorizontal = () => direction.current === "horizontal";
|
|
5681
|
+
const reset = () => {
|
|
5682
|
+
deltaX.current = 0;
|
|
5683
|
+
deltaY.current = 0;
|
|
5684
|
+
offsetX.current = 0;
|
|
5685
|
+
offsetY.current = 0;
|
|
5686
|
+
direction.current = "";
|
|
5687
|
+
};
|
|
5688
|
+
const start2 = (event) => {
|
|
5689
|
+
reset();
|
|
5690
|
+
startX.current = event.touches[0].clientX;
|
|
5691
|
+
startY.current = event.touches[0].clientY;
|
|
5692
|
+
};
|
|
5693
|
+
const move = (event) => {
|
|
5694
|
+
const touch = event.touches[0];
|
|
5695
|
+
deltaX.current = touch.clientX < 0 ? 0 : touch.clientX - startX.current;
|
|
5696
|
+
deltaY.current = touch.clientY - startY.current;
|
|
5697
|
+
offsetX.current = Math.abs(deltaX.current);
|
|
5698
|
+
offsetY.current = Math.abs(deltaY.current);
|
|
5699
|
+
if (!direction.current) {
|
|
5700
|
+
direction.current = getDirection(offsetX.current, offsetY.current);
|
|
5701
|
+
}
|
|
5702
|
+
};
|
|
5703
|
+
return {
|
|
5704
|
+
move,
|
|
5705
|
+
start: start2,
|
|
5706
|
+
reset,
|
|
5707
|
+
startX,
|
|
5708
|
+
startY,
|
|
5709
|
+
deltaX,
|
|
5710
|
+
deltaY,
|
|
5711
|
+
offsetX,
|
|
5712
|
+
offsetY,
|
|
5713
|
+
direction,
|
|
5714
|
+
isVertical,
|
|
5715
|
+
isHorizontal
|
|
5716
|
+
};
|
|
5717
|
+
}
|
|
5718
|
+
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
5719
|
+
const defaultRoot = canUseDom ? window : void 0;
|
|
5720
|
+
const overflowStylePatterns = ["scroll", "auto", "overlay"];
|
|
5721
|
+
function isElement(node) {
|
|
5722
|
+
const ELEMENT_NODE_TYPE = 1;
|
|
5723
|
+
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
5724
|
+
}
|
|
5725
|
+
function getScrollParent(el, root2 = defaultRoot) {
|
|
5726
|
+
let node = el;
|
|
5727
|
+
while (node && node !== root2 && isElement(node)) {
|
|
5728
|
+
if (node === document.body) {
|
|
5729
|
+
return root2;
|
|
5730
|
+
}
|
|
5731
|
+
const { overflowY } = window.getComputedStyle(node);
|
|
5732
|
+
if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
|
|
5733
|
+
return node;
|
|
5734
|
+
}
|
|
5735
|
+
node = node.parentNode;
|
|
5736
|
+
}
|
|
5737
|
+
return root2;
|
|
5738
|
+
}
|
|
5739
|
+
let passiveSupported = false;
|
|
5740
|
+
if (canUseDom) {
|
|
5741
|
+
try {
|
|
5742
|
+
const opts = Object.defineProperty({}, "passive", {
|
|
5743
|
+
get() {
|
|
5744
|
+
passiveSupported = true;
|
|
5745
|
+
}
|
|
5746
|
+
});
|
|
5747
|
+
window.addEventListener("test-passive-supported", null, opts);
|
|
5748
|
+
} catch (e) {
|
|
5749
|
+
console.log(e);
|
|
5750
|
+
}
|
|
5751
|
+
}
|
|
5752
|
+
let totalLockCount = 0;
|
|
5753
|
+
const BODY_LOCK_CLASS = "nut-overflow-hidden";
|
|
5754
|
+
function getScrollableElement(el) {
|
|
5755
|
+
let current = el == null ? void 0 : el.parentElement;
|
|
5756
|
+
while (current) {
|
|
5757
|
+
if (current.clientHeight < current.scrollHeight) {
|
|
5758
|
+
return current;
|
|
5759
|
+
}
|
|
5760
|
+
current = current.parentElement;
|
|
5761
|
+
}
|
|
5762
|
+
return null;
|
|
5763
|
+
}
|
|
5764
|
+
function useLockScroll(rootRef, shouldLock) {
|
|
5765
|
+
const touch = useTouch();
|
|
5766
|
+
const onTouchMove = (event) => {
|
|
5767
|
+
touch.move(event);
|
|
5768
|
+
const direction = touch.deltaY.current > 0 ? "10" : "01";
|
|
5769
|
+
const el = getScrollParent(
|
|
5770
|
+
event.target,
|
|
5771
|
+
rootRef.current
|
|
5772
|
+
);
|
|
5773
|
+
if (!el)
|
|
5774
|
+
return;
|
|
5775
|
+
if (shouldLock === "strict") {
|
|
5776
|
+
const scrollableParent = getScrollableElement(event.target);
|
|
5777
|
+
if (scrollableParent === document.body || scrollableParent === document.documentElement) {
|
|
5778
|
+
event.preventDefault();
|
|
5779
|
+
return;
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
const { scrollHeight, offsetHeight, scrollTop } = el;
|
|
5783
|
+
let status = "11";
|
|
5784
|
+
if (scrollTop === 0) {
|
|
5785
|
+
status = offsetHeight >= scrollHeight ? "00" : "01";
|
|
5786
|
+
} else if (scrollTop + offsetHeight >= scrollHeight) {
|
|
5787
|
+
status = "10";
|
|
5788
|
+
}
|
|
5789
|
+
if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
|
|
5790
|
+
if (event.cancelable) {
|
|
5791
|
+
event.preventDefault();
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
};
|
|
5795
|
+
const lock = () => {
|
|
5796
|
+
document.addEventListener("touchstart", touch.start);
|
|
5797
|
+
document.addEventListener(
|
|
5798
|
+
"touchmove",
|
|
5799
|
+
onTouchMove,
|
|
5800
|
+
passiveSupported ? { passive: false } : false
|
|
5801
|
+
);
|
|
5802
|
+
if (!totalLockCount) {
|
|
5803
|
+
document.body.classList.add(BODY_LOCK_CLASS);
|
|
5804
|
+
}
|
|
5805
|
+
totalLockCount++;
|
|
5806
|
+
};
|
|
5807
|
+
const unlock = () => {
|
|
5808
|
+
if (totalLockCount) {
|
|
5809
|
+
document.removeEventListener("touchstart", touch.start);
|
|
5810
|
+
document.removeEventListener("touchmove", onTouchMove);
|
|
5811
|
+
totalLockCount--;
|
|
5812
|
+
if (!totalLockCount) {
|
|
5813
|
+
document.body.classList.remove(BODY_LOCK_CLASS);
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
};
|
|
5817
|
+
useEffect(() => {
|
|
5818
|
+
if (shouldLock) {
|
|
5819
|
+
lock();
|
|
5820
|
+
return () => {
|
|
5821
|
+
unlock();
|
|
5822
|
+
};
|
|
5823
|
+
}
|
|
5824
|
+
}, [shouldLock]);
|
|
5825
|
+
}
|
|
5647
5826
|
const defaultOverlayProps = {
|
|
5648
5827
|
...ComponentDefaults,
|
|
5649
5828
|
zIndex: 1e3,
|
|
@@ -5681,24 +5860,12 @@ const Overlay = (props) => {
|
|
|
5681
5860
|
} else {
|
|
5682
5861
|
setInnerVisible(false);
|
|
5683
5862
|
}
|
|
5684
|
-
lock();
|
|
5685
5863
|
}, [visible]);
|
|
5686
|
-
|
|
5687
|
-
return () => {
|
|
5688
|
-
document.body.classList.remove("nut-overflow-hidden");
|
|
5689
|
-
};
|
|
5690
|
-
}, []);
|
|
5864
|
+
useLockScroll(nodeRef, !!props.lockScroll && innerVisible);
|
|
5691
5865
|
const classes = classNames(className, classPrefix2);
|
|
5692
5866
|
const styles = {
|
|
5693
5867
|
...style
|
|
5694
5868
|
};
|
|
5695
|
-
const lock = () => {
|
|
5696
|
-
if (lockScroll && visible) {
|
|
5697
|
-
document.body.classList.add("nut-overflow-hidden");
|
|
5698
|
-
} else {
|
|
5699
|
-
document.body.classList.remove("nut-overflow-hidden");
|
|
5700
|
-
}
|
|
5701
|
-
};
|
|
5702
5869
|
const handleClick2 = (e) => {
|
|
5703
5870
|
if (closeOnOverlayClick) {
|
|
5704
5871
|
onClick && onClick(e);
|
|
@@ -5737,7 +5904,7 @@ const Overlay = (props) => {
|
|
|
5737
5904
|
Overlay.defaultProps = defaultOverlayProps;
|
|
5738
5905
|
Overlay.displayName = "NutOverlay";
|
|
5739
5906
|
const DataContext$2 = createContext({});
|
|
5740
|
-
const defaultProps$
|
|
5907
|
+
const defaultProps$1p = {
|
|
5741
5908
|
...ComponentDefaults,
|
|
5742
5909
|
span: "24",
|
|
5743
5910
|
offset: "0",
|
|
@@ -5745,7 +5912,7 @@ const defaultProps$1o = {
|
|
|
5745
5912
|
};
|
|
5746
5913
|
const Col = (props) => {
|
|
5747
5914
|
const { className, style, span, offset, children, onClick } = {
|
|
5748
|
-
...defaultProps$
|
|
5915
|
+
...defaultProps$1p,
|
|
5749
5916
|
...props
|
|
5750
5917
|
};
|
|
5751
5918
|
const [colName, setColName] = useState("");
|
|
@@ -5777,9 +5944,9 @@ const Col = (props) => {
|
|
|
5777
5944
|
children
|
|
5778
5945
|
);
|
|
5779
5946
|
};
|
|
5780
|
-
Col.defaultProps = defaultProps$
|
|
5947
|
+
Col.defaultProps = defaultProps$1p;
|
|
5781
5948
|
Col.displayName = "NutCol";
|
|
5782
|
-
const defaultProps$
|
|
5949
|
+
const defaultProps$1o = {
|
|
5783
5950
|
...ComponentDefaults,
|
|
5784
5951
|
contentPosition: "center",
|
|
5785
5952
|
direction: "horizontal"
|
|
@@ -5787,7 +5954,7 @@ const defaultProps$1n = {
|
|
|
5787
5954
|
const classPrefix$l = `nut-divider`;
|
|
5788
5955
|
const Divider = (props) => {
|
|
5789
5956
|
const { children, contentPosition, style, className, direction, ...rest } = {
|
|
5790
|
-
...defaultProps$
|
|
5957
|
+
...defaultProps$1o,
|
|
5791
5958
|
...props
|
|
5792
5959
|
};
|
|
5793
5960
|
const classes = direction === "horizontal" ? classNames({
|
|
@@ -5802,14 +5969,14 @@ const Divider = (props) => {
|
|
|
5802
5969
|
});
|
|
5803
5970
|
return /* @__PURE__ */ React__default.createElement("div", { className: `${classes} ${className || ""}`, style, ...rest }, children);
|
|
5804
5971
|
};
|
|
5805
|
-
Divider.defaultProps = defaultProps$
|
|
5972
|
+
Divider.defaultProps = defaultProps$1o;
|
|
5806
5973
|
Divider.displayName = "NutDivider";
|
|
5807
5974
|
const gridContext = {
|
|
5808
5975
|
onClick: (item, index) => {
|
|
5809
5976
|
}
|
|
5810
5977
|
};
|
|
5811
5978
|
const GridContext = React__default.createContext(gridContext);
|
|
5812
|
-
const defaultProps$
|
|
5979
|
+
const defaultProps$1n = {
|
|
5813
5980
|
text: "",
|
|
5814
5981
|
columns: 4,
|
|
5815
5982
|
gap: 0,
|
|
@@ -5835,7 +6002,7 @@ const GridItem = (props) => {
|
|
|
5835
6002
|
onClick,
|
|
5836
6003
|
...rest
|
|
5837
6004
|
} = {
|
|
5838
|
-
...defaultProps$
|
|
6005
|
+
...defaultProps$1n,
|
|
5839
6006
|
...props
|
|
5840
6007
|
};
|
|
5841
6008
|
const classPrefix2 = "nut-grid-item";
|
|
@@ -5893,9 +6060,9 @@ const GridItem = (props) => {
|
|
|
5893
6060
|
/* @__PURE__ */ React__default.createElement("div", { className: contentClass() }, children && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children), text && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__text` }, text))
|
|
5894
6061
|
);
|
|
5895
6062
|
};
|
|
5896
|
-
GridItem.defaultProps = defaultProps$
|
|
6063
|
+
GridItem.defaultProps = defaultProps$1n;
|
|
5897
6064
|
GridItem.displayName = "NutGridItem";
|
|
5898
|
-
const defaultProps$
|
|
6065
|
+
const defaultProps$1m = {
|
|
5899
6066
|
columns: 4,
|
|
5900
6067
|
gap: 0,
|
|
5901
6068
|
center: true,
|
|
@@ -5916,7 +6083,7 @@ const Grid = (props) => {
|
|
|
5916
6083
|
className,
|
|
5917
6084
|
onClick,
|
|
5918
6085
|
...rest
|
|
5919
|
-
} = { ...defaultProps$
|
|
6086
|
+
} = { ...defaultProps$1m, ...props };
|
|
5920
6087
|
const childrenDom = React__default.Children.toArray(children);
|
|
5921
6088
|
const classPrefix2 = "nut-grid";
|
|
5922
6089
|
const rootClass = () => {
|
|
@@ -5946,18 +6113,18 @@ const Grid = (props) => {
|
|
|
5946
6113
|
});
|
|
5947
6114
|
})));
|
|
5948
6115
|
};
|
|
5949
|
-
Grid.defaultProps = defaultProps$
|
|
6116
|
+
Grid.defaultProps = defaultProps$1m;
|
|
5950
6117
|
Grid.displayName = "NutGrid";
|
|
5951
6118
|
Grid.Item = GridItem;
|
|
5952
|
-
const defaultProps$
|
|
6119
|
+
const defaultProps$1l = {};
|
|
5953
6120
|
const Layout = (props) => {
|
|
5954
|
-
({ ...defaultProps$
|
|
6121
|
+
({ ...defaultProps$1l, ...props });
|
|
5955
6122
|
return /* @__PURE__ */ React__default.createElement("div", { className: "nut-layout" }, "Layout");
|
|
5956
6123
|
};
|
|
5957
|
-
Layout.defaultProps = defaultProps$
|
|
6124
|
+
Layout.defaultProps = defaultProps$1l;
|
|
5958
6125
|
Layout.displayName = "NutLayout";
|
|
5959
6126
|
const classPrefix$k = "nut-row";
|
|
5960
|
-
const defaultProps$
|
|
6127
|
+
const defaultProps$1k = {
|
|
5961
6128
|
...ComponentDefaults,
|
|
5962
6129
|
type: "",
|
|
5963
6130
|
justify: "start",
|
|
@@ -5977,7 +6144,7 @@ const Row = (props) => {
|
|
|
5977
6144
|
gutter,
|
|
5978
6145
|
onClick
|
|
5979
6146
|
} = {
|
|
5980
|
-
...defaultProps$
|
|
6147
|
+
...defaultProps$1k,
|
|
5981
6148
|
...props
|
|
5982
6149
|
};
|
|
5983
6150
|
const getClass = (prefix2, type22) => {
|
|
@@ -6009,15 +6176,15 @@ const Row = (props) => {
|
|
|
6009
6176
|
children
|
|
6010
6177
|
));
|
|
6011
6178
|
};
|
|
6012
|
-
Row.defaultProps = defaultProps$
|
|
6179
|
+
Row.defaultProps = defaultProps$1k;
|
|
6013
6180
|
Row.displayName = "NutRow";
|
|
6014
6181
|
const prefixCls = "nut-space";
|
|
6015
|
-
const defaultProps$
|
|
6182
|
+
const defaultProps$1j = {
|
|
6016
6183
|
direction: "horizontal"
|
|
6017
6184
|
};
|
|
6018
6185
|
const Space = (props) => {
|
|
6019
6186
|
const { className, style, children, wrap, align, direction, justify } = {
|
|
6020
|
-
...defaultProps$
|
|
6187
|
+
...defaultProps$1j,
|
|
6021
6188
|
...props
|
|
6022
6189
|
};
|
|
6023
6190
|
const cls = classNames(
|
|
@@ -6032,29 +6199,8 @@ const Space = (props) => {
|
|
|
6032
6199
|
return child !== null && child !== void 0 && /* @__PURE__ */ React__default.createElement("div", { className: `${prefixCls}-item` }, child);
|
|
6033
6200
|
}));
|
|
6034
6201
|
};
|
|
6035
|
-
Space.defaultProps = defaultProps$
|
|
6202
|
+
Space.defaultProps = defaultProps$1j;
|
|
6036
6203
|
Space.displayName = "NutSpace";
|
|
6037
|
-
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
6038
|
-
const defaultRoot = canUseDom ? window : void 0;
|
|
6039
|
-
const overflowStylePatterns = ["scroll", "auto", "overlay"];
|
|
6040
|
-
function isElement(node) {
|
|
6041
|
-
const ELEMENT_NODE_TYPE = 1;
|
|
6042
|
-
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
6043
|
-
}
|
|
6044
|
-
function getScrollParent(el, root2 = defaultRoot) {
|
|
6045
|
-
let node = el;
|
|
6046
|
-
while (node && node !== root2 && isElement(node)) {
|
|
6047
|
-
if (node === document.body) {
|
|
6048
|
-
return root2;
|
|
6049
|
-
}
|
|
6050
|
-
const { overflowY } = window.getComputedStyle(node);
|
|
6051
|
-
if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
|
|
6052
|
-
return node;
|
|
6053
|
-
}
|
|
6054
|
-
node = node.parentNode;
|
|
6055
|
-
}
|
|
6056
|
-
return root2;
|
|
6057
|
-
}
|
|
6058
6204
|
function isWindow(val) {
|
|
6059
6205
|
return val === window;
|
|
6060
6206
|
}
|
|
@@ -6107,7 +6253,7 @@ function useWatch(dep, callback, config2 = { immediate: false }) {
|
|
|
6107
6253
|
stop2.current = true;
|
|
6108
6254
|
};
|
|
6109
6255
|
}
|
|
6110
|
-
const defaultProps$
|
|
6256
|
+
const defaultProps$1i = {
|
|
6111
6257
|
...ComponentDefaults,
|
|
6112
6258
|
position: "top",
|
|
6113
6259
|
threshold: 0,
|
|
@@ -6125,7 +6271,7 @@ const Sticky = (props) => {
|
|
|
6125
6271
|
threshold,
|
|
6126
6272
|
onChange,
|
|
6127
6273
|
...rest
|
|
6128
|
-
} = { ...defaultProps$
|
|
6274
|
+
} = { ...defaultProps$1i, ...props };
|
|
6129
6275
|
const stickyRef = useRef(null);
|
|
6130
6276
|
const rootRef = useRef(null);
|
|
6131
6277
|
const [isFixed, setIsFixed] = useState(false);
|
|
@@ -6241,9 +6387,9 @@ const Sticky = (props) => {
|
|
|
6241
6387
|
/* @__PURE__ */ React__default.createElement("div", { className: "nut-sticky--box", ref: stickyRef, style: stickyStyle }, children)
|
|
6242
6388
|
);
|
|
6243
6389
|
};
|
|
6244
|
-
Sticky.defaultProps = defaultProps$
|
|
6390
|
+
Sticky.defaultProps = defaultProps$1i;
|
|
6245
6391
|
Sticky.displayName = "NutSticky";
|
|
6246
|
-
const defaultProps$
|
|
6392
|
+
const defaultProps$1h = {
|
|
6247
6393
|
...ComponentDefaults,
|
|
6248
6394
|
target: "",
|
|
6249
6395
|
threshold: 200,
|
|
@@ -6261,7 +6407,7 @@ const BackTop = (props) => {
|
|
|
6261
6407
|
style,
|
|
6262
6408
|
onClick
|
|
6263
6409
|
} = {
|
|
6264
|
-
...defaultProps$
|
|
6410
|
+
...defaultProps$1h,
|
|
6265
6411
|
...props
|
|
6266
6412
|
};
|
|
6267
6413
|
const classPrefix2 = "nut-backtop";
|
|
@@ -6359,7 +6505,7 @@ const BackTop = (props) => {
|
|
|
6359
6505
|
children || /* @__PURE__ */ React__default.createElement(y$2, { width: 19, height: 19, className: "nut-backtop-main" })
|
|
6360
6506
|
);
|
|
6361
6507
|
};
|
|
6362
|
-
BackTop.defaultProps = defaultProps$
|
|
6508
|
+
BackTop.defaultProps = defaultProps$1h;
|
|
6363
6509
|
BackTop.displayName = "NutBackTop";
|
|
6364
6510
|
function clamp$1(v, min, max) {
|
|
6365
6511
|
return Math.max(min, Math.min(v, max));
|
|
@@ -11477,7 +11623,7 @@ const host = createHost(primitives, {
|
|
|
11477
11623
|
});
|
|
11478
11624
|
const animated = host.animated;
|
|
11479
11625
|
const elevatorContext = createContext({});
|
|
11480
|
-
const defaultProps$
|
|
11626
|
+
const defaultProps$1g = {
|
|
11481
11627
|
...ComponentDefaults,
|
|
11482
11628
|
height: "200px",
|
|
11483
11629
|
floorKey: "title",
|
|
@@ -11503,7 +11649,7 @@ const Elevator = (props) => {
|
|
|
11503
11649
|
children,
|
|
11504
11650
|
...rest
|
|
11505
11651
|
} = {
|
|
11506
|
-
...defaultProps$
|
|
11652
|
+
...defaultProps$1g,
|
|
11507
11653
|
...props
|
|
11508
11654
|
};
|
|
11509
11655
|
const classPrefix2 = "nut-elevator";
|
|
@@ -11678,10 +11824,10 @@ const Elevator = (props) => {
|
|
|
11678
11824
|
})
|
|
11679
11825
|
))) : null);
|
|
11680
11826
|
};
|
|
11681
|
-
Elevator.defaultProps = defaultProps$
|
|
11827
|
+
Elevator.defaultProps = defaultProps$1g;
|
|
11682
11828
|
Elevator.displayName = "NutElevator";
|
|
11683
11829
|
Elevator.Context = elevatorContext;
|
|
11684
|
-
const defaultProps$
|
|
11830
|
+
const defaultProps$1f = {
|
|
11685
11831
|
...ComponentDefaults,
|
|
11686
11832
|
activeText: "",
|
|
11687
11833
|
inactiveText: "",
|
|
@@ -11709,7 +11855,7 @@ const FixedNav = (props) => {
|
|
|
11709
11855
|
content,
|
|
11710
11856
|
...rest
|
|
11711
11857
|
} = {
|
|
11712
|
-
...defaultProps$
|
|
11858
|
+
...defaultProps$1f,
|
|
11713
11859
|
...props
|
|
11714
11860
|
};
|
|
11715
11861
|
const classPrefix2 = "nut-fixednav";
|
|
@@ -11761,9 +11907,9 @@ const FixedNav = (props) => {
|
|
|
11761
11907
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__btn`, onClick: () => onUpdateValue() }, content || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(y$7, { color: "#fff" }), /* @__PURE__ */ React__default.createElement("div", { className: "text" }, visible ? activeText || locale.fixednav.activeText : inactiveText || locale.fixednav.inactiveText)))
|
|
11762
11908
|
);
|
|
11763
11909
|
};
|
|
11764
|
-
FixedNav.defaultProps = defaultProps$
|
|
11910
|
+
FixedNav.defaultProps = defaultProps$1f;
|
|
11765
11911
|
FixedNav.displayName = "NutFixedNav";
|
|
11766
|
-
const defaultProps$
|
|
11912
|
+
const defaultProps$1e = {
|
|
11767
11913
|
...ComponentDefaults,
|
|
11768
11914
|
left: "",
|
|
11769
11915
|
right: "",
|
|
@@ -11786,7 +11932,7 @@ const NavBar = (props) => {
|
|
|
11786
11932
|
zIndex,
|
|
11787
11933
|
onBackClick
|
|
11788
11934
|
} = {
|
|
11789
|
-
...defaultProps$
|
|
11935
|
+
...defaultProps$1e,
|
|
11790
11936
|
...props
|
|
11791
11937
|
};
|
|
11792
11938
|
const classPrefix2 = "nut-navbar";
|
|
@@ -11823,9 +11969,9 @@ const NavBar = (props) => {
|
|
|
11823
11969
|
const cls = classNames(classPrefix2, classes, className);
|
|
11824
11970
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}--placeholder` }, renderWrapper()) : renderWrapper());
|
|
11825
11971
|
};
|
|
11826
|
-
NavBar.defaultProps = defaultProps$
|
|
11972
|
+
NavBar.defaultProps = defaultProps$1e;
|
|
11827
11973
|
NavBar.displayName = "NutNavBar";
|
|
11828
|
-
const defaultProps$
|
|
11974
|
+
const defaultProps$1d = {
|
|
11829
11975
|
...ComponentDefaults,
|
|
11830
11976
|
position: "center",
|
|
11831
11977
|
transition: "",
|
|
@@ -11846,7 +11992,7 @@ const defaultProps$1c = {
|
|
|
11846
11992
|
onCloseIconClick: (e) => true,
|
|
11847
11993
|
...defaultOverlayProps
|
|
11848
11994
|
};
|
|
11849
|
-
|
|
11995
|
+
const _zIndex = 1100;
|
|
11850
11996
|
const Popup = (props) => {
|
|
11851
11997
|
const {
|
|
11852
11998
|
children,
|
|
@@ -11877,12 +12023,14 @@ const Popup = (props) => {
|
|
|
11877
12023
|
afterShow,
|
|
11878
12024
|
afterClose,
|
|
11879
12025
|
onClick
|
|
11880
|
-
} = { ...defaultProps$
|
|
12026
|
+
} = { ...defaultProps$1d, ...props };
|
|
11881
12027
|
const nodeRef = React__default.useRef(null);
|
|
11882
|
-
|
|
12028
|
+
let innerIndex = zIndex || _zIndex;
|
|
12029
|
+
const [index, setIndex] = useState(innerIndex);
|
|
11883
12030
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
11884
12031
|
const [showChildren, setShowChildren] = useState(true);
|
|
11885
12032
|
const [transitionName, setTransitionName] = useState("");
|
|
12033
|
+
useLockScroll(nodeRef, innerVisible && lockScroll);
|
|
11886
12034
|
const classPrefix2 = "nut-popup";
|
|
11887
12035
|
const baseStyle = {
|
|
11888
12036
|
zIndex: index
|
|
@@ -11908,7 +12056,7 @@ const Popup = (props) => {
|
|
|
11908
12056
|
const open = () => {
|
|
11909
12057
|
if (!innerVisible) {
|
|
11910
12058
|
setInnerVisible(true);
|
|
11911
|
-
setIndex(++
|
|
12059
|
+
setIndex(++innerIndex);
|
|
11912
12060
|
}
|
|
11913
12061
|
if (destroyOnClose) {
|
|
11914
12062
|
setShowChildren(true);
|
|
@@ -12000,7 +12148,6 @@ const Popup = (props) => {
|
|
|
12000
12148
|
className: overlayClassName,
|
|
12001
12149
|
visible: innerVisible,
|
|
12002
12150
|
closeOnOverlayClick,
|
|
12003
|
-
zIndex,
|
|
12004
12151
|
lockScroll,
|
|
12005
12152
|
duration,
|
|
12006
12153
|
onClick: onHandleClickOverlay
|
|
@@ -12016,7 +12163,7 @@ const Popup = (props) => {
|
|
|
12016
12163
|
}, [position, transition]);
|
|
12017
12164
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderToContainer(portal, renderNode()));
|
|
12018
12165
|
};
|
|
12019
|
-
Popup.defaultProps = defaultProps$
|
|
12166
|
+
Popup.defaultProps = defaultProps$1d;
|
|
12020
12167
|
Popup.displayName = "NutPopup";
|
|
12021
12168
|
const handleClick = (e) => {
|
|
12022
12169
|
e.stopPropagation();
|
|
@@ -12032,7 +12179,7 @@ const handleClick = (e) => {
|
|
|
12032
12179
|
}
|
|
12033
12180
|
};
|
|
12034
12181
|
const OffsetContext = createContext(20);
|
|
12035
|
-
const defaultProps$
|
|
12182
|
+
const defaultProps$1c = {
|
|
12036
12183
|
...ComponentDefaults,
|
|
12037
12184
|
position: "left",
|
|
12038
12185
|
width: "80%"
|
|
@@ -12049,7 +12196,7 @@ const SideNavBar = (props) => {
|
|
|
12049
12196
|
onClose,
|
|
12050
12197
|
...rest
|
|
12051
12198
|
} = {
|
|
12052
|
-
...defaultProps$
|
|
12199
|
+
...defaultProps$1c,
|
|
12053
12200
|
...props
|
|
12054
12201
|
};
|
|
12055
12202
|
const indent = props.indent ? Number(props.indent) : 20;
|
|
@@ -12081,7 +12228,7 @@ const SideNavBar = (props) => {
|
|
|
12081
12228
|
)))
|
|
12082
12229
|
);
|
|
12083
12230
|
};
|
|
12084
|
-
SideNavBar.defaultProps = defaultProps$
|
|
12231
|
+
SideNavBar.defaultProps = defaultProps$1c;
|
|
12085
12232
|
SideNavBar.displayName = "NutSideNavBar";
|
|
12086
12233
|
const SideNavBarItem = (props) => {
|
|
12087
12234
|
const classPrefix2 = "nut-subsidenavbar";
|
|
@@ -12100,13 +12247,13 @@ const SideNavBarItem = (props) => {
|
|
|
12100
12247
|
title
|
|
12101
12248
|
);
|
|
12102
12249
|
};
|
|
12103
|
-
const defaultProps$
|
|
12250
|
+
const defaultProps$1b = {
|
|
12104
12251
|
open: true
|
|
12105
12252
|
};
|
|
12106
12253
|
const SubSideNavBar = (props) => {
|
|
12107
12254
|
const classPrefix2 = "nut-subsidenavbar";
|
|
12108
12255
|
const { title, value, children, onClick, open, ...rest } = {
|
|
12109
|
-
...defaultProps$
|
|
12256
|
+
...defaultProps$1b,
|
|
12110
12257
|
...props
|
|
12111
12258
|
};
|
|
12112
12259
|
const offset = useContext(OffsetContext);
|
|
@@ -12171,19 +12318,19 @@ function usePropsValue({
|
|
|
12171
12318
|
stateRef.current = value;
|
|
12172
12319
|
}
|
|
12173
12320
|
const setState = useCallback(
|
|
12174
|
-
(v) => {
|
|
12321
|
+
(v, forceTrigger = false) => {
|
|
12175
12322
|
const prevState = stateRef.current;
|
|
12176
12323
|
stateRef.current = v;
|
|
12177
|
-
if (prevState !== stateRef.current) {
|
|
12324
|
+
if (prevState !== stateRef.current || forceTrigger) {
|
|
12178
12325
|
forceUpdate();
|
|
12326
|
+
onChange == null ? void 0 : onChange(v);
|
|
12179
12327
|
}
|
|
12180
|
-
onChange == null ? void 0 : onChange(v);
|
|
12181
12328
|
},
|
|
12182
12329
|
[value, onChange]
|
|
12183
12330
|
);
|
|
12184
12331
|
return [stateRef.current, setState];
|
|
12185
12332
|
}
|
|
12186
|
-
const defaultProps$
|
|
12333
|
+
const defaultProps$1a = {
|
|
12187
12334
|
...ComponentDefaults,
|
|
12188
12335
|
value: "",
|
|
12189
12336
|
dot: false,
|
|
@@ -12194,7 +12341,7 @@ const defaultProps$19 = {
|
|
|
12194
12341
|
};
|
|
12195
12342
|
const Badge = (props) => {
|
|
12196
12343
|
const { className, style, value, max, children, dot, top, right, color } = {
|
|
12197
|
-
...defaultProps$
|
|
12344
|
+
...defaultProps$1a,
|
|
12198
12345
|
...props
|
|
12199
12346
|
};
|
|
12200
12347
|
const classPrefix2 = "nut-badge";
|
|
@@ -12221,9 +12368,9 @@ const Badge = (props) => {
|
|
|
12221
12368
|
};
|
|
12222
12369
|
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, typeof value === "object" && value && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__icon` }, value), /* @__PURE__ */ React__default.createElement("div", null, children), /* @__PURE__ */ React__default.createElement("div", { className: contentClasses, style: getStyle() }, content()));
|
|
12223
12370
|
};
|
|
12224
|
-
Badge.defaultProps = defaultProps$
|
|
12371
|
+
Badge.defaultProps = defaultProps$1a;
|
|
12225
12372
|
Badge.displayName = "NutBadge";
|
|
12226
|
-
const defaultProps$
|
|
12373
|
+
const defaultProps$19 = {
|
|
12227
12374
|
...ComponentDefaults,
|
|
12228
12375
|
title: "",
|
|
12229
12376
|
icon: null,
|
|
@@ -12253,7 +12400,7 @@ const TabbarItem = (props) => {
|
|
|
12253
12400
|
handleClick: handleClick2,
|
|
12254
12401
|
...rest
|
|
12255
12402
|
} = {
|
|
12256
|
-
...defaultProps$
|
|
12403
|
+
...defaultProps$19,
|
|
12257
12404
|
...props
|
|
12258
12405
|
};
|
|
12259
12406
|
const classPrefix2 = "nut-tabbar-item";
|
|
@@ -12286,7 +12433,7 @@ const TabbarItem = (props) => {
|
|
|
12286
12433
|
icon ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React__default.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React__default.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React__default.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React__default.createElement("div", { className: titleClass }, title))
|
|
12287
12434
|
);
|
|
12288
12435
|
};
|
|
12289
|
-
const defaultProps$
|
|
12436
|
+
const defaultProps$18 = {
|
|
12290
12437
|
...ComponentDefaults,
|
|
12291
12438
|
defaultValue: 0,
|
|
12292
12439
|
fixed: false,
|
|
@@ -12309,7 +12456,7 @@ const Tabbar = (props) => {
|
|
|
12309
12456
|
style,
|
|
12310
12457
|
onSwitch
|
|
12311
12458
|
} = {
|
|
12312
|
-
...defaultProps$
|
|
12459
|
+
...defaultProps$18,
|
|
12313
12460
|
...props
|
|
12314
12461
|
};
|
|
12315
12462
|
const classPrefix2 = "nut-tabbar";
|
|
@@ -12344,17 +12491,17 @@ const Tabbar = (props) => {
|
|
|
12344
12491
|
(fixed || safeArea) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__safe-area` })
|
|
12345
12492
|
);
|
|
12346
12493
|
};
|
|
12347
|
-
Tabbar.defaultProps = defaultProps$
|
|
12494
|
+
Tabbar.defaultProps = defaultProps$18;
|
|
12348
12495
|
Tabbar.displayName = "NutTabbar";
|
|
12349
12496
|
Tabbar.Item = TabbarItem;
|
|
12350
|
-
const defaultProps$
|
|
12497
|
+
const defaultProps$17 = {
|
|
12351
12498
|
title: "",
|
|
12352
12499
|
value: "",
|
|
12353
12500
|
disabled: false
|
|
12354
12501
|
};
|
|
12355
12502
|
const TabPane = (props) => {
|
|
12356
12503
|
const { children, autoHeightClassName, className, disabled } = {
|
|
12357
|
-
...defaultProps$
|
|
12504
|
+
...defaultProps$17,
|
|
12358
12505
|
...props
|
|
12359
12506
|
};
|
|
12360
12507
|
const classPrefix2 = "nut-tabpane";
|
|
@@ -12380,7 +12527,7 @@ function requestAniFrame() {
|
|
|
12380
12527
|
};
|
|
12381
12528
|
}
|
|
12382
12529
|
const requestAniFrame$1 = requestAniFrame();
|
|
12383
|
-
const defaultProps$
|
|
12530
|
+
const defaultProps$16 = {
|
|
12384
12531
|
...ComponentDefaults,
|
|
12385
12532
|
tabStyle: {},
|
|
12386
12533
|
activeColor: "",
|
|
@@ -12406,7 +12553,7 @@ const Tabs = (props) => {
|
|
|
12406
12553
|
autoHeight,
|
|
12407
12554
|
...rest
|
|
12408
12555
|
} = {
|
|
12409
|
-
...defaultProps$
|
|
12556
|
+
...defaultProps$16,
|
|
12410
12557
|
...props
|
|
12411
12558
|
};
|
|
12412
12559
|
const [value, setValue] = usePropsValue({
|
|
@@ -12573,7 +12720,7 @@ const Tabs = (props) => {
|
|
|
12573
12720
|
return React__default.cloneElement(child, childProps);
|
|
12574
12721
|
}))));
|
|
12575
12722
|
};
|
|
12576
|
-
Tabs.defaultProps = defaultProps$
|
|
12723
|
+
Tabs.defaultProps = defaultProps$16;
|
|
12577
12724
|
Tabs.displayName = "NutTabs";
|
|
12578
12725
|
Tabs.TabPane = TabPane;
|
|
12579
12726
|
const formatTree = (tree, parent, config2) => tree.map((node) => {
|
|
@@ -12713,7 +12860,7 @@ class Tree {
|
|
|
12713
12860
|
}
|
|
12714
12861
|
}
|
|
12715
12862
|
const Tree$1 = Tree;
|
|
12716
|
-
const defaultProps$
|
|
12863
|
+
const defaultProps$15 = {
|
|
12717
12864
|
...ComponentDefaults,
|
|
12718
12865
|
activeColor: "",
|
|
12719
12866
|
activeIcon: "checklist",
|
|
@@ -12757,7 +12904,7 @@ const InternalCascader = (props, ref) => {
|
|
|
12757
12904
|
onClose,
|
|
12758
12905
|
onChange,
|
|
12759
12906
|
onPathChange
|
|
12760
|
-
} = { ...defaultProps$
|
|
12907
|
+
} = { ...defaultProps$15, ...props };
|
|
12761
12908
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
12762
12909
|
const [optionsData, setOptionsData] = useState([]);
|
|
12763
12910
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
@@ -13054,9 +13201,9 @@ const InternalCascader = (props, ref) => {
|
|
|
13054
13201
|
) : renderTabs());
|
|
13055
13202
|
};
|
|
13056
13203
|
const Cascader = React__default.forwardRef(InternalCascader);
|
|
13057
|
-
Cascader.defaultProps = defaultProps$
|
|
13204
|
+
Cascader.defaultProps = defaultProps$15;
|
|
13058
13205
|
Cascader.displayName = "NutCascader";
|
|
13059
|
-
const defaultProps$
|
|
13206
|
+
const defaultProps$14 = {
|
|
13060
13207
|
...ComponentDefaults,
|
|
13061
13208
|
visible: false,
|
|
13062
13209
|
type: "custom",
|
|
@@ -13083,7 +13230,7 @@ const CustomRender = (props) => {
|
|
|
13083
13230
|
onPathChange,
|
|
13084
13231
|
...rest
|
|
13085
13232
|
} = {
|
|
13086
|
-
...defaultProps$
|
|
13233
|
+
...defaultProps$14,
|
|
13087
13234
|
...props
|
|
13088
13235
|
};
|
|
13089
13236
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, type4 === "custom" && /* @__PURE__ */ React__default.createElement(
|
|
@@ -13108,7 +13255,7 @@ const CustomRender = (props) => {
|
|
|
13108
13255
|
}
|
|
13109
13256
|
));
|
|
13110
13257
|
};
|
|
13111
|
-
const defaultProps$
|
|
13258
|
+
const defaultProps$13 = {
|
|
13112
13259
|
type: "custom",
|
|
13113
13260
|
existList: [],
|
|
13114
13261
|
defaultIcon: null,
|
|
@@ -13127,7 +13274,7 @@ const ExistRender = (props) => {
|
|
|
13127
13274
|
onSelect,
|
|
13128
13275
|
onSwitch,
|
|
13129
13276
|
...rest
|
|
13130
|
-
} = { ...defaultProps$
|
|
13277
|
+
} = { ...defaultProps$13, ...props };
|
|
13131
13278
|
const classPrefix2 = "nut-address";
|
|
13132
13279
|
const selectedExist = (item) => {
|
|
13133
13280
|
existList.forEach((list, index) => {
|
|
@@ -13152,7 +13299,7 @@ const ExistRender = (props) => {
|
|
|
13152
13299
|
);
|
|
13153
13300
|
})), (custom || custom && locale.address.chooseAnotherAddress) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer`, onClick }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer-btn` }, custom)));
|
|
13154
13301
|
};
|
|
13155
|
-
const defaultProps$
|
|
13302
|
+
const defaultProps$12 = {
|
|
13156
13303
|
...ComponentDefaults,
|
|
13157
13304
|
defaultValue: [],
|
|
13158
13305
|
type: "custom",
|
|
@@ -13194,7 +13341,7 @@ const InternalAddress = (props, ref) => {
|
|
|
13194
13341
|
className,
|
|
13195
13342
|
...rest
|
|
13196
13343
|
} = {
|
|
13197
|
-
...defaultProps$
|
|
13344
|
+
...defaultProps$12,
|
|
13198
13345
|
...props
|
|
13199
13346
|
};
|
|
13200
13347
|
const classPrefix2 = "nut-address";
|
|
@@ -13285,7 +13432,7 @@ const InternalAddress = (props, ref) => {
|
|
|
13285
13432
|
));
|
|
13286
13433
|
};
|
|
13287
13434
|
const Address = forwardRef(InternalAddress);
|
|
13288
|
-
Address.defaultProps = defaultProps$
|
|
13435
|
+
Address.defaultProps = defaultProps$12;
|
|
13289
13436
|
Address.displayName = "NutAddress";
|
|
13290
13437
|
const Utils = {
|
|
13291
13438
|
/**
|
|
@@ -13535,7 +13682,7 @@ const isEnd = (day, days) => {
|
|
|
13535
13682
|
const isStartAndEnd = (days) => {
|
|
13536
13683
|
return days.length >= 2 && Utils.isEqual(days[0], days[1]);
|
|
13537
13684
|
};
|
|
13538
|
-
const defaultProps$
|
|
13685
|
+
const defaultProps$11 = {
|
|
13539
13686
|
...ComponentDefaults,
|
|
13540
13687
|
type: "single",
|
|
13541
13688
|
autoBackfill: false,
|
|
@@ -13595,7 +13742,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
13595
13742
|
onUpdate,
|
|
13596
13743
|
onDayClick,
|
|
13597
13744
|
onPageChange
|
|
13598
|
-
} = { ...defaultProps$
|
|
13745
|
+
} = { ...defaultProps$11, ...props };
|
|
13599
13746
|
const weekdays = locale.calendaritem.weekdays;
|
|
13600
13747
|
const weeks = [
|
|
13601
13748
|
...weekdays.slice(firstDayOfWeek, 7),
|
|
@@ -13929,6 +14076,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
13929
14076
|
}
|
|
13930
14077
|
const scrollTop = e.target.scrollTop;
|
|
13931
14078
|
let current = Math.floor(scrollTop / avgHeight);
|
|
14079
|
+
if (!monthsData[current + 1])
|
|
14080
|
+
return;
|
|
13932
14081
|
const nextTop = monthsData[current + 1].scrollTop;
|
|
13933
14082
|
const nextHeight = monthsData[current + 1].cssHeight;
|
|
13934
14083
|
if (current === 0) {
|
|
@@ -14129,9 +14278,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
14129
14278
|
};
|
|
14130
14279
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : ""));
|
|
14131
14280
|
});
|
|
14132
|
-
CalendarItem.defaultProps = defaultProps$
|
|
14281
|
+
CalendarItem.defaultProps = defaultProps$11;
|
|
14133
14282
|
CalendarItem.displayName = "NutCalendarItem";
|
|
14134
|
-
const defaultProps
|
|
14283
|
+
const defaultProps$10 = {
|
|
14135
14284
|
...ComponentDefaults,
|
|
14136
14285
|
type: "single",
|
|
14137
14286
|
autoBackfill: false,
|
|
@@ -14194,7 +14343,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
14194
14343
|
onConfirm,
|
|
14195
14344
|
onDayClick,
|
|
14196
14345
|
onPageChange
|
|
14197
|
-
} = { ...defaultProps
|
|
14346
|
+
} = { ...defaultProps$10, ...props };
|
|
14198
14347
|
const calendarRef = useRef(null);
|
|
14199
14348
|
const close = () => {
|
|
14200
14349
|
onClose && onClose();
|
|
@@ -14268,8 +14417,418 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
14268
14417
|
renderItem()
|
|
14269
14418
|
) : renderItem());
|
|
14270
14419
|
});
|
|
14271
|
-
Calendar.defaultProps = defaultProps
|
|
14420
|
+
Calendar.defaultProps = defaultProps$10;
|
|
14272
14421
|
Calendar.displayName = "NutCalendar";
|
|
14422
|
+
const Left = () => {
|
|
14423
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14424
|
+
"svg",
|
|
14425
|
+
{
|
|
14426
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14427
|
+
width: "18",
|
|
14428
|
+
height: "18",
|
|
14429
|
+
viewBox: "0 0 18 18"
|
|
14430
|
+
},
|
|
14431
|
+
/* @__PURE__ */ React__default.createElement("path", { d: "M6.605 9.49a.771.771 0 0 1 0-.98l3.6-4.372a.771.771 0 0 1 1.19.981L8.2 9l3.197 3.881a.771.771 0 1 1-1.191.98l-3.6-4.37Z" })
|
|
14432
|
+
);
|
|
14433
|
+
};
|
|
14434
|
+
const Right = () => {
|
|
14435
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14436
|
+
"svg",
|
|
14437
|
+
{
|
|
14438
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14439
|
+
width: "18",
|
|
14440
|
+
height: "18",
|
|
14441
|
+
viewBox: "0 0 18 18"
|
|
14442
|
+
},
|
|
14443
|
+
/* @__PURE__ */ React__default.createElement("path", { d: "M11.396 9.49a.771.771 0 0 0 0-.98l-3.6-4.372a.771.771 0 0 0-1.191.981L9.8 9l-3.196 3.881a.771.771 0 0 0 1.19.98l3.6-4.37Z" })
|
|
14444
|
+
);
|
|
14445
|
+
};
|
|
14446
|
+
const DoubleLeft = () => {
|
|
14447
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14448
|
+
"svg",
|
|
14449
|
+
{
|
|
14450
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14451
|
+
width: "18",
|
|
14452
|
+
height: "18",
|
|
14453
|
+
viewBox: "0 0 18 18"
|
|
14454
|
+
},
|
|
14455
|
+
/* @__PURE__ */ React__default.createElement("path", { d: "M13.853 4.026a.771.771 0 0 1 .12 1.085L10.864 9l3.11 3.889a.771.771 0 1 1-1.204.963L9.272 9.482a.771.771 0 0 1 0-.964l3.497-4.371a.771.771 0 0 1 1.084-.12Zm-5.245 0a.771.771 0 0 1 .12 1.085L5.617 9l3.111 3.889a.771.771 0 0 1-1.205.963L4.026 9.482a.771.771 0 0 1 0-.964l3.497-4.371a.771.771 0 0 1 1.085-.12Z" })
|
|
14456
|
+
);
|
|
14457
|
+
};
|
|
14458
|
+
const DoubleRight = () => {
|
|
14459
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14460
|
+
"svg",
|
|
14461
|
+
{
|
|
14462
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14463
|
+
width: "18",
|
|
14464
|
+
height: "18",
|
|
14465
|
+
viewBox: "0 0 18 18"
|
|
14466
|
+
},
|
|
14467
|
+
/* @__PURE__ */ React__default.createElement("path", { d: "M4.147 13.974a.771.771 0 0 1-.12-1.085L7.136 9 4.028 5.11a.771.771 0 1 1 1.204-.963l3.497 4.371a.771.771 0 0 1 0 .964l-3.497 4.371a.771.771 0 0 1-1.084.12Zm5.245 0a.771.771 0 0 1-.12-1.085L12.383 9 9.272 5.11a.771.771 0 1 1 1.205-.963l3.497 4.371a.771.771 0 0 1 0 .964l-3.497 4.371a.771.771 0 0 1-1.085.12Z" })
|
|
14468
|
+
);
|
|
14469
|
+
};
|
|
14470
|
+
const convertDateToDay = (date4) => {
|
|
14471
|
+
return date4 ? {
|
|
14472
|
+
year: date4.getFullYear(),
|
|
14473
|
+
month: date4.getMonth() + 1,
|
|
14474
|
+
date: date4.getDate()
|
|
14475
|
+
} : null;
|
|
14476
|
+
};
|
|
14477
|
+
const convertDayToDate = (day) => {
|
|
14478
|
+
return day ? new Date(day.year, day.month - 1, day.date) : null;
|
|
14479
|
+
};
|
|
14480
|
+
const getPrevMonthDays = (year, month, firstDayOfWeek) => {
|
|
14481
|
+
let prevMonth = month - 1;
|
|
14482
|
+
let prevYear = year;
|
|
14483
|
+
if (prevMonth <= 0) {
|
|
14484
|
+
prevMonth = 12;
|
|
14485
|
+
prevYear -= 1;
|
|
14486
|
+
}
|
|
14487
|
+
let days = Utils.getMonthPreDay(year, month);
|
|
14488
|
+
days -= firstDayOfWeek;
|
|
14489
|
+
if (days >= 7) {
|
|
14490
|
+
days -= 7;
|
|
14491
|
+
}
|
|
14492
|
+
const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
|
|
14493
|
+
const months = Array.from(Array(preDates), (_, k2) => {
|
|
14494
|
+
return {
|
|
14495
|
+
type: "prev",
|
|
14496
|
+
year: prevYear,
|
|
14497
|
+
month: prevMonth,
|
|
14498
|
+
date: k2 + 1
|
|
14499
|
+
};
|
|
14500
|
+
});
|
|
14501
|
+
return months.slice(preDates - days);
|
|
14502
|
+
};
|
|
14503
|
+
const getCurrentMonthDays = (year, month) => {
|
|
14504
|
+
const days = Utils.getMonthDays(`${year}`, `${month}`);
|
|
14505
|
+
return Array.from(Array(days), (_, k2) => {
|
|
14506
|
+
return {
|
|
14507
|
+
type: "current",
|
|
14508
|
+
year,
|
|
14509
|
+
month,
|
|
14510
|
+
date: k2 + 1
|
|
14511
|
+
};
|
|
14512
|
+
});
|
|
14513
|
+
};
|
|
14514
|
+
const getCurrentWeekDays = (day, firstDayOfWeek) => {
|
|
14515
|
+
const current = new Date(day.year, day.month - 1, day.date);
|
|
14516
|
+
const count = (current.getDay() + 7 - firstDayOfWeek) % 7;
|
|
14517
|
+
return [
|
|
14518
|
+
convertDateToDay(
|
|
14519
|
+
new Date(current.getTime() - 24 * 60 * 60 * 1e3 * count)
|
|
14520
|
+
),
|
|
14521
|
+
convertDateToDay(
|
|
14522
|
+
new Date(current.getTime() + 24 * 60 * 60 * 1e3 * (6 - count))
|
|
14523
|
+
)
|
|
14524
|
+
];
|
|
14525
|
+
};
|
|
14526
|
+
const defaultProps$$ = {
|
|
14527
|
+
...ComponentDefaults,
|
|
14528
|
+
type: "single",
|
|
14529
|
+
firstDayOfWeek: 0
|
|
14530
|
+
};
|
|
14531
|
+
const CalendarCard = React__default.forwardRef((props, ref) => {
|
|
14532
|
+
const { locale } = useConfig();
|
|
14533
|
+
const {
|
|
14534
|
+
style,
|
|
14535
|
+
type: type4,
|
|
14536
|
+
value,
|
|
14537
|
+
defaultValue,
|
|
14538
|
+
firstDayOfWeek,
|
|
14539
|
+
startDate,
|
|
14540
|
+
endDate,
|
|
14541
|
+
disableDay,
|
|
14542
|
+
renderDay,
|
|
14543
|
+
renderDayTop,
|
|
14544
|
+
renderDayBottom,
|
|
14545
|
+
onDayClick,
|
|
14546
|
+
onPageChange,
|
|
14547
|
+
onChange
|
|
14548
|
+
} = { ...defaultProps$$, ...props };
|
|
14549
|
+
const [month, setMonth] = useState(() => {
|
|
14550
|
+
let date4 = new Date(Date.now());
|
|
14551
|
+
const val = value || defaultValue;
|
|
14552
|
+
if (Array.isArray(val)) {
|
|
14553
|
+
if (val.length) {
|
|
14554
|
+
date4 = val[0];
|
|
14555
|
+
}
|
|
14556
|
+
} else if (val) {
|
|
14557
|
+
date4 = val;
|
|
14558
|
+
}
|
|
14559
|
+
return {
|
|
14560
|
+
year: date4.getFullYear(),
|
|
14561
|
+
month: date4.getMonth() + 1
|
|
14562
|
+
};
|
|
14563
|
+
});
|
|
14564
|
+
const [days, setDays] = useState([]);
|
|
14565
|
+
const valueToRange = (val) => {
|
|
14566
|
+
if (Array.isArray(val)) {
|
|
14567
|
+
return val.map((date4) => {
|
|
14568
|
+
return convertDateToDay(date4);
|
|
14569
|
+
});
|
|
14570
|
+
}
|
|
14571
|
+
return val ? [convertDateToDay(val)] : [];
|
|
14572
|
+
};
|
|
14573
|
+
const rangeTovalue = (range3) => {
|
|
14574
|
+
if (Array.isArray(range3)) {
|
|
14575
|
+
return range3.map((day) => {
|
|
14576
|
+
return convertDayToDate(day);
|
|
14577
|
+
});
|
|
14578
|
+
}
|
|
14579
|
+
return range3 ? [convertDayToDate(range3)] : [];
|
|
14580
|
+
};
|
|
14581
|
+
const [innerValue, setInnerValue] = useState(() => {
|
|
14582
|
+
const val = value || defaultValue ? valueToRange(value || defaultValue) : [];
|
|
14583
|
+
return val;
|
|
14584
|
+
});
|
|
14585
|
+
useEffect(() => {
|
|
14586
|
+
const val = value || defaultValue ? valueToRange(value || defaultValue) : [];
|
|
14587
|
+
setInnerValue(val);
|
|
14588
|
+
}, [value]);
|
|
14589
|
+
const change = (v) => {
|
|
14590
|
+
setInnerValue(v);
|
|
14591
|
+
if (type4 === "single") {
|
|
14592
|
+
const date4 = convertDayToDate(v[0]);
|
|
14593
|
+
onChange == null ? void 0 : onChange(date4);
|
|
14594
|
+
} else if (type4 === "multiple" || type4 === "range" || type4 === "week") {
|
|
14595
|
+
const val = rangeTovalue(v);
|
|
14596
|
+
onChange == null ? void 0 : onChange(val);
|
|
14597
|
+
}
|
|
14598
|
+
};
|
|
14599
|
+
const getDays = (month2) => {
|
|
14600
|
+
const y2 = month2.year;
|
|
14601
|
+
const m = month2.month;
|
|
14602
|
+
const days2 = [
|
|
14603
|
+
...getPrevMonthDays(y2, m, firstDayOfWeek),
|
|
14604
|
+
...getCurrentMonthDays(y2, m)
|
|
14605
|
+
];
|
|
14606
|
+
const size = days2.length;
|
|
14607
|
+
const yearOfNextMonth = month2.month === 12 ? month2.year + 1 : month2.year;
|
|
14608
|
+
const monthOfNextMonth = month2.month === 12 ? 1 : month2.month + 1;
|
|
14609
|
+
for (let i = 1; i <= 42 - size; i++) {
|
|
14610
|
+
days2.push({
|
|
14611
|
+
type: "next",
|
|
14612
|
+
year: yearOfNextMonth,
|
|
14613
|
+
month: monthOfNextMonth,
|
|
14614
|
+
date: i
|
|
14615
|
+
});
|
|
14616
|
+
}
|
|
14617
|
+
return days2;
|
|
14618
|
+
};
|
|
14619
|
+
useEffect(() => {
|
|
14620
|
+
const newDays = getDays(month);
|
|
14621
|
+
setDays(newDays);
|
|
14622
|
+
onPageChange == null ? void 0 : onPageChange(month);
|
|
14623
|
+
}, [month]);
|
|
14624
|
+
const isSameDay = (day1, day2) => {
|
|
14625
|
+
return (day1 == null ? void 0 : day1.year) === (day2 == null ? void 0 : day2.year) && (day1 == null ? void 0 : day1.month) === (day2 == null ? void 0 : day2.month) && (day1 == null ? void 0 : day1.date) === (day2 == null ? void 0 : day2.date);
|
|
14626
|
+
};
|
|
14627
|
+
const compareDay = (day1, day2) => {
|
|
14628
|
+
if (day1 && day2) {
|
|
14629
|
+
if (day1.year === day2.year) {
|
|
14630
|
+
if (day1.month === day2.month) {
|
|
14631
|
+
return day1.date - day2.date;
|
|
14632
|
+
}
|
|
14633
|
+
return day1.month - day2.month;
|
|
14634
|
+
}
|
|
14635
|
+
return day1.year - day2.year;
|
|
14636
|
+
}
|
|
14637
|
+
};
|
|
14638
|
+
const isDisable = (day) => {
|
|
14639
|
+
if (disableDay && disableDay(day)) {
|
|
14640
|
+
return true;
|
|
14641
|
+
}
|
|
14642
|
+
if (startDate && Number(compareDay(day, convertDateToDay(startDate))) < 0) {
|
|
14643
|
+
return true;
|
|
14644
|
+
}
|
|
14645
|
+
if (endDate && Number(compareDay(day, convertDateToDay(endDate))) > 0) {
|
|
14646
|
+
return true;
|
|
14647
|
+
}
|
|
14648
|
+
return false;
|
|
14649
|
+
};
|
|
14650
|
+
const isActive = (day) => {
|
|
14651
|
+
if (type4 === "single" || type4 === "multiple") {
|
|
14652
|
+
for (const val of innerValue) {
|
|
14653
|
+
if (isSameDay(day, val)) {
|
|
14654
|
+
return true;
|
|
14655
|
+
}
|
|
14656
|
+
}
|
|
14657
|
+
} else if (type4 === "range" && innerValue.length === 1 && isSameDay(innerValue[0], day)) {
|
|
14658
|
+
return true;
|
|
14659
|
+
}
|
|
14660
|
+
return false;
|
|
14661
|
+
};
|
|
14662
|
+
const isStart2 = (day) => {
|
|
14663
|
+
return (type4 === "range" || type4 === "week") && innerValue.length === 2 && isSameDay(day, innerValue[0]);
|
|
14664
|
+
};
|
|
14665
|
+
const isEnd2 = (day) => {
|
|
14666
|
+
return (type4 === "range" || type4 === "week") && innerValue.length === 2 && isSameDay(day, innerValue[1]);
|
|
14667
|
+
};
|
|
14668
|
+
const isMid = (day) => {
|
|
14669
|
+
if (type4 === "range" || type4 === "week") {
|
|
14670
|
+
if (innerValue.length === 2) {
|
|
14671
|
+
const c12 = compareDay(innerValue[0], day);
|
|
14672
|
+
const c22 = compareDay(day, innerValue[1]);
|
|
14673
|
+
if (c12 && c12 < 0 && c22 && c22 < 0) {
|
|
14674
|
+
return true;
|
|
14675
|
+
}
|
|
14676
|
+
}
|
|
14677
|
+
}
|
|
14678
|
+
return false;
|
|
14679
|
+
};
|
|
14680
|
+
const isWeekend = (day) => {
|
|
14681
|
+
const d = new Date(day.year, day.month - 1, day.date).getDay();
|
|
14682
|
+
return d === 0 || d === 6;
|
|
14683
|
+
};
|
|
14684
|
+
const getClasses = (day) => {
|
|
14685
|
+
if (isDisable(day)) {
|
|
14686
|
+
return ["disabled"];
|
|
14687
|
+
}
|
|
14688
|
+
const res = [];
|
|
14689
|
+
if (day.type === "current") {
|
|
14690
|
+
if (isActive(day)) {
|
|
14691
|
+
res.push("active");
|
|
14692
|
+
}
|
|
14693
|
+
if (isStart2(day)) {
|
|
14694
|
+
res.push("start");
|
|
14695
|
+
}
|
|
14696
|
+
if (isEnd2(day)) {
|
|
14697
|
+
res.push("end");
|
|
14698
|
+
}
|
|
14699
|
+
if (isMid(day)) {
|
|
14700
|
+
res.push("mid");
|
|
14701
|
+
}
|
|
14702
|
+
if (isWeekend(day)) {
|
|
14703
|
+
res.push("weekend");
|
|
14704
|
+
}
|
|
14705
|
+
}
|
|
14706
|
+
return res;
|
|
14707
|
+
};
|
|
14708
|
+
const jumpTo = (year, month2) => {
|
|
14709
|
+
setMonth({ year, month: month2 });
|
|
14710
|
+
};
|
|
14711
|
+
const jump = (step = 1) => {
|
|
14712
|
+
const current = month.year * 12 + month.month;
|
|
14713
|
+
let newMonth = (current + step) % 12;
|
|
14714
|
+
if (newMonth === 0) {
|
|
14715
|
+
newMonth = 12;
|
|
14716
|
+
}
|
|
14717
|
+
const newYear = Math.floor((current + step - newMonth) / 12);
|
|
14718
|
+
setMonth({
|
|
14719
|
+
year: newYear,
|
|
14720
|
+
month: newMonth
|
|
14721
|
+
});
|
|
14722
|
+
};
|
|
14723
|
+
React__default.useImperativeHandle(ref, () => {
|
|
14724
|
+
return {
|
|
14725
|
+
jump,
|
|
14726
|
+
jumpTo
|
|
14727
|
+
};
|
|
14728
|
+
});
|
|
14729
|
+
const handleDayClick = (day) => {
|
|
14730
|
+
if (day.type === "prev" || day.type === "next" || isDisable(day)) {
|
|
14731
|
+
return;
|
|
14732
|
+
}
|
|
14733
|
+
onDayClick == null ? void 0 : onDayClick(day);
|
|
14734
|
+
switch (type4) {
|
|
14735
|
+
case "single": {
|
|
14736
|
+
if (innerValue[0] && isSameDay(innerValue[0], day)) {
|
|
14737
|
+
change([]);
|
|
14738
|
+
} else {
|
|
14739
|
+
change([day]);
|
|
14740
|
+
}
|
|
14741
|
+
break;
|
|
14742
|
+
}
|
|
14743
|
+
case "multiple": {
|
|
14744
|
+
const t = innerValue.find((i) => isSameDay(i, day));
|
|
14745
|
+
if (t) {
|
|
14746
|
+
change(innerValue.filter((i) => i !== t));
|
|
14747
|
+
} else {
|
|
14748
|
+
change([...innerValue, day]);
|
|
14749
|
+
}
|
|
14750
|
+
break;
|
|
14751
|
+
}
|
|
14752
|
+
case "range": {
|
|
14753
|
+
const len = innerValue.length;
|
|
14754
|
+
if (len === 0 || len === 2) {
|
|
14755
|
+
change([day]);
|
|
14756
|
+
} else if (len === 1) {
|
|
14757
|
+
const t = compareDay(innerValue[0], day);
|
|
14758
|
+
if (t === 0 || t === null || t === void 0) {
|
|
14759
|
+
change([]);
|
|
14760
|
+
} else if (t < 0) {
|
|
14761
|
+
change([innerValue[0], day]);
|
|
14762
|
+
} else {
|
|
14763
|
+
change([day, innerValue[0]]);
|
|
14764
|
+
}
|
|
14765
|
+
} else {
|
|
14766
|
+
console.warn("[NutUI] Calendar range error");
|
|
14767
|
+
}
|
|
14768
|
+
break;
|
|
14769
|
+
}
|
|
14770
|
+
case "week": {
|
|
14771
|
+
if (innerValue.length === 2 || innerValue.length === 0) {
|
|
14772
|
+
const [left, right] = getCurrentWeekDays(day, firstDayOfWeek);
|
|
14773
|
+
change([left, right]);
|
|
14774
|
+
} else {
|
|
14775
|
+
console.warn("[NutUI] Calendar week error");
|
|
14776
|
+
}
|
|
14777
|
+
break;
|
|
14778
|
+
}
|
|
14779
|
+
default: {
|
|
14780
|
+
console.warn("[NutUI] Calendar type error");
|
|
14781
|
+
}
|
|
14782
|
+
}
|
|
14783
|
+
};
|
|
14784
|
+
const monthTitle = locale.calendaritem.monthTitle;
|
|
14785
|
+
const renderHeader = () => {
|
|
14786
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-header" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-header-left" }, /* @__PURE__ */ React__default.createElement("div", { className: "double-left", onClick: () => jump(-12) }, /* @__PURE__ */ React__default.createElement(DoubleLeft, null)), /* @__PURE__ */ React__default.createElement("div", { className: "left", onClick: () => jump(-1) }, /* @__PURE__ */ React__default.createElement(Left, null))), /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-header-title" }, monthTitle(month.year, month.month)), /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-header-right" }, /* @__PURE__ */ React__default.createElement("div", { className: "right", onClick: () => jump(1) }, /* @__PURE__ */ React__default.createElement(Right, null)), /* @__PURE__ */ React__default.createElement("div", { className: "double-right", onClick: () => jump(12) }, /* @__PURE__ */ React__default.createElement(DoubleRight, null))));
|
|
14787
|
+
};
|
|
14788
|
+
const [weekHeader] = useState(() => {
|
|
14789
|
+
const weekdays = locale.calendaritem.weekdays.map((day, index) => {
|
|
14790
|
+
return {
|
|
14791
|
+
name: day,
|
|
14792
|
+
key: index
|
|
14793
|
+
};
|
|
14794
|
+
});
|
|
14795
|
+
return [
|
|
14796
|
+
...weekdays.slice(firstDayOfWeek, 7),
|
|
14797
|
+
...weekdays.slice(0, firstDayOfWeek)
|
|
14798
|
+
];
|
|
14799
|
+
});
|
|
14800
|
+
const renderContent = () => {
|
|
14801
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-content" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-days" }, weekHeader.map((day) => {
|
|
14802
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14803
|
+
"div",
|
|
14804
|
+
{
|
|
14805
|
+
className: classNames("nut-calendarcard-day", "header", {
|
|
14806
|
+
weekend: day.key === 0 || day.key === 6
|
|
14807
|
+
}),
|
|
14808
|
+
key: day.key
|
|
14809
|
+
},
|
|
14810
|
+
day.name
|
|
14811
|
+
);
|
|
14812
|
+
})), /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-days" }, days.map((day) => /* @__PURE__ */ React__default.createElement(
|
|
14813
|
+
"div",
|
|
14814
|
+
{
|
|
14815
|
+
className: classNames(
|
|
14816
|
+
"nut-calendarcard-day",
|
|
14817
|
+
day.type,
|
|
14818
|
+
getClasses(day)
|
|
14819
|
+
),
|
|
14820
|
+
key: `${day.year}-${day.month}-${day.date}`,
|
|
14821
|
+
onClick: () => handleDayClick(day)
|
|
14822
|
+
},
|
|
14823
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-day-top" }, renderDayTop ? renderDayTop(day) : ""),
|
|
14824
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-day-inner" }, renderDay ? renderDay(day) : day.date),
|
|
14825
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard-day-bottom" }, renderDayBottom ? renderDayBottom(day) : "")
|
|
14826
|
+
))));
|
|
14827
|
+
};
|
|
14828
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendarcard", style }, renderHeader(), renderContent()));
|
|
14829
|
+
});
|
|
14830
|
+
CalendarCard.defaultProps = defaultProps$$;
|
|
14831
|
+
CalendarCard.displayName = "NutCalendarCard";
|
|
14273
14832
|
const CheckboxGroupContext = createContext(null);
|
|
14274
14833
|
const Context$1 = CheckboxGroupContext;
|
|
14275
14834
|
const defaultProps$_ = {
|
|
@@ -14493,71 +15052,6 @@ const Checkbox = (props) => {
|
|
|
14493
15052
|
Checkbox.defaultProps = defaultProps$Z;
|
|
14494
15053
|
Checkbox.displayName = "NutCheckBox";
|
|
14495
15054
|
Checkbox.Group = CheckboxGroup;
|
|
14496
|
-
const MIN_DISTANCE = 10;
|
|
14497
|
-
function getDirection(x2, y2) {
|
|
14498
|
-
if (x2 > y2 && x2 > MIN_DISTANCE) {
|
|
14499
|
-
return "horizontal";
|
|
14500
|
-
}
|
|
14501
|
-
if (y2 > x2 && y2 > MIN_DISTANCE) {
|
|
14502
|
-
return "vertical";
|
|
14503
|
-
}
|
|
14504
|
-
return "";
|
|
14505
|
-
}
|
|
14506
|
-
function useTouch() {
|
|
14507
|
-
const [startX, SetStartX] = useState(0);
|
|
14508
|
-
const [startY, SetStartY] = useState(0);
|
|
14509
|
-
const [moveX, SetMoveX] = useState(0);
|
|
14510
|
-
const [moveY, SetMoveY] = useState(0);
|
|
14511
|
-
const [deltaX, SetDeltaX] = useState(0);
|
|
14512
|
-
const [deltaY, SetDeltaY] = useState(0);
|
|
14513
|
-
const [offsetX, SetOffsetX] = useState(0);
|
|
14514
|
-
const [offsetY, SetOffsetY] = useState(0);
|
|
14515
|
-
const [direction, SetDirection] = useState("");
|
|
14516
|
-
const isVertical = () => direction === "vertical";
|
|
14517
|
-
const isHorizontal = () => direction === "horizontal";
|
|
14518
|
-
const reset = () => {
|
|
14519
|
-
SetDeltaX(0);
|
|
14520
|
-
SetDeltaY(0);
|
|
14521
|
-
SetOffsetX(0);
|
|
14522
|
-
SetOffsetY(0);
|
|
14523
|
-
SetDirection("");
|
|
14524
|
-
};
|
|
14525
|
-
const start2 = (event) => {
|
|
14526
|
-
reset();
|
|
14527
|
-
SetStartX(event.touches[0].clientX);
|
|
14528
|
-
SetStartY(event.touches[0].clientY);
|
|
14529
|
-
};
|
|
14530
|
-
const move = (event) => {
|
|
14531
|
-
const touch = event.touches[0];
|
|
14532
|
-
const dX = touch.clientX - startX;
|
|
14533
|
-
const dY = touch.clientY - startY;
|
|
14534
|
-
SetDeltaX(dX);
|
|
14535
|
-
SetDeltaY(dY);
|
|
14536
|
-
SetMoveX(touch.clientX);
|
|
14537
|
-
SetMoveY(touch.clientY);
|
|
14538
|
-
SetOffsetX(Math.abs(dX));
|
|
14539
|
-
SetOffsetY(Math.abs(dY));
|
|
14540
|
-
if (!direction) {
|
|
14541
|
-
SetDirection(getDirection(offsetX, offsetY));
|
|
14542
|
-
}
|
|
14543
|
-
};
|
|
14544
|
-
return {
|
|
14545
|
-
move,
|
|
14546
|
-
start: start2,
|
|
14547
|
-
reset,
|
|
14548
|
-
startX,
|
|
14549
|
-
startY,
|
|
14550
|
-
moveX,
|
|
14551
|
-
moveY,
|
|
14552
|
-
deltaX,
|
|
14553
|
-
deltaY,
|
|
14554
|
-
offsetX,
|
|
14555
|
-
offsetY,
|
|
14556
|
-
direction,
|
|
14557
|
-
isVertical,
|
|
14558
|
-
isHorizontal
|
|
14559
|
-
};
|
|
14560
|
-
}
|
|
14561
15055
|
const InternalPickerPanel = (props, ref) => {
|
|
14562
15056
|
const {
|
|
14563
15057
|
keyIndex = 0,
|
|
@@ -14629,7 +15123,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
14629
15123
|
};
|
|
14630
15124
|
const touchStart = (event) => {
|
|
14631
15125
|
touch.start(event);
|
|
14632
|
-
setStartY(touch.deltaY);
|
|
15126
|
+
setStartY(touch.deltaY.current);
|
|
14633
15127
|
setStartTime(Date.now());
|
|
14634
15128
|
transformY.current = scrollDistance;
|
|
14635
15129
|
};
|
|
@@ -14639,13 +15133,13 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
14639
15133
|
moving.current = true;
|
|
14640
15134
|
preventDefault2(event, true);
|
|
14641
15135
|
}
|
|
14642
|
-
const move = touch.deltaY - startY;
|
|
15136
|
+
const move = touch.deltaY.current - startY;
|
|
14643
15137
|
setMove(move);
|
|
14644
15138
|
};
|
|
14645
15139
|
const touchEnd = (event) => {
|
|
14646
15140
|
if (!moving.current)
|
|
14647
15141
|
return;
|
|
14648
|
-
const move = touch.deltaY - startY;
|
|
15142
|
+
const move = touch.deltaY.current - startY;
|
|
14649
15143
|
const moveTime = Date.now() - startTime;
|
|
14650
15144
|
if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
|
|
14651
15145
|
const distance = momentum(move, moveTime);
|
|
@@ -14723,6 +15217,19 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
14723
15217
|
stopMomentum,
|
|
14724
15218
|
moving: moving.current
|
|
14725
15219
|
}));
|
|
15220
|
+
useEffect(() => {
|
|
15221
|
+
var _a2, _b, _c;
|
|
15222
|
+
const options22 = passiveSupported ? { passive: false } : false;
|
|
15223
|
+
(_a2 = PickerPanelRef.current) == null ? void 0 : _a2.addEventListener("touchstart", touchStart, options22);
|
|
15224
|
+
(_b = PickerPanelRef.current) == null ? void 0 : _b.addEventListener("touchmove", touchMove, options22);
|
|
15225
|
+
(_c = PickerPanelRef.current) == null ? void 0 : _c.addEventListener("touchend", touchEnd, options22);
|
|
15226
|
+
return () => {
|
|
15227
|
+
var _a3, _b2, _c2;
|
|
15228
|
+
(_a3 = PickerPanelRef.current) == null ? void 0 : _a3.removeEventListener("touchstart", touchStart);
|
|
15229
|
+
(_b2 = PickerPanelRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", touchMove);
|
|
15230
|
+
(_c2 = PickerPanelRef.current) == null ? void 0 : _c2.removeEventListener("touchend", touchEnd);
|
|
15231
|
+
};
|
|
15232
|
+
});
|
|
14726
15233
|
return /* @__PURE__ */ React__default.createElement(
|
|
14727
15234
|
"div",
|
|
14728
15235
|
{
|
|
@@ -14800,6 +15307,7 @@ const InternalPicker = (props, ref) => {
|
|
|
14800
15307
|
visible,
|
|
14801
15308
|
title,
|
|
14802
15309
|
options: options2 = [],
|
|
15310
|
+
popupProps = {},
|
|
14803
15311
|
defaultValue = [],
|
|
14804
15312
|
className,
|
|
14805
15313
|
style,
|
|
@@ -14971,7 +15479,7 @@ const InternalPicker = (props, ref) => {
|
|
|
14971
15479
|
if (moving) {
|
|
14972
15480
|
isConfirmEvent.current = true;
|
|
14973
15481
|
} else {
|
|
14974
|
-
setSelectedValue(innerValue);
|
|
15482
|
+
setSelectedValue(innerValue, true);
|
|
14975
15483
|
closePicker();
|
|
14976
15484
|
}
|
|
14977
15485
|
setTimeout(() => {
|
|
@@ -15009,6 +15517,7 @@ const InternalPicker = (props, ref) => {
|
|
|
15009
15517
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React__default.createElement(
|
|
15010
15518
|
Popup,
|
|
15011
15519
|
{
|
|
15520
|
+
...popupProps,
|
|
15012
15521
|
visible: innerVisible,
|
|
15013
15522
|
position: "bottom",
|
|
15014
15523
|
afterClose: () => {
|
|
@@ -15056,6 +15565,7 @@ const DatePicker = (props) => {
|
|
|
15056
15565
|
visible,
|
|
15057
15566
|
title,
|
|
15058
15567
|
defaultValue,
|
|
15568
|
+
pickerProps = {},
|
|
15059
15569
|
formatter,
|
|
15060
15570
|
onClose,
|
|
15061
15571
|
onConfirm,
|
|
@@ -15328,6 +15838,7 @@ const DatePicker = (props) => {
|
|
|
15328
15838
|
return /* @__PURE__ */ React__default.createElement("div", { className: `nut-datepicker ${className}`, style, ...rest }, options2.length && /* @__PURE__ */ React__default.createElement(
|
|
15329
15839
|
Picker$1,
|
|
15330
15840
|
{
|
|
15841
|
+
...pickerProps,
|
|
15331
15842
|
title,
|
|
15332
15843
|
visible,
|
|
15333
15844
|
options: options2,
|
|
@@ -16932,7 +17443,7 @@ const Input = forwardRef(
|
|
|
16932
17443
|
}
|
|
16933
17444
|
setValue(val);
|
|
16934
17445
|
const eventHandler = props[trigger];
|
|
16935
|
-
if (eventHandler && typeof eventHandler === "function") {
|
|
17446
|
+
if (eventHandler && typeof eventHandler === "function" && trigger !== "onChange") {
|
|
16936
17447
|
eventHandler(val);
|
|
16937
17448
|
}
|
|
16938
17449
|
};
|
|
@@ -18225,11 +18736,11 @@ const Range = (props) => {
|
|
|
18225
18736
|
touch.move(event);
|
|
18226
18737
|
setDragStatus("draging");
|
|
18227
18738
|
const rect = getRect(root2.current);
|
|
18228
|
-
let delta = touch.deltaX;
|
|
18739
|
+
let delta = touch.deltaX.current;
|
|
18229
18740
|
let total = rect.width;
|
|
18230
18741
|
let diff = delta / total * scope();
|
|
18231
18742
|
if (vertical) {
|
|
18232
|
-
delta = touch.deltaY;
|
|
18743
|
+
delta = touch.deltaY.current;
|
|
18233
18744
|
total = rect.height;
|
|
18234
18745
|
diff = delta / total * scope();
|
|
18235
18746
|
}
|
|
@@ -20357,7 +20868,7 @@ const defaultProps$y = {
|
|
|
20357
20868
|
content: "",
|
|
20358
20869
|
closeable: false,
|
|
20359
20870
|
wrap: false,
|
|
20360
|
-
leftIcon:
|
|
20871
|
+
leftIcon: /* @__PURE__ */ React__default.createElement(k$1, { width: 16, height: 16 }),
|
|
20361
20872
|
rightIcon: null,
|
|
20362
20873
|
delay: 1,
|
|
20363
20874
|
scrollable: null,
|
|
@@ -20622,6 +21133,9 @@ const NoticeBar = (props) => {
|
|
|
20622
21133
|
};
|
|
20623
21134
|
const getStyle = (moveOffset = offset) => {
|
|
20624
21135
|
const target = innerRef.current;
|
|
21136
|
+
if (!target) {
|
|
21137
|
+
return;
|
|
21138
|
+
}
|
|
20625
21139
|
let _offset = 0;
|
|
20626
21140
|
const val = rect.height - height;
|
|
20627
21141
|
_offset = moveOffset + Number(active === childCount - 1 && val / 2);
|
|
@@ -20679,7 +21193,7 @@ const NoticeBar = (props) => {
|
|
|
20679
21193
|
stopAutoPlay();
|
|
20680
21194
|
};
|
|
20681
21195
|
}, []);
|
|
20682
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React__default.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick2 }, /* @__PURE__ */ React__default.createElement("div", { className: "left-icon" }, leftIcon
|
|
21196
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React__default.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick2 }, leftIcon ? /* @__PURE__ */ React__default.createElement("div", { className: "left-icon" }, leftIcon) : null, /* @__PURE__ */ React__default.createElement("div", { ref: wrapRef, className: "wrap" }, /* @__PURE__ */ React__default.createElement(
|
|
20683
21197
|
"div",
|
|
20684
21198
|
{
|
|
20685
21199
|
ref: contentRef,
|
|
@@ -21181,19 +21695,6 @@ function rubberbandIfOutOfBounds(position, min, max, dimension, constant = 0.15)
|
|
|
21181
21695
|
return position;
|
|
21182
21696
|
}
|
|
21183
21697
|
const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
|
21184
|
-
let passiveSupported = false;
|
|
21185
|
-
if (canUseDom) {
|
|
21186
|
-
try {
|
|
21187
|
-
const opts = Object.defineProperty({}, "passive", {
|
|
21188
|
-
get() {
|
|
21189
|
-
passiveSupported = true;
|
|
21190
|
-
}
|
|
21191
|
-
});
|
|
21192
|
-
window.addEventListener("test-passive-supported", null, opts);
|
|
21193
|
-
} catch (e) {
|
|
21194
|
-
console.log(e);
|
|
21195
|
-
}
|
|
21196
|
-
}
|
|
21197
21698
|
const defaultProps$w = {
|
|
21198
21699
|
...ComponentDefaults,
|
|
21199
21700
|
pullingText: "",
|
|
@@ -21590,27 +22091,29 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
21590
22091
|
const leftWidth = actionWidth.left;
|
|
21591
22092
|
const rightWidth = actionWidth.right;
|
|
21592
22093
|
const onTouchStart = (event) => {
|
|
22094
|
+
var _a2;
|
|
21593
22095
|
if (!props.disabled) {
|
|
21594
22096
|
startOffset.current = state.offset;
|
|
21595
22097
|
touch.start(event);
|
|
21596
|
-
props.onTouchStart
|
|
22098
|
+
(_a2 = props.onTouchStart) == null ? void 0 : _a2.call(props, event);
|
|
21597
22099
|
}
|
|
21598
22100
|
};
|
|
21599
22101
|
const onTouchMove = (event) => {
|
|
22102
|
+
var _a2;
|
|
21600
22103
|
if (props.disabled) {
|
|
21601
22104
|
return;
|
|
21602
22105
|
}
|
|
21603
22106
|
touch.move(event);
|
|
21604
|
-
props.onTouchMove
|
|
22107
|
+
(_a2 = props.onTouchMove) == null ? void 0 : _a2.call(props, event);
|
|
21605
22108
|
if (touch.isHorizontal()) {
|
|
21606
22109
|
lockClick.current = true;
|
|
21607
22110
|
const newState = { ...state, dragging: true };
|
|
21608
|
-
const isEdge = !opened || touch.deltaX * startOffset.current < 0;
|
|
22111
|
+
const isEdge = !opened || touch.deltaX.current * startOffset.current < 0;
|
|
21609
22112
|
if (isEdge) {
|
|
21610
22113
|
preventDefault(event, true);
|
|
21611
22114
|
}
|
|
21612
22115
|
newState.offset = rangeCalculation(
|
|
21613
|
-
touch.deltaX + startOffset.current,
|
|
22116
|
+
touch.deltaX.current + startOffset.current,
|
|
21614
22117
|
-rightWidth,
|
|
21615
22118
|
leftWidth
|
|
21616
22119
|
);
|
|
@@ -21618,13 +22121,14 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
21618
22121
|
}
|
|
21619
22122
|
};
|
|
21620
22123
|
const onTouchEnd = (event) => {
|
|
22124
|
+
var _a2;
|
|
21621
22125
|
if (state.dragging) {
|
|
21622
22126
|
setState((v) => ({ ...v, dragging: false }));
|
|
21623
22127
|
toggle(state.offset > 0 ? "left" : "right");
|
|
21624
22128
|
setTimeout(() => {
|
|
21625
22129
|
lockClick.current = false;
|
|
21626
22130
|
}, 0);
|
|
21627
|
-
props.onTouchEnd
|
|
22131
|
+
(_a2 = props.onTouchEnd) == null ? void 0 : _a2.call(props, event);
|
|
21628
22132
|
}
|
|
21629
22133
|
};
|
|
21630
22134
|
const toggle = (side) => {
|
|
@@ -25345,6 +25849,7 @@ export {
|
|
|
25345
25849
|
Barrage,
|
|
25346
25850
|
Button,
|
|
25347
25851
|
Calendar,
|
|
25852
|
+
CalendarCard,
|
|
25348
25853
|
CalendarItem,
|
|
25349
25854
|
Card,
|
|
25350
25855
|
Cascader,
|