@nutui/nutui-react 2.3.1 → 2.3.2
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 +12 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/FixedNav.js +1 -1
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/NumberKeyboard/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/ShortPassword/style/style.css +1 -1
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/Swiper.js +120 -167
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/types/src/packages/address/address.d.ts +1 -1
- package/dist/esm/types/src/packages/address/address.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/address/existRender.d.ts +1 -1
- package/dist/esm/types/src/packages/address/existRender.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/animate/animate.d.ts +1 -1
- package/dist/esm/types/src/packages/animate/animate.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/animate/index.d.ts +1 -1
- package/dist/esm/types/src/packages/animate/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/calendar/calendar.d.ts +1 -1
- package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/calendar/utils.d.ts +1 -1
- package/dist/esm/types/src/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +1 -1
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/fixednav/fixednav.d.ts +2 -6
- package/dist/esm/types/src/packages/fixednav/fixednav.taro.d.ts +2 -6
- package/dist/esm/types/src/packages/fixednav/index.d.ts +2 -1
- package/dist/esm/types/src/packages/fixednav/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/fixednav/types.d.ts +12 -0
- package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +1 -1
- package/dist/esm/types/src/packages/radiogroup/radiogroup.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/virtuallist/utils.d.ts +1 -1
- package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +1 -1
- package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +1 -1
- package/dist/esm/types/src/utils/use-touch.d.ts +2 -0
- package/dist/esm/use-touch.js +7 -0
- 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 +132 -173
- package/dist/nutui.react.umd.js +132 -173
- package/dist/packages/cascader/cascader.scss +1 -6
- package/dist/packages/popup/popup.scss +2 -2
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/address/address.d.ts +1 -1
- package/dist/types/packages/address/address.taro.d.ts +1 -1
- package/dist/types/packages/address/existRender.d.ts +1 -1
- package/dist/types/packages/address/existRender.taro.d.ts +1 -1
- package/dist/types/packages/animate/animate.d.ts +1 -1
- package/dist/types/packages/animate/animate.taro.d.ts +1 -1
- package/dist/types/packages/animate/index.d.ts +1 -1
- package/dist/types/packages/animate/index.taro.d.ts +1 -1
- package/dist/types/packages/calendar/calendar.d.ts +1 -1
- package/dist/types/packages/calendar/calendar.taro.d.ts +1 -1
- package/dist/types/packages/calendar/utils.d.ts +1 -1
- package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -1
- package/dist/types/packages/checkboxgroup/checkboxgroup.d.ts +1 -1
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +1 -1
- package/dist/types/packages/fixednav/fixednav.d.ts +2 -6
- package/dist/types/packages/fixednav/fixednav.taro.d.ts +2 -6
- package/dist/types/packages/fixednav/index.d.ts +2 -1
- package/dist/types/packages/fixednav/index.taro.d.ts +2 -1
- package/dist/types/packages/fixednav/types.d.ts +12 -0
- package/dist/types/packages/radiogroup/radiogroup.d.ts +1 -1
- package/dist/types/packages/radiogroup/radiogroup.taro.d.ts +1 -1
- package/dist/types/packages/virtuallist/utils.d.ts +1 -1
- package/dist/types/packages/virtuallist/virtuallist.d.ts +1 -1
- package/dist/types/packages/virtuallist/virtuallist.taro.d.ts +1 -1
- package/dist/types/utils/use-touch.d.ts +2 -0
- package/package.json +1 -1
- /package/dist/esm/types/src/packages/address/{type.d.ts → types.d.ts} +0 -0
- /package/dist/esm/types/src/packages/animate/{type.d.ts → types.d.ts} +0 -0
- /package/dist/esm/types/src/packages/calendar/{type.d.ts → types.d.ts} +0 -0
- /package/dist/esm/types/src/packages/checkboxgroup/{type.d.ts → types.d.ts} +0 -0
- /package/dist/esm/types/src/packages/radiogroup/{type.d.ts → types.d.ts} +0 -0
- /package/dist/esm/types/src/packages/virtuallist/{type.d.ts → types.d.ts} +0 -0
- /package/dist/types/packages/address/{type.d.ts → types.d.ts} +0 -0
- /package/dist/types/packages/animate/{type.d.ts → types.d.ts} +0 -0
- /package/dist/types/packages/calendar/{type.d.ts → types.d.ts} +0 -0
- /package/dist/types/packages/checkboxgroup/{type.d.ts → types.d.ts} +0 -0
- /package/dist/types/packages/radiogroup/{type.d.ts → types.d.ts} +0 -0
- /package/dist/types/packages/virtuallist/{type.d.ts → types.d.ts} +0 -0
package/dist/nutui.react.umd.js
CHANGED
|
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
/*!
|
|
11
|
-
* @nutui/nutui-react v2.3.
|
|
11
|
+
* @nutui/nutui-react v2.3.2 Fri Dec 15 2023 18:53:20 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -4360,12 +4360,15 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4360
4360
|
const startY = React.useRef(0);
|
|
4361
4361
|
const deltaX = React.useRef(0);
|
|
4362
4362
|
const deltaY = React.useRef(0);
|
|
4363
|
+
const delta = React.useRef(0);
|
|
4363
4364
|
const offsetX = React.useRef(0);
|
|
4364
4365
|
const offsetY = React.useRef(0);
|
|
4365
4366
|
const direction = React.useRef("");
|
|
4367
|
+
const touchTime = React.useRef(null);
|
|
4366
4368
|
const isVertical = () => direction.current === "vertical";
|
|
4367
4369
|
const isHorizontal = () => direction.current === "horizontal";
|
|
4368
4370
|
const reset = () => {
|
|
4371
|
+
touchTime.current = null;
|
|
4369
4372
|
deltaX.current = 0;
|
|
4370
4373
|
deltaY.current = 0;
|
|
4371
4374
|
offsetX.current = 0;
|
|
@@ -4374,6 +4377,7 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4374
4377
|
};
|
|
4375
4378
|
const start2 = (event) => {
|
|
4376
4379
|
reset();
|
|
4380
|
+
touchTime.current = Date.now();
|
|
4377
4381
|
startX.current = event.touches[0].clientX;
|
|
4378
4382
|
startY.current = event.touches[0].clientY;
|
|
4379
4383
|
};
|
|
@@ -4383,6 +4387,7 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4383
4387
|
deltaY.current = touch.clientY - startY.current;
|
|
4384
4388
|
offsetX.current = Math.abs(deltaX.current);
|
|
4385
4389
|
offsetY.current = Math.abs(deltaY.current);
|
|
4390
|
+
delta.current = isVertical() ? deltaY.current : deltaX.current;
|
|
4386
4391
|
if (!direction.current) {
|
|
4387
4392
|
direction.current = getDirection(offsetX.current, offsetY.current);
|
|
4388
4393
|
}
|
|
@@ -4391,10 +4396,12 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4391
4396
|
move,
|
|
4392
4397
|
start: start2,
|
|
4393
4398
|
reset,
|
|
4399
|
+
touchTime,
|
|
4394
4400
|
startX,
|
|
4395
4401
|
startY,
|
|
4396
4402
|
deltaX,
|
|
4397
4403
|
deltaY,
|
|
4404
|
+
delta,
|
|
4398
4405
|
offsetX,
|
|
4399
4406
|
offsetY,
|
|
4400
4407
|
direction,
|
|
@@ -10613,7 +10620,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
10613
10620
|
onClick: (event) => handleClick2(item, event),
|
|
10614
10621
|
key: item.id || index
|
|
10615
10622
|
},
|
|
10616
|
-
/* @__PURE__ */ React.createElement("img", { src: item.icon, alt: "" }),
|
|
10623
|
+
React.isValidElement(item.icon) ? item.icon : /* @__PURE__ */ React.createElement("img", { src: item.icon, alt: "" }),
|
|
10617
10624
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-list-text` }, item.text),
|
|
10618
10625
|
item.num && /* @__PURE__ */ React.createElement("div", { className: "b" }, item.num)
|
|
10619
10626
|
);
|
|
@@ -22580,9 +22587,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22580
22587
|
center: false,
|
|
22581
22588
|
className: ""
|
|
22582
22589
|
};
|
|
22583
|
-
const DISTANCE = 5;
|
|
22584
22590
|
const Swiper = React.forwardRef((props, ref) => {
|
|
22585
|
-
const
|
|
22591
|
+
const mergedProps = { ...defaultProps$h, ...props };
|
|
22586
22592
|
const {
|
|
22587
22593
|
children,
|
|
22588
22594
|
direction,
|
|
@@ -22596,7 +22602,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22596
22602
|
autoPlay,
|
|
22597
22603
|
center,
|
|
22598
22604
|
...rest
|
|
22599
|
-
} =
|
|
22605
|
+
} = mergedProps;
|
|
22600
22606
|
const container = React.useRef(null);
|
|
22601
22607
|
const innerRef = React.useRef(null);
|
|
22602
22608
|
const swiperRef = React.useRef({
|
|
@@ -22607,6 +22613,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22607
22613
|
offset: 0,
|
|
22608
22614
|
size: 0
|
|
22609
22615
|
});
|
|
22616
|
+
const touch = useTouch();
|
|
22610
22617
|
const isVertical = direction === "vertical";
|
|
22611
22618
|
const [rect, setRect] = React.useState(null);
|
|
22612
22619
|
let [active, setActive] = React.useState(0);
|
|
@@ -22616,39 +22623,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22616
22623
|
const [childOffset, setChildOffset] = React.useState([]);
|
|
22617
22624
|
const [ready, setReady] = React.useState(false);
|
|
22618
22625
|
let size = isVertical ? height : width;
|
|
22619
|
-
const
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
deltaX: 0,
|
|
22623
|
-
deltaY: 0,
|
|
22624
|
-
offsetX: 0,
|
|
22625
|
-
offsetY: 0,
|
|
22626
|
-
stateDirection: "",
|
|
22627
|
-
delta: 0,
|
|
22628
|
-
touchTime: 0
|
|
22629
|
-
});
|
|
22630
|
-
const { childs, childCount } = React.useMemo(() => {
|
|
22631
|
-
let childCount2 = 0;
|
|
22632
|
-
const childs2 = React.Children.map(props.children, (child) => {
|
|
22626
|
+
const { swiperItems, swiperItemCount } = React.useMemo(() => {
|
|
22627
|
+
let count = 0;
|
|
22628
|
+
const swiperItems2 = React.Children.map(props.children, (child) => {
|
|
22633
22629
|
if (!React.isValidElement(child))
|
|
22634
22630
|
return null;
|
|
22635
|
-
|
|
22631
|
+
count++;
|
|
22636
22632
|
return child;
|
|
22637
22633
|
});
|
|
22638
22634
|
return {
|
|
22639
|
-
|
|
22640
|
-
|
|
22635
|
+
swiperItems: swiperItems2,
|
|
22636
|
+
swiperItemCount: count
|
|
22641
22637
|
};
|
|
22642
22638
|
}, [props.children]);
|
|
22643
|
-
let trackSize =
|
|
22639
|
+
let trackSize = swiperItemCount * Number(size);
|
|
22644
22640
|
const parent = {
|
|
22645
|
-
propSwiper,
|
|
22641
|
+
propSwiper: mergedProps,
|
|
22646
22642
|
size
|
|
22647
22643
|
};
|
|
22648
22644
|
const minOffset = (() => {
|
|
22649
22645
|
if (rect) {
|
|
22650
22646
|
const base = isVertical ? rect.height : rect.width;
|
|
22651
|
-
return base - Number(size) *
|
|
22647
|
+
return base - Number(size) * swiperItemCount;
|
|
22652
22648
|
}
|
|
22653
22649
|
return 0;
|
|
22654
22650
|
})();
|
|
@@ -22657,65 +22653,59 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22657
22653
|
swiperRef.current.autoplayTimer = null;
|
|
22658
22654
|
};
|
|
22659
22655
|
const startPlay = () => {
|
|
22660
|
-
if (
|
|
22656
|
+
if (mergedProps.autoPlay <= 0 || swiperItemCount <= 1)
|
|
22661
22657
|
return;
|
|
22662
22658
|
stopAutoPlay();
|
|
22663
22659
|
swiperRef.current.autoplayTimer = setTimeout(() => {
|
|
22664
22660
|
next();
|
|
22665
22661
|
startPlay();
|
|
22666
|
-
}, Number(
|
|
22662
|
+
}, Number(mergedProps.autoPlay));
|
|
22667
22663
|
};
|
|
22668
22664
|
const resetPosition = () => {
|
|
22669
22665
|
swiperRef.current.moving = true;
|
|
22670
22666
|
if (active <= -1) {
|
|
22671
|
-
move({ pace:
|
|
22667
|
+
move({ pace: swiperItemCount });
|
|
22672
22668
|
}
|
|
22673
|
-
if (active >=
|
|
22674
|
-
move({ pace: -
|
|
22669
|
+
if (active >= swiperItemCount) {
|
|
22670
|
+
move({ pace: -swiperItemCount });
|
|
22675
22671
|
}
|
|
22676
22672
|
};
|
|
22677
22673
|
const prev = () => {
|
|
22678
22674
|
resetPosition();
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
isEmit: true
|
|
22686
|
-
});
|
|
22675
|
+
touch.reset();
|
|
22676
|
+
requestAniFrame$1(() => {
|
|
22677
|
+
swiperRef.current.moving = false;
|
|
22678
|
+
move({
|
|
22679
|
+
pace: -1,
|
|
22680
|
+
isEmit: true
|
|
22687
22681
|
});
|
|
22688
22682
|
});
|
|
22689
22683
|
};
|
|
22690
22684
|
const next = () => {
|
|
22691
22685
|
resetPosition();
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
isEmit: true
|
|
22699
|
-
});
|
|
22686
|
+
touch.reset();
|
|
22687
|
+
requestAniFrame$1(() => {
|
|
22688
|
+
swiperRef.current.moving = false;
|
|
22689
|
+
move({
|
|
22690
|
+
pace: 1,
|
|
22691
|
+
isEmit: true
|
|
22700
22692
|
});
|
|
22701
22693
|
});
|
|
22702
22694
|
};
|
|
22703
22695
|
const to2 = (index) => {
|
|
22704
22696
|
resetPosition();
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
isEmit: true
|
|
22718
|
-
});
|
|
22697
|
+
touch.reset();
|
|
22698
|
+
requestAniFrame$1(() => {
|
|
22699
|
+
swiperRef.current.moving = false;
|
|
22700
|
+
let targetIndex;
|
|
22701
|
+
if (props.loop && swiperItemCount === index) {
|
|
22702
|
+
targetIndex = active === 0 ? 0 : index;
|
|
22703
|
+
} else {
|
|
22704
|
+
targetIndex = index % swiperItemCount;
|
|
22705
|
+
}
|
|
22706
|
+
move({
|
|
22707
|
+
pace: targetIndex - active,
|
|
22708
|
+
isEmit: true
|
|
22719
22709
|
});
|
|
22720
22710
|
});
|
|
22721
22711
|
};
|
|
@@ -22728,7 +22718,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22728
22718
|
isEmit = false,
|
|
22729
22719
|
movingStatus = false
|
|
22730
22720
|
}) => {
|
|
22731
|
-
|
|
22721
|
+
var _a2;
|
|
22722
|
+
if (swiperItemCount <= 1)
|
|
22732
22723
|
return;
|
|
22733
22724
|
const targetActive = getActive(pace);
|
|
22734
22725
|
const targetOffset = getOffset(targetActive, offset2);
|
|
@@ -22737,27 +22728,33 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22737
22728
|
const rightBound = targetOffset < minOffset;
|
|
22738
22729
|
childOffset[0] = rightBound ? trackSize : 0;
|
|
22739
22730
|
}
|
|
22740
|
-
if (Array.isArray(children) && children[
|
|
22731
|
+
if (Array.isArray(children) && children[swiperItemCount - 1] && targetOffset !== 0) {
|
|
22741
22732
|
const leftBound = targetOffset > 0;
|
|
22742
|
-
childOffset[
|
|
22733
|
+
childOffset[swiperItemCount - 1] = leftBound ? -trackSize : 0;
|
|
22743
22734
|
}
|
|
22744
22735
|
setChildOffset(childOffset);
|
|
22745
22736
|
}
|
|
22746
22737
|
if (isEmit && active !== targetActive) {
|
|
22747
|
-
props.onChange
|
|
22738
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, (targetActive + swiperItemCount) % swiperItemCount);
|
|
22748
22739
|
}
|
|
22749
22740
|
active = targetActive;
|
|
22750
22741
|
setActive(targetActive);
|
|
22751
22742
|
setOffset(targetOffset);
|
|
22752
22743
|
getStyle(targetOffset);
|
|
22753
22744
|
};
|
|
22745
|
+
React.useImperativeHandle(ref, () => ({
|
|
22746
|
+
to: to2,
|
|
22747
|
+
next,
|
|
22748
|
+
prev,
|
|
22749
|
+
resize
|
|
22750
|
+
}));
|
|
22754
22751
|
const getActive = (pace) => {
|
|
22755
22752
|
if (pace) {
|
|
22756
22753
|
const _active = active + pace;
|
|
22757
22754
|
if (props.loop) {
|
|
22758
|
-
return range2(_active, -1,
|
|
22755
|
+
return range2(_active, -1, swiperItemCount);
|
|
22759
22756
|
}
|
|
22760
|
-
return range2(_active, 0,
|
|
22757
|
+
return range2(_active, 0, swiperItemCount - 1);
|
|
22761
22758
|
}
|
|
22762
22759
|
return active;
|
|
22763
22760
|
};
|
|
@@ -22772,45 +22769,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22772
22769
|
}
|
|
22773
22770
|
return targetOffset;
|
|
22774
22771
|
};
|
|
22775
|
-
const requestFrame = (fn) => {
|
|
22776
|
-
window.requestAnimationFrame.call(window, fn);
|
|
22777
|
-
};
|
|
22778
22772
|
const range2 = (num, min, max) => {
|
|
22779
22773
|
return Math.min(Math.max(num, min), max);
|
|
22780
22774
|
};
|
|
22781
|
-
const getDirection2 = (x, y) => {
|
|
22782
|
-
if (x > y && x > DISTANCE)
|
|
22783
|
-
return "horizontal";
|
|
22784
|
-
if (y > x && y > DISTANCE)
|
|
22785
|
-
return "vertical";
|
|
22786
|
-
return "";
|
|
22787
|
-
};
|
|
22788
|
-
const resetTouchDetails = () => {
|
|
22789
|
-
touch.startX = 0;
|
|
22790
|
-
touch.startY = 0;
|
|
22791
|
-
touch.deltaX = 0;
|
|
22792
|
-
touch.deltaY = 0;
|
|
22793
|
-
touch.offsetX = 0;
|
|
22794
|
-
touch.offsetY = 0;
|
|
22795
|
-
touch.delta = 0;
|
|
22796
|
-
touch.stateDirection = "";
|
|
22797
|
-
touch.touchTime = 0;
|
|
22798
|
-
};
|
|
22799
|
-
const touchStart = (e2) => {
|
|
22800
|
-
resetTouchDetails();
|
|
22801
|
-
touch.startX = e2.touches[0].clientX;
|
|
22802
|
-
touch.startY = e2.touches[0].clientY;
|
|
22803
|
-
};
|
|
22804
|
-
const handleTouchMove = (e2) => {
|
|
22805
|
-
touch.deltaX = e2.touches[0].clientX - touch.startX;
|
|
22806
|
-
touch.deltaY = e2.touches[0].clientY - touch.startY;
|
|
22807
|
-
touch.offsetX = Math.abs(touch.deltaX);
|
|
22808
|
-
touch.offsetY = Math.abs(touch.deltaY);
|
|
22809
|
-
touch.delta = isVertical ? touch.deltaY : touch.deltaX;
|
|
22810
|
-
if (!touch.stateDirection) {
|
|
22811
|
-
touch.stateDirection = getDirection2(touch.offsetX, touch.offsetY);
|
|
22812
|
-
}
|
|
22813
|
-
};
|
|
22814
22775
|
const classPrefix2 = "nut-swiper";
|
|
22815
22776
|
const contentClass = classNames({
|
|
22816
22777
|
[`${classPrefix2}-inner`]: true,
|
|
@@ -22824,18 +22785,17 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22824
22785
|
} else {
|
|
22825
22786
|
const _size = isVertical ? height : width;
|
|
22826
22787
|
const val = isVertical ? rect.height - _size : rect.width - _size;
|
|
22827
|
-
_offset = moveOffset + (active ===
|
|
22788
|
+
_offset = moveOffset + (active === swiperItemCount - 1 && !props.loop ? -val / 2 : val / 2);
|
|
22828
22789
|
}
|
|
22829
22790
|
target.style.transitionDuration = `${swiperRef.current.moving ? 0 : props.duration}ms`;
|
|
22830
|
-
target.style[isVertical ? "height" : "width"] = `${Number(size) *
|
|
22791
|
+
target.style[isVertical ? "height" : "width"] = `${Number(size) * swiperItemCount}px`;
|
|
22831
22792
|
target.style[isVertical ? "width" : "height"] = `${isVertical ? width : height}px`;
|
|
22832
22793
|
target.style.transform = `translate3D${!isVertical ? `(${_offset}px,0,0)` : `(0,${_offset}px,0)`}`;
|
|
22833
22794
|
};
|
|
22834
22795
|
const onTouchStart = (e2) => {
|
|
22835
22796
|
if (!props.touchable)
|
|
22836
22797
|
return;
|
|
22837
|
-
|
|
22838
|
-
touch.touchTime = Date.now();
|
|
22798
|
+
touch.start(e2);
|
|
22839
22799
|
stopAutoPlay();
|
|
22840
22800
|
resetPosition();
|
|
22841
22801
|
};
|
|
@@ -22845,10 +22805,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22845
22805
|
if (props.stopPropagation)
|
|
22846
22806
|
e2.stopPropagation();
|
|
22847
22807
|
if (props.touchable && swiperRef.current.moving) {
|
|
22848
|
-
|
|
22849
|
-
if (touch.
|
|
22808
|
+
touch.move(e2);
|
|
22809
|
+
if (touch.direction.current === props.direction) {
|
|
22850
22810
|
move({
|
|
22851
|
-
offset: touch.delta
|
|
22811
|
+
offset: touch.delta.current
|
|
22852
22812
|
});
|
|
22853
22813
|
}
|
|
22854
22814
|
}
|
|
@@ -22856,42 +22816,53 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22856
22816
|
const onTouchEnd = (e2) => {
|
|
22857
22817
|
if (!props.touchable || !swiperRef.current.moving)
|
|
22858
22818
|
return;
|
|
22859
|
-
const speed = touch.delta / (Date.now() - touch.touchTime);
|
|
22860
|
-
const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > Number((size / 2).toFixed(2));
|
|
22861
|
-
let pace = 0;
|
|
22819
|
+
const speed = touch.delta.current / (Date.now() - touch.touchTime.current);
|
|
22820
|
+
const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta.current) > Number((size / 2).toFixed(2));
|
|
22862
22821
|
swiperRef.current.moving = false;
|
|
22863
|
-
if (isShouldMove && touch.
|
|
22864
|
-
|
|
22822
|
+
if (isShouldMove && touch.direction.current === props.direction) {
|
|
22823
|
+
let pace = 0;
|
|
22824
|
+
const offset2 = touch.isVertical() ? touch.offsetY : touch.offsetX;
|
|
22865
22825
|
if (props.loop) {
|
|
22866
|
-
if (offset2 > 0) {
|
|
22867
|
-
pace = touch.delta > 0 ? -1 : 1;
|
|
22868
|
-
} else {
|
|
22869
|
-
pace = 0;
|
|
22826
|
+
if (offset2.current > 0) {
|
|
22827
|
+
pace = touch.delta.current > 0 ? -1 : 1;
|
|
22870
22828
|
}
|
|
22871
22829
|
} else {
|
|
22872
|
-
pace = -Math[touch.delta > 0 ? "ceil" : "floor"](
|
|
22830
|
+
pace = -Math[touch.delta.current > 0 ? "ceil" : "floor"](
|
|
22831
|
+
touch.delta.current / size
|
|
22832
|
+
);
|
|
22873
22833
|
}
|
|
22874
22834
|
move({
|
|
22875
22835
|
pace,
|
|
22876
22836
|
isEmit: true
|
|
22877
22837
|
});
|
|
22878
|
-
} else if (touch.delta) {
|
|
22838
|
+
} else if (touch.delta.current) {
|
|
22879
22839
|
move({ pace: 0 });
|
|
22880
22840
|
} else {
|
|
22881
22841
|
getStyle();
|
|
22882
22842
|
}
|
|
22883
22843
|
startPlay();
|
|
22884
22844
|
};
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22845
|
+
const getItemStyle = (index) => {
|
|
22846
|
+
const style = {};
|
|
22847
|
+
if (size) {
|
|
22848
|
+
style[direction === "horizontal" ? "width" : "height"] = `${size}px`;
|
|
22849
|
+
}
|
|
22850
|
+
const offset2 = childOffset[index];
|
|
22851
|
+
if (offset2) {
|
|
22852
|
+
style.transform = `translate3D${direction === "horizontal" ? `(${offset2}px,0,0)` : `(0,${offset2}px,0)`}`;
|
|
22853
|
+
}
|
|
22854
|
+
return style;
|
|
22855
|
+
};
|
|
22856
|
+
const init = (index) => {
|
|
22889
22857
|
const rect2 = getRect(container == null ? void 0 : container.current);
|
|
22890
|
-
const currentIndex = Math.max(
|
|
22891
|
-
|
|
22892
|
-
|
|
22858
|
+
const currentIndex = Math.max(
|
|
22859
|
+
Math.min(swiperItemCount - 1, index || Number(mergedProps.defaultValue)),
|
|
22860
|
+
0
|
|
22861
|
+
);
|
|
22862
|
+
const width2 = Number(mergedProps.width) || rect2.width;
|
|
22863
|
+
const height2 = Number(mergedProps.height) || rect2.height;
|
|
22893
22864
|
size = isVertical ? height2 : width2;
|
|
22894
|
-
trackSize =
|
|
22865
|
+
trackSize = swiperItemCount * Number(size);
|
|
22895
22866
|
const targetOffset = getOffset(currentIndex);
|
|
22896
22867
|
swiperRef.current.moving = true;
|
|
22897
22868
|
if (ready) {
|
|
@@ -22920,61 +22891,49 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22920
22891
|
stopAutoPlay();
|
|
22921
22892
|
startPlay();
|
|
22922
22893
|
}, [children]);
|
|
22923
|
-
React.useEffect(() => init(), [propSwiper.defaultValue]);
|
|
22924
22894
|
React.useEffect(() => {
|
|
22925
|
-
const
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22895
|
+
const events = [
|
|
22896
|
+
{ name: "touchstart", e: onTouchStart },
|
|
22897
|
+
{ name: "touchmove", e: onTouchMove },
|
|
22898
|
+
{ name: "touchend", e: onTouchEnd }
|
|
22899
|
+
];
|
|
22900
|
+
events.forEach((item) => {
|
|
22901
|
+
var _a2;
|
|
22902
|
+
(_a2 = container.current) == null ? void 0 : _a2.addEventListener(item.name, item.e, false);
|
|
22903
|
+
});
|
|
22929
22904
|
return () => {
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
|
|
22905
|
+
events.forEach((item) => {
|
|
22906
|
+
var _a2;
|
|
22907
|
+
(_a2 = container.current) == null ? void 0 : _a2.removeEventListener(item.name, item.e, false);
|
|
22908
|
+
});
|
|
22933
22909
|
};
|
|
22934
22910
|
});
|
|
22911
|
+
React.useEffect(() => init(), [props.defaultValue]);
|
|
22935
22912
|
React.useEffect(() => {
|
|
22936
22913
|
return () => stopAutoPlay();
|
|
22937
22914
|
}, []);
|
|
22938
|
-
const getItemStyle = (index) => {
|
|
22939
|
-
const style = {};
|
|
22940
|
-
if (size) {
|
|
22941
|
-
style[direction === "horizontal" ? "width" : "height"] = `${size}px`;
|
|
22942
|
-
}
|
|
22943
|
-
const offset2 = childOffset[index];
|
|
22944
|
-
if (offset2) {
|
|
22945
|
-
style.transform = `translate3D${direction === "horizontal" ? `(${offset2}px,0,0)` : `(0,${offset2}px,0)`}`;
|
|
22946
|
-
}
|
|
22947
|
-
return style;
|
|
22948
|
-
};
|
|
22949
|
-
React.useImperativeHandle(ref, () => ({
|
|
22950
|
-
to: to2,
|
|
22951
|
-
next,
|
|
22952
|
-
prev,
|
|
22953
|
-
resize
|
|
22954
|
-
}));
|
|
22955
22915
|
const renderIndicator = () => {
|
|
22956
22916
|
if (React.isValidElement(indicator))
|
|
22957
22917
|
return indicator;
|
|
22958
|
-
if (indicator
|
|
22959
|
-
return
|
|
22960
|
-
|
|
22918
|
+
if (!indicator)
|
|
22919
|
+
return null;
|
|
22920
|
+
return /* @__PURE__ */ React.createElement(
|
|
22921
|
+
"div",
|
|
22922
|
+
{
|
|
22923
|
+
className: classNames({
|
|
22924
|
+
[`${classPrefix2}-indicator`]: true,
|
|
22925
|
+
[`${classPrefix2}-indicator-vertical`]: isVertical
|
|
22926
|
+
})
|
|
22927
|
+
},
|
|
22928
|
+
/* @__PURE__ */ React.createElement(
|
|
22929
|
+
Indicator,
|
|
22961
22930
|
{
|
|
22962
|
-
|
|
22963
|
-
|
|
22964
|
-
|
|
22965
|
-
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
Indicator,
|
|
22969
|
-
{
|
|
22970
|
-
current: (active + childCount) % childCount,
|
|
22971
|
-
total: childs == null ? void 0 : childs.length,
|
|
22972
|
-
direction
|
|
22973
|
-
}
|
|
22974
|
-
)
|
|
22975
|
-
);
|
|
22976
|
-
}
|
|
22977
|
-
return null;
|
|
22931
|
+
current: (active + swiperItemCount) % swiperItemCount,
|
|
22932
|
+
total: swiperItems == null ? void 0 : swiperItems.length,
|
|
22933
|
+
direction
|
|
22934
|
+
}
|
|
22935
|
+
)
|
|
22936
|
+
);
|
|
22978
22937
|
};
|
|
22979
22938
|
return /* @__PURE__ */ React.createElement(DataContext$1.Provider, { value: parent }, /* @__PURE__ */ React.createElement(
|
|
22980
22939
|
"div",
|
|
@@ -22983,7 +22942,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22983
22942
|
ref: container,
|
|
22984
22943
|
...rest
|
|
22985
22944
|
},
|
|
22986
|
-
/* @__PURE__ */ React.createElement("div", { className: contentClass, ref: innerRef }, React.Children.map(
|
|
22945
|
+
/* @__PURE__ */ React.createElement("div", { className: contentClass, ref: innerRef }, React.Children.map(swiperItems, (child, index) => /* @__PURE__ */ React.createElement(
|
|
22987
22946
|
"div",
|
|
22988
22947
|
{
|
|
22989
22948
|
className: `${classPrefix2}-item-wrapper`,
|
|
@@ -16,11 +16,6 @@
|
|
|
16
16
|
white-space: nowrap;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.nut-tabs-content {
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
max-height: 372px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
19
|
.nut-tabpane {
|
|
25
20
|
padding: 0;
|
|
26
21
|
background: $color-background-overlay;
|
|
@@ -39,7 +34,7 @@
|
|
|
39
34
|
display: flex;
|
|
40
35
|
align-items: center;
|
|
41
36
|
justify-content: center;
|
|
42
|
-
height: $cascader-item-height;
|
|
37
|
+
// height: $cascader-item-height;
|
|
43
38
|
padding: $cascader-item-padding;
|
|
44
39
|
margin: $cascader-item-margin;
|
|
45
40
|
border-bottom: $cascader-item-border-bottom;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
.nut-popup {
|
|
3
3
|
position: fixed;
|
|
4
|
-
min-height:
|
|
4
|
+
min-height: 26%;
|
|
5
5
|
max-height: 100%;
|
|
6
6
|
overflow-y: auto;
|
|
7
7
|
background-color: $overlay-content-bg-color;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: center;
|
|
16
|
-
height: $popup-title-height;
|
|
16
|
+
// height: $popup-title-height;
|
|
17
17
|
border-bottom: $popup-title-border-bottom;
|
|
18
18
|
padding: $popup-title-padding;
|
|
19
19
|
position: relative;
|