@nutui/nutui-react-taro 1.4.7 → 1.4.8
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 +44 -0
- package/dist/esm/Badge.js +2 -2
- package/dist/esm/Barrage.js +2 -2
- package/dist/esm/Calendar.js +3 -4
- package/dist/esm/CalendarItem.js +2 -3
- package/dist/esm/Cascader.js +4 -4
- package/dist/esm/Checkbox.js +2 -2
- package/dist/esm/CheckboxGroup.js +2 -2
- package/dist/esm/Col.js +3 -2
- package/dist/esm/Dialog.js +3 -2
- package/dist/esm/Ellipsis.js +2 -2
- package/dist/esm/InputNumber.js +2 -2
- package/dist/esm/Popover.js +2 -2
- package/dist/esm/Row.js +3 -2
- package/dist/esm/ShortPassword.js +2 -2
- package/dist/esm/Swipe.js +3 -2
- package/dist/esm/TabPane.js +2 -2
- package/dist/esm/Tabbar.js +2 -2
- package/dist/esm/Tabs.js +2 -2
- package/dist/esm/TextArea.js +2 -2
- package/dist/esm/Uploader.js +2 -2
- package/dist/esm/{badge.taro-11e2ec95.js → badge.taro-116b2521.js} +1 -0
- package/dist/esm/barrage.taro-5dbab093.js +94 -0
- package/dist/esm/calendar.taro-c95e6998.js +61 -0
- package/dist/esm/calendaritem.taro-86412398.js +761 -0
- package/dist/esm/{cascader.taro-e6610dd1.js → cascader.taro-e0fb7e63.js} +16 -22
- package/dist/esm/{checkbox.taro-04da7151.js → checkbox.taro-b76b1c82.js} +9 -6
- package/dist/esm/{col.taro-b61c7cba.js → col.taro-9e4c5cc0.js} +2 -1
- package/dist/esm/{dialog.taro-54df2e3f.js → dialog.taro-7608bd26.js} +7 -12
- package/dist/esm/{ellipsis.taro-aa39faf7.js → ellipsis.taro-5aa23940.js} +4 -3
- package/dist/esm/{inputnumber.taro-e909d932.js → inputnumber.taro-94c75663.js} +11 -21
- package/dist/esm/nutui-react.es.js +19 -19
- package/dist/esm/{popover.taro-fc7b9a73.js → popover.taro-f144cd02.js} +9 -7
- package/dist/esm/{row.taro-37a895de.js → row.taro-4e697aa2.js} +2 -1
- package/dist/esm/{shortpassword.taro-02ea4499.js → shortpassword.taro-53b7ee7b.js} +3 -2
- package/dist/esm/{swipe.taro-1eb95b21.js → swipe.taro-6532405d.js} +16 -24
- package/dist/esm/{tabbar.taro-08e48c43.js → tabbar.taro-17d898d9.js} +12 -7
- package/dist/esm/{tabpane.taro-91cd6cf4.js → tabpane.taro-9512e308.js} +3 -3
- package/dist/esm/{tabs.taro-5030ce68.js → tabs.taro-4629d66c.js} +5 -2
- package/dist/esm/{textarea.taro-42600f8c.js → textarea.taro-47addd05.js} +5 -1
- package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +22 -2
- package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +21 -3
- package/dist/esm/types/src/packages/cascader/cascader.d.ts +1 -0
- package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/cascader/cascaderItem.d.ts +1 -0
- package/dist/esm/types/src/packages/cascader/cascaderItem.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/checkbox/demo.d.ts +0 -1
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +5 -0
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.taro.d.ts +5 -0
- package/dist/esm/types/src/packages/dialog/DialogWrap.d.ts +1 -1
- package/dist/esm/types/src/packages/dialog/DialogWrapper.taro.d.ts +11 -0
- package/dist/esm/types/src/packages/dialog/dialog.taro.d.ts +3 -2
- package/dist/esm/types/src/packages/dialog/index.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/form/form.d.ts +3 -0
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +2 -1
- package/dist/esm/types/src/packages/formitem/types.d.ts +1 -1
- package/dist/esm/types/src/packages/popover/popover.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +1 -0
- package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/switch/switch.d.ts +2 -1
- package/dist/esm/types/src/packages/tabbar/tabbar.d.ts +1 -1
- package/dist/esm/types/src/packages/tabbar/tabbar.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/tabbar/use-props-value.d.ts +7 -0
- package/dist/esm/types/src/packages/tabpane/tabpane.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/tabs/tabs.d.ts +1 -0
- package/dist/esm/types/src/packages/tabs/tabs.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +1 -0
- package/dist/esm/{uploader.taro-b7b770e6.js → uploader.taro-c830b573.js} +3 -2
- 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/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 +690 -412
- package/dist/nutui.react.umd.js +689 -411
- package/dist/packages/badge/badge.scss +11 -5
- package/dist/packages/barrage/barrage.scss +3 -3
- package/dist/packages/button/button.scss +1 -0
- package/dist/packages/cascader/cascader.scss +19 -5
- package/dist/packages/checkboxgroup/checkboxgroup.scss +33 -0
- package/dist/packages/collapseitem/collapseitem.scss +41 -17
- package/dist/packages/form/form.scss +3 -0
- package/dist/packages/inputnumber/inputnumber.scss +18 -1
- package/dist/packages/popover/popover.scss +71 -46
- package/dist/packages/radiogroup/radiogroup.scss +9 -8
- package/dist/packages/step/step.scss +135 -98
- package/dist/packages/switch/switch.scss +1 -1
- package/dist/packages/tabs/tabs.scss +24 -2
- package/dist/packages/textarea/textarea.scss +7 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/variables.scss +155 -33
- package/dist/types/index.d.ts +57 -33
- package/package.json +1 -1
- package/dist/esm/barrage.taro-e4fe81ae.js +0 -73
- package/dist/esm/calendar.taro-02479e8b.js +0 -38
- package/dist/esm/calendaritem.taro-3cfd4186.js +0 -571
package/dist/nutui.react.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v1.4.
|
|
2
|
+
* @nutui/nutui-react-taro v1.4.8 Wed Feb 22 2023 17:16:25 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import React__default, { useCallback, useState, useEffect, createContext, useContext, useMemo, useRef, forwardRef, useImperativeHandle, useLayoutEffect, Component, memo } from "react";
|
|
8
|
-
import Taro, { redirectTo, navigateTo, getEnv, usePageScroll, getSystemInfoSync, nextTick, createSelectorQuery, uploadFile, chooseImage, pageScrollTo,
|
|
8
|
+
import Taro, { redirectTo, navigateTo, getEnv, usePageScroll, getSystemInfoSync, nextTick, createSelectorQuery, uploadFile, chooseImage, pageScrollTo, useReady, createInnerAudioContext, getSystemInfo, createOffscreenCanvas, canvasToTempFilePath } from "@tarojs/taro";
|
|
9
9
|
import ReactDOM, { createPortal, unstable_batchedUpdates } from "react-dom";
|
|
10
10
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
11
11
|
function getAugmentedNamespace(n) {
|
|
@@ -1745,7 +1745,7 @@ const Col = (props) => {
|
|
|
1745
1745
|
setColStyle(getStyle);
|
|
1746
1746
|
}, [span, offset, gutter]);
|
|
1747
1747
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
1748
|
-
className:
|
|
1748
|
+
className: classNames(colName, className),
|
|
1749
1749
|
style: { ...style, ...colStyle },
|
|
1750
1750
|
onClick: (e2) => {
|
|
1751
1751
|
onClick && onClick(e2, "col");
|
|
@@ -2040,7 +2040,7 @@ const Row = (props) => {
|
|
|
2040
2040
|
}, React__default.createElement(
|
|
2041
2041
|
"div",
|
|
2042
2042
|
{
|
|
2043
|
-
className:
|
|
2043
|
+
className: classNames(getClasses(), className),
|
|
2044
2044
|
style,
|
|
2045
2045
|
onClick: (e2) => {
|
|
2046
2046
|
onClick && onClick(e2, "row");
|
|
@@ -3245,15 +3245,14 @@ const defaultProps$18 = {
|
|
|
3245
3245
|
safeAreaInsetBottom: false,
|
|
3246
3246
|
className: "",
|
|
3247
3247
|
style: {},
|
|
3248
|
-
|
|
3249
|
-
},
|
|
3250
|
-
onSwitch: () => {
|
|
3248
|
+
onSwitch: (child, activeVisible) => {
|
|
3251
3249
|
}
|
|
3252
3250
|
};
|
|
3253
3251
|
const Tabbar = (props) => {
|
|
3254
3252
|
const {
|
|
3255
3253
|
children,
|
|
3256
3254
|
visible,
|
|
3255
|
+
activeVisible,
|
|
3257
3256
|
bottom,
|
|
3258
3257
|
size,
|
|
3259
3258
|
activeColor,
|
|
@@ -3261,17 +3260,23 @@ const Tabbar = (props) => {
|
|
|
3261
3260
|
safeAreaInsetBottom,
|
|
3262
3261
|
className,
|
|
3263
3262
|
style,
|
|
3264
|
-
tabSwitch,
|
|
3265
3263
|
onSwitch
|
|
3266
3264
|
} = {
|
|
3267
3265
|
...defaultProps$18,
|
|
3268
3266
|
...props
|
|
3269
3267
|
};
|
|
3270
3268
|
const b2 = cn("tabbar");
|
|
3271
|
-
const [selectIndex, setSelectIndex] = useState(visible);
|
|
3269
|
+
const [selectIndex, setSelectIndex] = useState(activeVisible || visible);
|
|
3272
3270
|
const handleClick = (idx) => {
|
|
3273
|
-
|
|
3271
|
+
if (!("activeVisible" in props)) {
|
|
3272
|
+
setSelectIndex(idx);
|
|
3273
|
+
}
|
|
3274
3274
|
};
|
|
3275
|
+
useEffect(() => {
|
|
3276
|
+
if (activeVisible !== void 0) {
|
|
3277
|
+
setSelectIndex(activeVisible);
|
|
3278
|
+
}
|
|
3279
|
+
}, [activeVisible]);
|
|
3275
3280
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
3276
3281
|
className: [
|
|
3277
3282
|
`${b2()}`,
|
|
@@ -3293,7 +3298,6 @@ const Tabbar = (props) => {
|
|
|
3293
3298
|
size,
|
|
3294
3299
|
handleClick: () => {
|
|
3295
3300
|
handleClick(idx);
|
|
3296
|
-
tabSwitch(child, idx);
|
|
3297
3301
|
onSwitch(child, idx);
|
|
3298
3302
|
}
|
|
3299
3303
|
};
|
|
@@ -3391,14 +3395,21 @@ const defaultProps$16 = {
|
|
|
3391
3395
|
disabled: false
|
|
3392
3396
|
};
|
|
3393
3397
|
const TabPane = (props) => {
|
|
3394
|
-
const {
|
|
3398
|
+
const {
|
|
3399
|
+
children,
|
|
3400
|
+
paneKey,
|
|
3401
|
+
activeKey,
|
|
3402
|
+
autoHeightClassName,
|
|
3403
|
+
className,
|
|
3404
|
+
disabled
|
|
3405
|
+
} = {
|
|
3395
3406
|
...defaultProps$16,
|
|
3396
3407
|
...props
|
|
3397
3408
|
};
|
|
3398
3409
|
const b2 = cn("tabpane");
|
|
3399
3410
|
const classes = classNames(
|
|
3400
3411
|
{
|
|
3401
|
-
active: paneKey === activeKey
|
|
3412
|
+
active: !disabled && paneKey === activeKey
|
|
3402
3413
|
},
|
|
3403
3414
|
b2(""),
|
|
3404
3415
|
autoHeightClassName,
|
|
@@ -3406,7 +3417,7 @@ const TabPane = (props) => {
|
|
|
3406
3417
|
);
|
|
3407
3418
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
3408
3419
|
className: classes
|
|
3409
|
-
}, children);
|
|
3420
|
+
}, !disabled && children);
|
|
3410
3421
|
};
|
|
3411
3422
|
class Title {
|
|
3412
3423
|
constructor() {
|
|
@@ -3429,6 +3440,7 @@ const defaultProps$15 = {
|
|
|
3429
3440
|
animatedTime: 300,
|
|
3430
3441
|
titleGutter: 0,
|
|
3431
3442
|
size: "normal",
|
|
3443
|
+
leftAlign: false,
|
|
3432
3444
|
autoHeight: false
|
|
3433
3445
|
};
|
|
3434
3446
|
const pxCheck$2 = (value) => {
|
|
@@ -3447,6 +3459,7 @@ const Tabs = (props) => {
|
|
|
3447
3459
|
animatedTime,
|
|
3448
3460
|
titleGutter,
|
|
3449
3461
|
size,
|
|
3462
|
+
leftAlign,
|
|
3450
3463
|
titleNode,
|
|
3451
3464
|
children,
|
|
3452
3465
|
onClick,
|
|
@@ -3527,8 +3540,9 @@ const Tabs = (props) => {
|
|
|
3527
3540
|
onClick: (e2) => tabChange(item),
|
|
3528
3541
|
className: classNames(
|
|
3529
3542
|
{
|
|
3530
|
-
active: String(item.paneKey) === String(value),
|
|
3531
|
-
disabled: item.disabled
|
|
3543
|
+
active: !item.disabled && String(item.paneKey) === String(value),
|
|
3544
|
+
disabled: item.disabled,
|
|
3545
|
+
"nut-tabs__titles-item-left-align": leftAlign
|
|
3532
3546
|
},
|
|
3533
3547
|
`${b2("")}__titles-item`
|
|
3534
3548
|
),
|
|
@@ -3678,14 +3692,25 @@ const defaultProps$14 = {
|
|
|
3678
3692
|
defaultValue: "",
|
|
3679
3693
|
startDate: Utils.getDay(0),
|
|
3680
3694
|
endDate: Utils.getDay(365),
|
|
3695
|
+
showToday: true,
|
|
3696
|
+
startText: "\u5F00\u59CB",
|
|
3697
|
+
endText: "\u7ED3\u675F",
|
|
3698
|
+
confirmText: "\u786E\u8BA4",
|
|
3699
|
+
showTitle: true,
|
|
3700
|
+
showSubTitle: true,
|
|
3701
|
+
toDateAnimation: true,
|
|
3702
|
+
onBtn: void 0,
|
|
3703
|
+
onDay: void 0,
|
|
3704
|
+
onTopInfo: void 0,
|
|
3705
|
+
onBottomInfo: void 0,
|
|
3681
3706
|
onChoose: (data) => {
|
|
3682
3707
|
},
|
|
3683
3708
|
onUpdate: () => {
|
|
3684
3709
|
},
|
|
3685
|
-
|
|
3710
|
+
onSelected: (data) => {
|
|
3686
3711
|
}
|
|
3687
3712
|
};
|
|
3688
|
-
const CalendarItem = (props) => {
|
|
3713
|
+
const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
3689
3714
|
const { locale } = useConfig$1();
|
|
3690
3715
|
const {
|
|
3691
3716
|
type,
|
|
@@ -3693,18 +3718,31 @@ const CalendarItem = (props) => {
|
|
|
3693
3718
|
poppable,
|
|
3694
3719
|
title,
|
|
3695
3720
|
defaultValue,
|
|
3696
|
-
|
|
3697
|
-
|
|
3721
|
+
showToday,
|
|
3722
|
+
startText,
|
|
3723
|
+
endText,
|
|
3724
|
+
confirmText,
|
|
3725
|
+
showTitle,
|
|
3726
|
+
showSubTitle,
|
|
3727
|
+
toDateAnimation,
|
|
3728
|
+
onBtn,
|
|
3729
|
+
onDay,
|
|
3730
|
+
onTopInfo,
|
|
3731
|
+
onBottomInfo,
|
|
3698
3732
|
onChoose,
|
|
3699
3733
|
onUpdate,
|
|
3700
|
-
|
|
3734
|
+
onSelected
|
|
3701
3735
|
} = { ...defaultProps$14, ...props };
|
|
3702
3736
|
const weeks = locale.calendaritem.weekdays;
|
|
3703
3737
|
const [yearMonthTitle, setYearMonthTitle] = useState("");
|
|
3704
|
-
const [unLoadPrev, setUnLoadPrev] = useState(false);
|
|
3705
3738
|
const [monthsData, setMonthsData] = useState([]);
|
|
3739
|
+
const [translateY, setTranslateY] = useState(0);
|
|
3740
|
+
const [monthDefaultRange, setMonthDefaultRange] = useState([]);
|
|
3706
3741
|
const [state] = useState({
|
|
3707
3742
|
currDate: "",
|
|
3743
|
+
propStartDate: "",
|
|
3744
|
+
propEndDate: "",
|
|
3745
|
+
unLoadPrev: false,
|
|
3708
3746
|
touchParams: {
|
|
3709
3747
|
startY: 0,
|
|
3710
3748
|
endY: 0,
|
|
@@ -3714,7 +3752,6 @@ const CalendarItem = (props) => {
|
|
|
3714
3752
|
lastTime: 0
|
|
3715
3753
|
},
|
|
3716
3754
|
transformY: 0,
|
|
3717
|
-
translateY: 0,
|
|
3718
3755
|
scrollDistance: 0,
|
|
3719
3756
|
defaultData: [],
|
|
3720
3757
|
chooseData: [],
|
|
@@ -3722,12 +3759,17 @@ const CalendarItem = (props) => {
|
|
|
3722
3759
|
dayPrefix: "calendar-month-day",
|
|
3723
3760
|
startData: "",
|
|
3724
3761
|
endData: "",
|
|
3725
|
-
isRange: type === "range",
|
|
3726
|
-
timer: 0
|
|
3762
|
+
isRange: props.type === "range",
|
|
3763
|
+
timer: 0,
|
|
3764
|
+
currentIndex: 0,
|
|
3765
|
+
avgHeight: 0,
|
|
3766
|
+
monthsNum: 0
|
|
3727
3767
|
});
|
|
3728
3768
|
const weeksPanel = useRef(null);
|
|
3729
3769
|
const months = useRef(null);
|
|
3730
3770
|
const monthsPanel = useRef(null);
|
|
3771
|
+
const viewArea = useRef(null);
|
|
3772
|
+
let viewHeight = 0;
|
|
3731
3773
|
const b2 = cn("calendar");
|
|
3732
3774
|
const classes = classNames(
|
|
3733
3775
|
{
|
|
@@ -3753,23 +3795,29 @@ const CalendarItem = (props) => {
|
|
|
3753
3795
|
const isEnd = (currDate) => {
|
|
3754
3796
|
return Utils.isEqual(state.currDate[1], currDate);
|
|
3755
3797
|
};
|
|
3756
|
-
const
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3798
|
+
const isMultiple = (currDate) => {
|
|
3799
|
+
if (state.currDate.length > 0) {
|
|
3800
|
+
return state.currDate.some((item) => {
|
|
3801
|
+
return Utils.isEqual(item, currDate);
|
|
3802
|
+
});
|
|
3803
|
+
}
|
|
3804
|
+
return false;
|
|
3805
|
+
};
|
|
3806
|
+
const getCurrDate = (day, month) => {
|
|
3807
|
+
return `${month.curData[0]}-${month.curData[1]}-${Utils.getNumTwoBit(
|
|
3760
3808
|
+day.day
|
|
3761
3809
|
)}`;
|
|
3762
3810
|
};
|
|
3763
|
-
const getClass = (day, month
|
|
3764
|
-
const currDate = getCurrDate(day, month
|
|
3811
|
+
const getClass = (day, month) => {
|
|
3812
|
+
const currDate = getCurrDate(day, month);
|
|
3765
3813
|
if (day.type === "curr") {
|
|
3766
|
-
if (
|
|
3814
|
+
if (Utils.isEqual(state.currDate, currDate) || type === "range" && (isStart(currDate) || isEnd(currDate)) || type === "multiple" && isMultiple(currDate)) {
|
|
3767
3815
|
return `${state.dayPrefix}-active`;
|
|
3768
3816
|
}
|
|
3769
|
-
if (
|
|
3817
|
+
if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
3770
3818
|
return `${state.dayPrefix}-disabled`;
|
|
3771
3819
|
}
|
|
3772
|
-
if (
|
|
3820
|
+
if (type === "range" && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
|
|
3773
3821
|
return `${state.dayPrefix}-choose`;
|
|
3774
3822
|
}
|
|
3775
3823
|
return null;
|
|
@@ -3784,25 +3832,46 @@ const CalendarItem = (props) => {
|
|
|
3784
3832
|
return Utils.isEqual(date, Utils.date2Str(new Date()));
|
|
3785
3833
|
};
|
|
3786
3834
|
const confirm = () => {
|
|
3787
|
-
|
|
3788
|
-
|
|
3835
|
+
const { type: type2 } = props;
|
|
3836
|
+
if (type2 === "range" && state.chooseData.length === 2 || type2 !== "range") {
|
|
3837
|
+
const chooseData = state.chooseData.slice(0);
|
|
3838
|
+
onChoose && onChoose(chooseData);
|
|
3789
3839
|
if (poppable) {
|
|
3790
3840
|
onUpdate && onUpdate();
|
|
3791
3841
|
}
|
|
3792
3842
|
}
|
|
3793
3843
|
};
|
|
3794
|
-
const chooseDay = (day, month, isFirst
|
|
3795
|
-
if (getClass(day, month
|
|
3796
|
-
|
|
3797
|
-
days =
|
|
3844
|
+
const chooseDay = (day, month, isFirst) => {
|
|
3845
|
+
if (getClass(day, month) !== `${state.dayPrefix}-disabled`) {
|
|
3846
|
+
const { type: type2 } = props;
|
|
3847
|
+
const days = [...month.curData];
|
|
3798
3848
|
days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
3799
3849
|
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
3800
3850
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
3801
|
-
if (
|
|
3802
|
-
state.currDate
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3851
|
+
if (type2 === "multiple") {
|
|
3852
|
+
if (state.currDate.length > 0) {
|
|
3853
|
+
let hasIndex = "";
|
|
3854
|
+
state.currDate.forEach((item, index) => {
|
|
3855
|
+
if (item === days[3]) {
|
|
3856
|
+
hasIndex = index;
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
if (isFirst) {
|
|
3860
|
+
state.chooseData.push([...days]);
|
|
3861
|
+
} else if (hasIndex !== "") {
|
|
3862
|
+
state.currDate.splice(hasIndex, 1);
|
|
3863
|
+
state.chooseData.splice(hasIndex, 1);
|
|
3864
|
+
} else {
|
|
3865
|
+
state.currDate.push(days[3]);
|
|
3866
|
+
state.chooseData.push([...days]);
|
|
3867
|
+
}
|
|
3868
|
+
} else {
|
|
3869
|
+
state.currDate = [days[3]];
|
|
3870
|
+
state.chooseData = [[...days]];
|
|
3871
|
+
}
|
|
3872
|
+
} else if (type2 === "range") {
|
|
3873
|
+
const curDataLength = Object.values(state.currDate).length;
|
|
3874
|
+
if (curDataLength === 2 || curDataLength === 0) {
|
|
3806
3875
|
state.currDate = [days[3]];
|
|
3807
3876
|
} else if (Utils.compareDate(state.currDate[0], days[3])) {
|
|
3808
3877
|
Array.isArray(state.currDate) && state.currDate.push(days[3]);
|
|
@@ -3810,30 +3879,39 @@ const CalendarItem = (props) => {
|
|
|
3810
3879
|
Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
|
|
3811
3880
|
}
|
|
3812
3881
|
if (state.chooseData.length === 2 || !state.chooseData.length) {
|
|
3813
|
-
state.chooseData = [...days];
|
|
3814
|
-
} else if (Utils.compareDate(state.chooseData[3], days[3])) {
|
|
3815
|
-
state.chooseData = [
|
|
3882
|
+
state.chooseData = [[...days]];
|
|
3883
|
+
} else if (Utils.compareDate(state.chooseData[0][3], days[3])) {
|
|
3884
|
+
state.chooseData = [...state.chooseData, [...days]];
|
|
3816
3885
|
} else {
|
|
3817
|
-
state.chooseData = [[...days],
|
|
3886
|
+
state.chooseData = [[...days], ...state.chooseData];
|
|
3818
3887
|
}
|
|
3888
|
+
} else {
|
|
3889
|
+
state.currDate = days[3];
|
|
3890
|
+
state.chooseData = [...days];
|
|
3819
3891
|
}
|
|
3820
|
-
if (
|
|
3821
|
-
|
|
3892
|
+
if (!isFirst) {
|
|
3893
|
+
onSelected && onSelected(state.chooseData);
|
|
3894
|
+
if (isAutoBackFill || !poppable) {
|
|
3895
|
+
confirm();
|
|
3896
|
+
}
|
|
3822
3897
|
}
|
|
3823
3898
|
setMonthsData(state.monthsData.slice());
|
|
3824
3899
|
}
|
|
3825
3900
|
};
|
|
3826
3901
|
const isStartTip = (day, month) => {
|
|
3827
|
-
|
|
3828
|
-
|
|
3902
|
+
return isActive(day, month) && isStart(getCurrDate(day, month));
|
|
3903
|
+
};
|
|
3904
|
+
const isEndTip = (day, month) => {
|
|
3905
|
+
if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month))) {
|
|
3906
|
+
return isActive(day, month);
|
|
3829
3907
|
}
|
|
3830
3908
|
return false;
|
|
3831
3909
|
};
|
|
3832
|
-
const
|
|
3833
|
-
if (
|
|
3834
|
-
return
|
|
3910
|
+
const rangeTip = () => {
|
|
3911
|
+
if (state.currDate.length >= 2) {
|
|
3912
|
+
return Utils.isEqual(state.currDate[0], state.currDate[1]);
|
|
3835
3913
|
}
|
|
3836
|
-
return
|
|
3914
|
+
return false;
|
|
3837
3915
|
};
|
|
3838
3916
|
const getCurrData = (type2) => {
|
|
3839
3917
|
const monthData = type2 === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
|
|
@@ -3855,20 +3933,45 @@ const CalendarItem = (props) => {
|
|
|
3855
3933
|
Utils.getMonthDays(String(year), String(month))
|
|
3856
3934
|
];
|
|
3857
3935
|
};
|
|
3858
|
-
const getDaysStatus = (days, type2) => {
|
|
3936
|
+
const getDaysStatus = (days, type2, dateInfo) => {
|
|
3937
|
+
const { year, month } = dateInfo;
|
|
3859
3938
|
if (type2 === "prev" && days >= 7) {
|
|
3860
3939
|
days -= 7;
|
|
3861
3940
|
}
|
|
3862
3941
|
return Array.from(Array(days), (v, k) => {
|
|
3863
3942
|
return {
|
|
3864
3943
|
day: k + 1,
|
|
3865
|
-
type: type2
|
|
3944
|
+
type: type2,
|
|
3945
|
+
year,
|
|
3946
|
+
month
|
|
3866
3947
|
};
|
|
3867
3948
|
});
|
|
3868
3949
|
};
|
|
3950
|
+
const getPreDaysStatus = (days, type2, dateInfo, preCurrMonthDays) => {
|
|
3951
|
+
const { year, month } = dateInfo;
|
|
3952
|
+
if (type2 === "prev" && days >= 7) {
|
|
3953
|
+
days -= 7;
|
|
3954
|
+
}
|
|
3955
|
+
const months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
|
|
3956
|
+
return {
|
|
3957
|
+
day: k + 1,
|
|
3958
|
+
type: type2,
|
|
3959
|
+
year,
|
|
3960
|
+
month
|
|
3961
|
+
};
|
|
3962
|
+
});
|
|
3963
|
+
return months2.slice(preCurrMonthDays - days);
|
|
3964
|
+
};
|
|
3869
3965
|
const getMonth = (curData, type2) => {
|
|
3870
3966
|
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
3967
|
+
let preMonth = +curData[1] - 1;
|
|
3968
|
+
let preYear = curData[0];
|
|
3969
|
+
if (preMonth <= 0) {
|
|
3970
|
+
preMonth = 12;
|
|
3971
|
+
preYear += 1;
|
|
3972
|
+
}
|
|
3871
3973
|
const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
|
|
3974
|
+
const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
|
|
3872
3975
|
const title2 = {
|
|
3873
3976
|
year: curData[0],
|
|
3874
3977
|
month: curData[1]
|
|
@@ -3877,10 +3980,21 @@ const CalendarItem = (props) => {
|
|
|
3877
3980
|
curData,
|
|
3878
3981
|
title: locale.calendaritem.monthTitle(title2.year, title2.month),
|
|
3879
3982
|
monthData: [
|
|
3880
|
-
...
|
|
3881
|
-
|
|
3983
|
+
...getPreDaysStatus(
|
|
3984
|
+
preMonthDays,
|
|
3985
|
+
"prev",
|
|
3986
|
+
{ month: preMonth, year: preYear },
|
|
3987
|
+
preCurrMonthDays
|
|
3988
|
+
),
|
|
3989
|
+
...getDaysStatus(currMonthDays, "curr", title2)
|
|
3882
3990
|
]
|
|
3883
3991
|
};
|
|
3992
|
+
monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
|
|
3993
|
+
let cssScrollHeight = 0;
|
|
3994
|
+
if (state.monthsData.length > 0) {
|
|
3995
|
+
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
3996
|
+
}
|
|
3997
|
+
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
3884
3998
|
if (type2 === "next") {
|
|
3885
3999
|
if (!state.endData || !Utils.compareDate(
|
|
3886
4000
|
`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(
|
|
@@ -3896,183 +4010,260 @@ const CalendarItem = (props) => {
|
|
|
3896
4010
|
`${state.startData[0]}-${state.startData[1]}-01`
|
|
3897
4011
|
)) {
|
|
3898
4012
|
state.monthsData.unshift(monthInfo);
|
|
3899
|
-
} else {
|
|
3900
|
-
setUnLoadPrev(true);
|
|
3901
4013
|
}
|
|
3902
4014
|
setMonthsData(state.monthsData);
|
|
3903
4015
|
};
|
|
3904
|
-
const
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
4016
|
+
const setDefaultRange = (monthsNum, current) => {
|
|
4017
|
+
let start2 = 0;
|
|
4018
|
+
let end = 0;
|
|
4019
|
+
if (monthsNum >= 3) {
|
|
4020
|
+
if (current > 0 && current < monthsNum) {
|
|
4021
|
+
start2 = current - 1;
|
|
4022
|
+
end = current + 3;
|
|
4023
|
+
} else if (current === 0) {
|
|
4024
|
+
start2 = current;
|
|
4025
|
+
end = current + 4;
|
|
4026
|
+
} else if (current === monthsNum) {
|
|
4027
|
+
start2 = current - 2;
|
|
4028
|
+
end = current + 2;
|
|
3915
4029
|
}
|
|
3916
|
-
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
if (monthsPanel == null ? void 0 : monthsPanel.current) {
|
|
3920
|
-
if (type2 === "end") {
|
|
3921
|
-
monthsPanel.current.style.webkitTransition = `transform ${time}ms cubic-bezier(0.19, 1, 0.22, 1)`;
|
|
3922
|
-
clearTimeout(state.timer);
|
|
3923
|
-
state.timer = window.setTimeout(() => {
|
|
3924
|
-
loadScroll();
|
|
3925
|
-
}, time);
|
|
3926
|
-
} else {
|
|
3927
|
-
monthsPanel.current.style.webkitTransition = "";
|
|
3928
|
-
loadScroll();
|
|
3929
|
-
}
|
|
3930
|
-
monthsPanel.current.style.webkitTransform = `translateY(${translateY}px)`;
|
|
3931
|
-
state.scrollDistance = translateY;
|
|
4030
|
+
} else {
|
|
4031
|
+
start2 = 0;
|
|
4032
|
+
end = monthsNum + 2;
|
|
3932
4033
|
}
|
|
4034
|
+
setMonthDefaultRange([start2, end]);
|
|
4035
|
+
setTranslateY(state.monthsData[start2].cssScrollHeight);
|
|
3933
4036
|
};
|
|
3934
|
-
const
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
const
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
4037
|
+
const mothsViewScroll = (e2) => {
|
|
4038
|
+
if (state.monthsData.length <= 1) {
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
const target = e2.target;
|
|
4042
|
+
const currentScrollTop = target.scrollTop;
|
|
4043
|
+
let current = Math.floor(currentScrollTop / state.avgHeight);
|
|
4044
|
+
if (current === 0) {
|
|
4045
|
+
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
4046
|
+
current += 1;
|
|
3942
4047
|
}
|
|
3943
|
-
|
|
3944
|
-
|
|
4048
|
+
} else if (current > 0 && current < state.monthsNum - 1) {
|
|
4049
|
+
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
4050
|
+
current += 1;
|
|
3945
4051
|
}
|
|
3946
|
-
if (
|
|
3947
|
-
|
|
4052
|
+
if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
|
|
4053
|
+
current -= 1;
|
|
3948
4054
|
}
|
|
3949
|
-
setTransform(updateMove, type2, time);
|
|
3950
4055
|
} else {
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
if (updateMove < -offsetHeight + h - 100 && state.monthsData.length > 1) {
|
|
3955
|
-
updateMove = -offsetHeight + h - 100;
|
|
4056
|
+
const viewPosition = Math.round(currentScrollTop + viewHeight);
|
|
4057
|
+
if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
|
|
4058
|
+
current -= 1;
|
|
3956
4059
|
}
|
|
3957
|
-
if (
|
|
3958
|
-
|
|
4060
|
+
if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
|
|
4061
|
+
current += 1;
|
|
3959
4062
|
}
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
};
|
|
3963
|
-
const onTouchStart = (event) => {
|
|
3964
|
-
event.stopPropagation();
|
|
3965
|
-
const changedTouches = event.changedTouches[0];
|
|
3966
|
-
state.touchParams.startY = changedTouches.pageY;
|
|
3967
|
-
state.touchParams.startTime = event.timeStamp || Date.now();
|
|
3968
|
-
state.transformY = state.scrollDistance;
|
|
3969
|
-
};
|
|
3970
|
-
const onTouchMove = (event) => {
|
|
3971
|
-
event.stopPropagation();
|
|
3972
|
-
const changedTouches = event.changedTouches[0];
|
|
3973
|
-
state.touchParams.lastY = changedTouches.pageY;
|
|
3974
|
-
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
3975
|
-
const move = state.touchParams.lastY - state.touchParams.startY;
|
|
3976
|
-
if (Math.abs(move) < 5) {
|
|
3977
|
-
return false;
|
|
3978
|
-
}
|
|
3979
|
-
setMove(move);
|
|
3980
|
-
};
|
|
3981
|
-
const onTouchEnd = (event) => {
|
|
3982
|
-
var _a, _b;
|
|
3983
|
-
event.stopPropagation();
|
|
3984
|
-
const changedTouches = event.changedTouches[0];
|
|
3985
|
-
state.touchParams.lastY = changedTouches.pageY;
|
|
3986
|
-
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
3987
|
-
let move = state.touchParams.lastY - state.touchParams.startY;
|
|
3988
|
-
if (Math.abs(move) < 5) {
|
|
3989
|
-
return false;
|
|
3990
|
-
}
|
|
3991
|
-
const updateMove = move + state.transformY;
|
|
3992
|
-
const h = ((_a = months.current) == null ? void 0 : _a.offsetHeight) || 0;
|
|
3993
|
-
const offsetHeight = ((_b = monthsPanel.current) == null ? void 0 : _b.offsetHeight) || 0;
|
|
3994
|
-
if (updateMove > 0) {
|
|
3995
|
-
getMonth(getCurrData("prev"), "prev");
|
|
3996
|
-
} else if (updateMove < 0 && updateMove < -offsetHeight + (Math.abs(move) > h ? Math.abs(move) : h) * 5) {
|
|
3997
|
-
getMonth(getCurrData("next"), "next");
|
|
3998
|
-
if (Math.abs(move) >= 300) {
|
|
3999
|
-
getMonth(getCurrData("next"), "next");
|
|
4063
|
+
if (current >= 1 && currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
|
|
4064
|
+
current -= 1;
|
|
4000
4065
|
}
|
|
4001
4066
|
}
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
moveTime += 1e3;
|
|
4006
|
-
setMove(move, "end", moveTime);
|
|
4007
|
-
} else {
|
|
4008
|
-
setMove(move, "end");
|
|
4067
|
+
if (state.currentIndex !== current) {
|
|
4068
|
+
state.currentIndex = current;
|
|
4069
|
+
setDefaultRange(state.monthsNum, current);
|
|
4009
4070
|
}
|
|
4071
|
+
setYearMonthTitle(state.monthsData[current].title);
|
|
4010
4072
|
};
|
|
4011
4073
|
const initData = () => {
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4074
|
+
const propStartDate = props.startDate ? props.startDate : Utils.getDay(0);
|
|
4075
|
+
const propEndDate = props.endDate ? props.endDate : Utils.getDay(365);
|
|
4076
|
+
state.propStartDate = propStartDate;
|
|
4077
|
+
state.propEndDate = propEndDate;
|
|
4078
|
+
state.startData = splitDate(propStartDate);
|
|
4079
|
+
state.endData = splitDate(propEndDate);
|
|
4080
|
+
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
4081
|
+
state.currDate = props.type !== "one" ? [...props.defaultValue] : props.defaultValue;
|
|
4082
|
+
}
|
|
4083
|
+
const startDate = {
|
|
4084
|
+
year: Number(state.startData[0]),
|
|
4085
|
+
month: Number(state.startData[1])
|
|
4086
|
+
};
|
|
4087
|
+
const endDate = {
|
|
4088
|
+
year: Number(state.endData[0]),
|
|
4089
|
+
month: Number(state.endData[1])
|
|
4090
|
+
};
|
|
4091
|
+
let monthsNum = endDate.month - startDate.month;
|
|
4092
|
+
if (endDate.year - startDate.year > 0) {
|
|
4093
|
+
monthsNum += 12 * (endDate.year - startDate.year);
|
|
4094
|
+
}
|
|
4095
|
+
if (monthsNum <= 0) {
|
|
4096
|
+
monthsNum = 1;
|
|
4018
4097
|
}
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4098
|
+
getMonth(state.startData, "next");
|
|
4099
|
+
let i = 1;
|
|
4100
|
+
do {
|
|
4101
|
+
getMonth(getCurrData("next"), "next");
|
|
4102
|
+
} while (i++ < monthsNum);
|
|
4103
|
+
state.monthsNum = monthsNum;
|
|
4104
|
+
if (type === "range" && Array.isArray(state.currDate)) {
|
|
4105
|
+
if (state.currDate.length > 0) {
|
|
4106
|
+
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
4107
|
+
state.currDate.splice(0, 1, propStartDate);
|
|
4108
|
+
}
|
|
4109
|
+
if (propEndDate && Utils.compareDate(propEndDate, state.currDate[1])) {
|
|
4110
|
+
state.currDate.splice(1, 1, propEndDate);
|
|
4111
|
+
}
|
|
4112
|
+
state.defaultData = [
|
|
4113
|
+
...splitDate(state.currDate[0]),
|
|
4114
|
+
...splitDate(state.currDate[1])
|
|
4115
|
+
];
|
|
4022
4116
|
}
|
|
4023
|
-
|
|
4024
|
-
|
|
4117
|
+
} else if (props.type === "multiple" && Array.isArray(state.currDate)) {
|
|
4118
|
+
if (state.currDate.length > 0) {
|
|
4119
|
+
const defaultArr = [];
|
|
4120
|
+
const obj = {};
|
|
4121
|
+
state.currDate.forEach((item) => {
|
|
4122
|
+
if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
|
|
4123
|
+
if (!Object.hasOwnProperty.call(obj, item)) {
|
|
4124
|
+
defaultArr.push(item);
|
|
4125
|
+
obj[item] = item;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
});
|
|
4129
|
+
state.currDate = [...defaultArr];
|
|
4130
|
+
state.defaultData = [...splitDate(defaultArr[0])];
|
|
4025
4131
|
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
if (startDate && Utils.compareDate(state.currDate, startDate)) {
|
|
4032
|
-
state.currDate = startDate;
|
|
4033
|
-
} else if (endDate && !Utils.compareDate(state.currDate, endDate)) {
|
|
4034
|
-
state.currDate = endDate;
|
|
4132
|
+
} else if (state.currDate) {
|
|
4133
|
+
if (propStartDate && Utils.compareDate(state.currDate, propStartDate)) {
|
|
4134
|
+
state.currDate = propStartDate;
|
|
4135
|
+
} else if (propEndDate && !Utils.compareDate(state.currDate, propEndDate)) {
|
|
4136
|
+
state.currDate = propEndDate;
|
|
4035
4137
|
}
|
|
4036
4138
|
state.defaultData = [...splitDate(state.currDate)];
|
|
4037
4139
|
}
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
chooseDay(
|
|
4058
|
-
{ day: state.defaultData[2], type: "curr" },
|
|
4059
|
-
state.monthsData[0],
|
|
4060
|
-
true
|
|
4061
|
-
);
|
|
4140
|
+
let current = 0;
|
|
4141
|
+
let lastCurrent = 0;
|
|
4142
|
+
if (state.defaultData.length > 0) {
|
|
4143
|
+
state.monthsData.forEach((item, index) => {
|
|
4144
|
+
if (item.title === locale.calendaritem.monthTitle(
|
|
4145
|
+
state.defaultData[0],
|
|
4146
|
+
state.defaultData[1]
|
|
4147
|
+
)) {
|
|
4148
|
+
current = index;
|
|
4149
|
+
}
|
|
4150
|
+
if (props.type === "range") {
|
|
4151
|
+
if (item.title === locale.calendaritem.monthTitle(
|
|
4152
|
+
state.defaultData[3],
|
|
4153
|
+
state.defaultData[4]
|
|
4154
|
+
)) {
|
|
4155
|
+
lastCurrent = index;
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
});
|
|
4062
4159
|
}
|
|
4160
|
+
setDefaultRange(monthsNum, current);
|
|
4161
|
+
state.currentIndex = current;
|
|
4162
|
+
setYearMonthTitle(state.monthsData[state.currentIndex].title);
|
|
4163
|
+
if (state.defaultData.length > 0) {
|
|
4164
|
+
if (type === "range") {
|
|
4165
|
+
chooseDay(
|
|
4166
|
+
{ day: state.defaultData[2], type: "curr" },
|
|
4167
|
+
state.monthsData[state.currentIndex],
|
|
4168
|
+
true
|
|
4169
|
+
);
|
|
4170
|
+
chooseDay(
|
|
4171
|
+
{ day: state.defaultData[5], type: "curr" },
|
|
4172
|
+
state.monthsData[lastCurrent],
|
|
4173
|
+
true
|
|
4174
|
+
);
|
|
4175
|
+
} else if (type === "multiple") {
|
|
4176
|
+
[...state.currDate].forEach((item) => {
|
|
4177
|
+
const dateArr = splitDate(item);
|
|
4178
|
+
let current2 = state.currentIndex;
|
|
4179
|
+
state.monthsData.forEach((item2, index) => {
|
|
4180
|
+
if (item2.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
4181
|
+
current2 = index;
|
|
4182
|
+
}
|
|
4183
|
+
});
|
|
4184
|
+
chooseDay(
|
|
4185
|
+
{ day: dateArr[2], type: "curr" },
|
|
4186
|
+
state.monthsData[current2],
|
|
4187
|
+
true
|
|
4188
|
+
);
|
|
4189
|
+
});
|
|
4190
|
+
} else {
|
|
4191
|
+
chooseDay(
|
|
4192
|
+
{ day: state.defaultData[2], type: "curr" },
|
|
4193
|
+
state.monthsData[state.currentIndex],
|
|
4194
|
+
true
|
|
4195
|
+
);
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
const lastItem = state.monthsData[state.monthsData.length - 1];
|
|
4199
|
+
const containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
|
|
4200
|
+
requestAniFrame$1(() => {
|
|
4201
|
+
if (months && monthsPanel && viewArea) {
|
|
4202
|
+
viewHeight = months.current.clientHeight;
|
|
4203
|
+
monthsPanel.current.style.height = `${containerHeight}px`;
|
|
4204
|
+
months.current.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
|
|
4205
|
+
}
|
|
4206
|
+
});
|
|
4207
|
+
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
|
|
4208
|
+
};
|
|
4209
|
+
const resetRender = () => {
|
|
4210
|
+
state.chooseData.splice(0);
|
|
4211
|
+
state.monthsData.splice(0);
|
|
4212
|
+
initData();
|
|
4213
|
+
};
|
|
4214
|
+
const scrollToDate = (date) => {
|
|
4215
|
+
if (Utils.compareDate(date, state.propStartDate)) {
|
|
4216
|
+
date = state.propStartDate;
|
|
4217
|
+
} else if (!Utils.compareDate(date, state.propEndDate)) {
|
|
4218
|
+
date = state.propEndDate;
|
|
4219
|
+
}
|
|
4220
|
+
const dateArr = splitDate(date);
|
|
4221
|
+
state.monthsData.forEach((item, index) => {
|
|
4222
|
+
if (item.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
4223
|
+
if (months.current) {
|
|
4224
|
+
const distance = state.monthsData[index].cssScrollHeight - months.current.scrollTop;
|
|
4225
|
+
if (toDateAnimation) {
|
|
4226
|
+
let flag = 0;
|
|
4227
|
+
const interval = setInterval(() => {
|
|
4228
|
+
flag++;
|
|
4229
|
+
if (months.current) {
|
|
4230
|
+
const offset = distance / 10;
|
|
4231
|
+
months.current.scrollTop += offset;
|
|
4232
|
+
}
|
|
4233
|
+
if (flag >= 10) {
|
|
4234
|
+
clearInterval(interval);
|
|
4235
|
+
if (months.current) {
|
|
4236
|
+
months.current.scrollTop = state.monthsData[index].cssScrollHeight;
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
}, 40);
|
|
4240
|
+
} else {
|
|
4241
|
+
months.current.scrollTop = state.monthsData[index].cssScrollHeight;
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4245
|
+
});
|
|
4063
4246
|
};
|
|
4064
4247
|
useEffect(() => {
|
|
4065
4248
|
initData();
|
|
4066
4249
|
}, []);
|
|
4250
|
+
useEffect(() => {
|
|
4251
|
+
poppable && resetRender();
|
|
4252
|
+
}, [defaultValue]);
|
|
4253
|
+
React__default.useImperativeHandle(ref, () => ({
|
|
4254
|
+
scrollToDate
|
|
4255
|
+
}));
|
|
4067
4256
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
4068
4257
|
className: classes
|
|
4069
4258
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4070
4259
|
className: headerClasses
|
|
4071
|
-
},
|
|
4260
|
+
}, showTitle && /* @__PURE__ */ React__default.createElement("div", {
|
|
4072
4261
|
className: "calendar-title"
|
|
4073
|
-
}, locale.calendaritem.title), /* @__PURE__ */ React__default.createElement("div", {
|
|
4262
|
+
}, title || locale.calendaritem.title), onBtn && /* @__PURE__ */ React__default.createElement("div", {
|
|
4263
|
+
className: "calendar-top-slot"
|
|
4264
|
+
}, onBtn()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", {
|
|
4074
4265
|
className: "calendar-curr-month"
|
|
4075
|
-
}, yearMonthTitle)
|
|
4266
|
+
}, yearMonthTitle), /* @__PURE__ */ React__default.createElement("div", {
|
|
4076
4267
|
className: "calendar-weeks",
|
|
4077
4268
|
ref: weeksPanel
|
|
4078
4269
|
}, weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -4080,48 +4271,54 @@ const CalendarItem = (props) => {
|
|
|
4080
4271
|
key: item
|
|
4081
4272
|
}, item)))), /* @__PURE__ */ React__default.createElement("div", {
|
|
4082
4273
|
className: "nut-calendar-content",
|
|
4083
|
-
|
|
4084
|
-
onTouchMove,
|
|
4085
|
-
onTouchEnd,
|
|
4274
|
+
onScroll: mothsViewScroll,
|
|
4086
4275
|
ref: months
|
|
4087
4276
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4088
4277
|
className: "calendar-months-panel",
|
|
4089
4278
|
ref: monthsPanel
|
|
4090
4279
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4091
|
-
className: "
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4280
|
+
className: "viewArea",
|
|
4281
|
+
ref: viewArea,
|
|
4282
|
+
style: { transform: `translateY(${translateY}px)` }
|
|
4283
|
+
}, state.monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
|
|
4284
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4285
|
+
className: "calendar-month",
|
|
4286
|
+
key
|
|
4287
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4288
|
+
className: "calendar-month-title"
|
|
4289
|
+
}, month.title), /* @__PURE__ */ React__default.createElement("div", {
|
|
4290
|
+
className: "calendar-month-con"
|
|
4291
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4292
|
+
className: monthitemclasses
|
|
4293
|
+
}, month.monthData.map((day, i) => /* @__PURE__ */ React__default.createElement("div", {
|
|
4294
|
+
className: [
|
|
4295
|
+
"calendar-month-day",
|
|
4296
|
+
getClass(day, month)
|
|
4297
|
+
].join(" "),
|
|
4298
|
+
onClick: () => {
|
|
4299
|
+
chooseDay(day, month);
|
|
4300
|
+
},
|
|
4301
|
+
key: i
|
|
4302
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4303
|
+
className: "calendar-day"
|
|
4304
|
+
}, onDay ? onDay(day) : day.day), onTopInfo && /* @__PURE__ */ React__default.createElement("div", {
|
|
4305
|
+
className: "calendar-curr-tips calendar-curr-tips-top"
|
|
4306
|
+
}, onTopInfo(day)), onBottomInfo && /* @__PURE__ */ React__default.createElement("div", {
|
|
4307
|
+
className: "calendar-curr-tips calendar-curr-tips-bottom"
|
|
4308
|
+
}, onBottomInfo(day)), !onBottomInfo && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", {
|
|
4309
|
+
className: "calendar-curr-tip-curr"
|
|
4310
|
+
}, locale.calendaritem.today), isStartTip(day, month) && /* @__PURE__ */ React__default.createElement("div", {
|
|
4311
|
+
className: `calendar-day-tip ${rangeTip() ? "calendar-curr-tips-top" : ""}`
|
|
4312
|
+
}, startText || locale.calendaritem.start), isEndTip(day, month) && /* @__PURE__ */ React__default.createElement("div", {
|
|
4313
|
+
className: "calendar-day-tip"
|
|
4314
|
+
}, endText || locale.calendaritem.end))))));
|
|
4315
|
+
})))), poppable && !isAutoBackFill ? /* @__PURE__ */ React__default.createElement("div", {
|
|
4119
4316
|
className: "nut-calendar-footer"
|
|
4120
4317
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
4121
4318
|
className: "calendar-confirm-btn",
|
|
4122
4319
|
onClick: confirm
|
|
4123
|
-
}, locale.confirm)) : ""));
|
|
4124
|
-
};
|
|
4320
|
+
}, confirmText || locale.confirm)) : ""));
|
|
4321
|
+
});
|
|
4125
4322
|
CalendarItem.defaultProps = defaultProps$14;
|
|
4126
4323
|
CalendarItem.displayName = "NutCalendarItem";
|
|
4127
4324
|
const defaultProps$13 = {
|
|
@@ -4133,12 +4330,25 @@ const defaultProps$13 = {
|
|
|
4133
4330
|
defaultValue: "",
|
|
4134
4331
|
startDate: Utils.getDay(0),
|
|
4135
4332
|
endDate: Utils.getDay(365),
|
|
4333
|
+
showToday: true,
|
|
4334
|
+
startText: "\u5F00\u59CB",
|
|
4335
|
+
endText: "\u7ED3\u675F",
|
|
4336
|
+
confirmText: "\u786E\u8BA4",
|
|
4337
|
+
showTitle: true,
|
|
4338
|
+
showSubTitle: true,
|
|
4339
|
+
toDateAnimation: true,
|
|
4340
|
+
onBtn: void 0,
|
|
4341
|
+
onDay: void 0,
|
|
4342
|
+
onTopInfo: void 0,
|
|
4343
|
+
onBottomInfo: void 0,
|
|
4136
4344
|
onClose: () => {
|
|
4137
4345
|
},
|
|
4138
4346
|
onChoose: (param) => {
|
|
4347
|
+
},
|
|
4348
|
+
onSelected: (data) => {
|
|
4139
4349
|
}
|
|
4140
4350
|
};
|
|
4141
|
-
const Calendar = (props) => {
|
|
4351
|
+
const Calendar = React__default.forwardRef((props, ref) => {
|
|
4142
4352
|
const { locale } = useConfig$1();
|
|
4143
4353
|
const {
|
|
4144
4354
|
children,
|
|
@@ -4150,14 +4360,25 @@ const Calendar = (props) => {
|
|
|
4150
4360
|
defaultValue,
|
|
4151
4361
|
startDate,
|
|
4152
4362
|
endDate,
|
|
4363
|
+
showToday,
|
|
4364
|
+
startText,
|
|
4365
|
+
endText,
|
|
4366
|
+
confirmText,
|
|
4367
|
+
showTitle,
|
|
4368
|
+
showSubTitle,
|
|
4369
|
+
toDateAnimation,
|
|
4370
|
+
onBtn,
|
|
4371
|
+
onDay,
|
|
4372
|
+
onTopInfo,
|
|
4373
|
+
onBottomInfo,
|
|
4153
4374
|
onClose,
|
|
4154
|
-
onChoose
|
|
4375
|
+
onChoose,
|
|
4376
|
+
onSelected
|
|
4155
4377
|
} = { ...defaultProps$13, ...props };
|
|
4378
|
+
const calendarRef = useRef(null);
|
|
4156
4379
|
const close = () => {
|
|
4157
4380
|
onClose && onClose();
|
|
4158
4381
|
};
|
|
4159
|
-
const update2 = () => {
|
|
4160
|
-
};
|
|
4161
4382
|
const choose = (param) => {
|
|
4162
4383
|
close();
|
|
4163
4384
|
onChoose && onChoose(param);
|
|
@@ -4165,6 +4386,41 @@ const Calendar = (props) => {
|
|
|
4165
4386
|
const closePopup = () => {
|
|
4166
4387
|
close();
|
|
4167
4388
|
};
|
|
4389
|
+
const select = (param) => {
|
|
4390
|
+
onSelected && onSelected(param);
|
|
4391
|
+
};
|
|
4392
|
+
const scrollToDate = (date) => {
|
|
4393
|
+
var _a;
|
|
4394
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date);
|
|
4395
|
+
};
|
|
4396
|
+
React__default.useImperativeHandle(ref, () => ({
|
|
4397
|
+
scrollToDate
|
|
4398
|
+
}));
|
|
4399
|
+
const renderItem = () => {
|
|
4400
|
+
return /* @__PURE__ */ React__default.createElement(CalendarItem, {
|
|
4401
|
+
ref: calendarRef,
|
|
4402
|
+
type,
|
|
4403
|
+
isAutoBackFill,
|
|
4404
|
+
poppable,
|
|
4405
|
+
title: locale.calendaritem.title || title,
|
|
4406
|
+
defaultValue,
|
|
4407
|
+
startDate,
|
|
4408
|
+
endDate,
|
|
4409
|
+
showToday,
|
|
4410
|
+
startText,
|
|
4411
|
+
endText,
|
|
4412
|
+
confirmText,
|
|
4413
|
+
showTitle,
|
|
4414
|
+
showSubTitle,
|
|
4415
|
+
toDateAnimation,
|
|
4416
|
+
onBtn,
|
|
4417
|
+
onDay,
|
|
4418
|
+
onTopInfo,
|
|
4419
|
+
onBottomInfo,
|
|
4420
|
+
onChoose: choose,
|
|
4421
|
+
onSelected: select
|
|
4422
|
+
});
|
|
4423
|
+
};
|
|
4168
4424
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, poppable ? /* @__PURE__ */ React__default.createElement(Popup, {
|
|
4169
4425
|
visible,
|
|
4170
4426
|
position: "bottom",
|
|
@@ -4175,29 +4431,8 @@ const Calendar = (props) => {
|
|
|
4175
4431
|
onClickOverlay: closePopup,
|
|
4176
4432
|
onClickCloseIcon: closePopup,
|
|
4177
4433
|
style: { height: "85vh" }
|
|
4178
|
-
},
|
|
4179
|
-
|
|
4180
|
-
isAutoBackFill,
|
|
4181
|
-
poppable,
|
|
4182
|
-
title: locale.calendaritem.title || title,
|
|
4183
|
-
defaultValue,
|
|
4184
|
-
startDate,
|
|
4185
|
-
endDate,
|
|
4186
|
-
onUpdate: update2,
|
|
4187
|
-
onClose: close,
|
|
4188
|
-
onChoose: choose
|
|
4189
|
-
})) : /* @__PURE__ */ React__default.createElement(CalendarItem, {
|
|
4190
|
-
type,
|
|
4191
|
-
isAutoBackFill,
|
|
4192
|
-
poppable,
|
|
4193
|
-
title: locale.calendaritem.title,
|
|
4194
|
-
defaultValue,
|
|
4195
|
-
startDate,
|
|
4196
|
-
endDate,
|
|
4197
|
-
onClose: close,
|
|
4198
|
-
onChoose: choose
|
|
4199
|
-
}));
|
|
4200
|
-
};
|
|
4434
|
+
}, renderItem()) : renderItem());
|
|
4435
|
+
});
|
|
4201
4436
|
Calendar.defaultProps = defaultProps$13;
|
|
4202
4437
|
Calendar.displayName = "NutCalendar";
|
|
4203
4438
|
const defaultProps$12 = {
|
|
@@ -4211,11 +4446,12 @@ const defaultProps$12 = {
|
|
|
4211
4446
|
},
|
|
4212
4447
|
activeColor: "#fa2c19",
|
|
4213
4448
|
checked: false,
|
|
4449
|
+
checkedIcon: "checklist",
|
|
4214
4450
|
chooseItem: () => {
|
|
4215
4451
|
}
|
|
4216
4452
|
};
|
|
4217
|
-
const InternalCascaderItem = (props) => {
|
|
4218
|
-
const { data, checked, chooseItem, activeColor } = {
|
|
4453
|
+
const InternalCascaderItem = (props, ref) => {
|
|
4454
|
+
const { data, checked, checkedIcon, chooseItem, activeColor } = {
|
|
4219
4455
|
...defaultProps$12,
|
|
4220
4456
|
...props
|
|
4221
4457
|
};
|
|
@@ -4230,11 +4466,6 @@ const InternalCascaderItem = (props) => {
|
|
|
4230
4466
|
const classesTitle = classNames({
|
|
4231
4467
|
[`${b2("")}__title`]: true
|
|
4232
4468
|
});
|
|
4233
|
-
useEffect(() => {
|
|
4234
|
-
initData();
|
|
4235
|
-
}, [data]);
|
|
4236
|
-
const initData = () => {
|
|
4237
|
-
};
|
|
4238
4469
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4239
4470
|
style: { color: checked ? activeColor : "" },
|
|
4240
4471
|
className: classes,
|
|
@@ -4249,7 +4480,7 @@ const InternalCascaderItem = (props) => {
|
|
|
4249
4480
|
name: "loading"
|
|
4250
4481
|
}) : /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
4251
4482
|
className: `${checked ? b2("icon-check") : ""}`,
|
|
4252
|
-
name: "
|
|
4483
|
+
name: checked ? checkedIcon : ""
|
|
4253
4484
|
}));
|
|
4254
4485
|
};
|
|
4255
4486
|
const CascaderItem = React__default.forwardRef(InternalCascaderItem);
|
|
@@ -4391,6 +4622,7 @@ const defaultProps$11 = {
|
|
|
4391
4622
|
className: "",
|
|
4392
4623
|
style: {},
|
|
4393
4624
|
activeColor: "#fa2c19",
|
|
4625
|
+
checkedIcon: "checklist",
|
|
4394
4626
|
tabsColor: "",
|
|
4395
4627
|
poppable: true,
|
|
4396
4628
|
visible: false,
|
|
@@ -4415,7 +4647,7 @@ const defaultProps$11 = {
|
|
|
4415
4647
|
},
|
|
4416
4648
|
...Popup.defaultProps
|
|
4417
4649
|
};
|
|
4418
|
-
const InternalCascader = (props) => {
|
|
4650
|
+
const InternalCascader = (props, ref) => {
|
|
4419
4651
|
const {
|
|
4420
4652
|
className,
|
|
4421
4653
|
style,
|
|
@@ -4439,7 +4671,7 @@ const InternalCascader = (props) => {
|
|
|
4439
4671
|
onPathChange
|
|
4440
4672
|
} = { ...defaultProps$11, ...props };
|
|
4441
4673
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
4442
|
-
const [
|
|
4674
|
+
const [optionsData, setOptionsData] = useState([]);
|
|
4443
4675
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
|
|
4444
4676
|
const [state] = useState({
|
|
4445
4677
|
optionsData: [],
|
|
@@ -4512,7 +4744,7 @@ const InternalCascader = (props) => {
|
|
|
4512
4744
|
}
|
|
4513
4745
|
];
|
|
4514
4746
|
syncValue();
|
|
4515
|
-
|
|
4747
|
+
setOptionsData(state.panes);
|
|
4516
4748
|
};
|
|
4517
4749
|
const syncValue = async () => {
|
|
4518
4750
|
const currentValue2 = state.innerValue;
|
|
@@ -4606,7 +4838,7 @@ const InternalCascader = (props) => {
|
|
|
4606
4838
|
onChange(optionParams, pathNodes);
|
|
4607
4839
|
onPathChange(optionParams, pathNodes);
|
|
4608
4840
|
}
|
|
4609
|
-
|
|
4841
|
+
setOptionsData(state.panes);
|
|
4610
4842
|
close();
|
|
4611
4843
|
return;
|
|
4612
4844
|
}
|
|
@@ -4621,7 +4853,7 @@ const InternalCascader = (props) => {
|
|
|
4621
4853
|
paneKey: `c${state.tabsCursor + 1}`
|
|
4622
4854
|
});
|
|
4623
4855
|
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
4624
|
-
|
|
4856
|
+
setOptionsData(state.panes);
|
|
4625
4857
|
if (!type) {
|
|
4626
4858
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
4627
4859
|
const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
|
|
@@ -4638,7 +4870,7 @@ const InternalCascader = (props) => {
|
|
|
4638
4870
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
4639
4871
|
chooseItem(node, type);
|
|
4640
4872
|
}
|
|
4641
|
-
|
|
4873
|
+
setOptionsData(state.panes);
|
|
4642
4874
|
};
|
|
4643
4875
|
const renderItem = () => {
|
|
4644
4876
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -4649,7 +4881,7 @@ const InternalCascader = (props) => {
|
|
|
4649
4881
|
}, title), /* @__PURE__ */ React__default.createElement(Tabs, {
|
|
4650
4882
|
value: tabvalue,
|
|
4651
4883
|
titleNode: () => {
|
|
4652
|
-
return
|
|
4884
|
+
return optionsData.map((pane, index) => {
|
|
4653
4885
|
var _a, _b;
|
|
4654
4886
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4655
4887
|
onClick: () => {
|
|
@@ -4666,7 +4898,7 @@ const InternalCascader = (props) => {
|
|
|
4666
4898
|
}));
|
|
4667
4899
|
});
|
|
4668
4900
|
}
|
|
4669
|
-
}, !state.initLoading && state.panes.length ?
|
|
4901
|
+
}, !state.initLoading && state.panes.length ? optionsData.map((pane) => /* @__PURE__ */ React__default.createElement(TabPane, {
|
|
4670
4902
|
key: pane.paneKey,
|
|
4671
4903
|
paneKey: pane.paneKey
|
|
4672
4904
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -4703,6 +4935,8 @@ const defaultProps$10 = {
|
|
|
4703
4935
|
disabled: false,
|
|
4704
4936
|
checkedValue: [],
|
|
4705
4937
|
max: void 0,
|
|
4938
|
+
textPosition: "right",
|
|
4939
|
+
direction: "vertical",
|
|
4706
4940
|
onChange: (value) => {
|
|
4707
4941
|
},
|
|
4708
4942
|
options: []
|
|
@@ -4717,6 +4951,8 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
4717
4951
|
onChange,
|
|
4718
4952
|
checkedValue,
|
|
4719
4953
|
max,
|
|
4954
|
+
textPosition,
|
|
4955
|
+
direction,
|
|
4720
4956
|
options,
|
|
4721
4957
|
...rest
|
|
4722
4958
|
} = props;
|
|
@@ -4772,9 +5008,9 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
4772
5008
|
return (innerValue == null ? void 0 : innerValue.indexOf(child.props.label || child.children)) > -1;
|
|
4773
5009
|
}
|
|
4774
5010
|
function validateChecked(value) {
|
|
4775
|
-
if (innerValue
|
|
5011
|
+
if (!innerValue)
|
|
4776
5012
|
return false;
|
|
4777
|
-
return innerValue
|
|
5013
|
+
return (innerValue == null ? void 0 : innerValue.indexOf(value)) > -1;
|
|
4778
5014
|
}
|
|
4779
5015
|
function getParentVals() {
|
|
4780
5016
|
return innerValue;
|
|
@@ -4790,7 +5026,8 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
4790
5026
|
checked: childChecked,
|
|
4791
5027
|
onChange: handleChildChange,
|
|
4792
5028
|
getParentVals,
|
|
4793
|
-
max
|
|
5029
|
+
max,
|
|
5030
|
+
textPosition
|
|
4794
5031
|
});
|
|
4795
5032
|
});
|
|
4796
5033
|
}
|
|
@@ -4805,13 +5042,14 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
4805
5042
|
onChange: handleChildChange,
|
|
4806
5043
|
...rest2,
|
|
4807
5044
|
max,
|
|
5045
|
+
textPosition,
|
|
4808
5046
|
getParentVals,
|
|
4809
5047
|
checked: childChecked
|
|
4810
5048
|
});
|
|
4811
5049
|
});
|
|
4812
|
-
}, [innerValue, options]);
|
|
5050
|
+
}, [innerValue, options, innerDisabled, max]);
|
|
4813
5051
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
4814
|
-
className: `${b2()} ${className || ""}`,
|
|
5052
|
+
className: `${b2()} nut-checkboxgroup--${props.direction} ${className || ""}`,
|
|
4815
5053
|
...rest
|
|
4816
5054
|
}, (options == null ? void 0 : options.length) ? renderOptionsChildren() : cloneChildren());
|
|
4817
5055
|
}
|
|
@@ -6400,13 +6638,7 @@ const InputNumber = (props) => {
|
|
|
6400
6638
|
onChangeFuc && onChangeFuc(outputValue, e2);
|
|
6401
6639
|
change && change(outputValue, e2);
|
|
6402
6640
|
if (!isAsync) {
|
|
6403
|
-
|
|
6404
|
-
setInputValue(Number(min));
|
|
6405
|
-
} else if (Number(outputValue) > Number(max)) {
|
|
6406
|
-
setInputValue(Number(max));
|
|
6407
|
-
} else {
|
|
6408
|
-
setInputValue(outputValue);
|
|
6409
|
-
}
|
|
6641
|
+
setInputValue(outputValue);
|
|
6410
6642
|
}
|
|
6411
6643
|
};
|
|
6412
6644
|
const reduceNumber = (e2) => {
|
|
@@ -6432,15 +6664,11 @@ const InputNumber = (props) => {
|
|
|
6432
6664
|
}
|
|
6433
6665
|
};
|
|
6434
6666
|
const changeValue = (e2) => {
|
|
6435
|
-
const
|
|
6436
|
-
change && change(value, e2);
|
|
6437
|
-
onChangeFuc && onChangeFuc(value, e2);
|
|
6667
|
+
const input = e2.target;
|
|
6668
|
+
change && change(input.value, e2);
|
|
6669
|
+
onChangeFuc && onChangeFuc(input.value, e2);
|
|
6438
6670
|
if (!isAsync) {
|
|
6439
|
-
|
|
6440
|
-
setInputValue(inputValue);
|
|
6441
|
-
} else {
|
|
6442
|
-
setInputValue(value);
|
|
6443
|
-
}
|
|
6671
|
+
setInputValue(input.value);
|
|
6444
6672
|
}
|
|
6445
6673
|
};
|
|
6446
6674
|
const focusValue = (e2) => {
|
|
@@ -6456,7 +6684,8 @@ const InputNumber = (props) => {
|
|
|
6456
6684
|
return;
|
|
6457
6685
|
if (readonly)
|
|
6458
6686
|
return;
|
|
6459
|
-
|
|
6687
|
+
const input = e2.target;
|
|
6688
|
+
let value = +input.value;
|
|
6460
6689
|
if (value < Number(min)) {
|
|
6461
6690
|
value = Number(min);
|
|
6462
6691
|
} else if (value > Number(max)) {
|
|
@@ -6470,6 +6699,8 @@ const InputNumber = (props) => {
|
|
|
6470
6699
|
className: classes,
|
|
6471
6700
|
style: styles,
|
|
6472
6701
|
...restProps
|
|
6702
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
6703
|
+
className: "nut-input-minus"
|
|
6473
6704
|
}, /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
6474
6705
|
classPrefix: iconClassPrefix,
|
|
6475
6706
|
fontClassName: iconFontClassName,
|
|
@@ -6477,7 +6708,7 @@ const InputNumber = (props) => {
|
|
|
6477
6708
|
size: buttonSize,
|
|
6478
6709
|
name: "minus",
|
|
6479
6710
|
onClick: reduceNumber
|
|
6480
|
-
}), /* @__PURE__ */ React__default.createElement("input", {
|
|
6711
|
+
})), /* @__PURE__ */ React__default.createElement("input", {
|
|
6481
6712
|
className: "nut-number-input",
|
|
6482
6713
|
type: "number",
|
|
6483
6714
|
min,
|
|
@@ -6489,14 +6720,16 @@ const InputNumber = (props) => {
|
|
|
6489
6720
|
onInput: changeValue,
|
|
6490
6721
|
onBlur: burValue,
|
|
6491
6722
|
onFocus: focusValue
|
|
6492
|
-
}), /* @__PURE__ */ React__default.createElement(
|
|
6723
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
|
6724
|
+
className: "nut-input-add"
|
|
6725
|
+
}, /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
6493
6726
|
classPrefix: iconClassPrefix,
|
|
6494
6727
|
fontClassName: iconFontClassName,
|
|
6495
6728
|
className: iconAddClasses,
|
|
6496
6729
|
size: buttonSize,
|
|
6497
6730
|
name: "plus",
|
|
6498
6731
|
onClick: addNumber
|
|
6499
|
-
}));
|
|
6732
|
+
})));
|
|
6500
6733
|
};
|
|
6501
6734
|
InputNumber.defaultProps = defaultProps$W;
|
|
6502
6735
|
InputNumber.displayName = "NutInputNumber";
|
|
@@ -7809,6 +8042,7 @@ const defaultProps$N = {
|
|
|
7809
8042
|
closeOnClickOverlay: true,
|
|
7810
8043
|
length: 6,
|
|
7811
8044
|
className: "",
|
|
8045
|
+
autoFocus: false,
|
|
7812
8046
|
onChange: (value) => {
|
|
7813
8047
|
},
|
|
7814
8048
|
onOk: (value) => {
|
|
@@ -7844,6 +8078,7 @@ const ShortPassword = (props) => {
|
|
|
7844
8078
|
onComplete,
|
|
7845
8079
|
iconClassPrefix,
|
|
7846
8080
|
iconFontClassName,
|
|
8081
|
+
autoFocus,
|
|
7847
8082
|
...reset
|
|
7848
8083
|
} = props;
|
|
7849
8084
|
const b2 = cn("shortpassword");
|
|
@@ -7928,6 +8163,7 @@ const ShortPassword = (props) => {
|
|
|
7928
8163
|
style: systemStyle(),
|
|
7929
8164
|
maxLength: 6,
|
|
7930
8165
|
value: inputValue,
|
|
8166
|
+
autoFocus,
|
|
7931
8167
|
onChange: (e2) => changeValue(e2)
|
|
7932
8168
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
|
7933
8169
|
className: b2("input-site")
|
|
@@ -8006,6 +8242,10 @@ const TextArea = (props) => {
|
|
|
8006
8242
|
SetInputValue(initValue);
|
|
8007
8243
|
}, [defaultValue]);
|
|
8008
8244
|
const textChange = (event) => {
|
|
8245
|
+
if (disabled)
|
|
8246
|
+
return;
|
|
8247
|
+
if (readonly)
|
|
8248
|
+
return;
|
|
8009
8249
|
const text = event.detail ? event.detail : event.target;
|
|
8010
8250
|
if (maxlength && [...text.value].length > Number(maxlength)) {
|
|
8011
8251
|
text.value = text.value.substring(0, Number(maxlength));
|
|
@@ -8038,8 +8278,7 @@ const TextArea = (props) => {
|
|
|
8038
8278
|
resize: `${autosize ? "vertical" : "none"}`,
|
|
8039
8279
|
...style
|
|
8040
8280
|
},
|
|
8041
|
-
disabled,
|
|
8042
|
-
readOnly: readonly,
|
|
8281
|
+
readOnly: disabled || readonly,
|
|
8043
8282
|
value: inputValue,
|
|
8044
8283
|
onInput: (e2) => {
|
|
8045
8284
|
textChange(e2);
|
|
@@ -8294,6 +8533,7 @@ const defaultProps$K = {
|
|
|
8294
8533
|
name: "file",
|
|
8295
8534
|
disabled: false,
|
|
8296
8535
|
autoUpload: true,
|
|
8536
|
+
multiple: false,
|
|
8297
8537
|
maximize: Number.MAX_VALUE,
|
|
8298
8538
|
data: {},
|
|
8299
8539
|
headers: {},
|
|
@@ -8337,6 +8577,7 @@ const InternalUploader = (props, ref) => {
|
|
|
8337
8577
|
isDeletable,
|
|
8338
8578
|
maximum,
|
|
8339
8579
|
maximize,
|
|
8580
|
+
multiple,
|
|
8340
8581
|
className,
|
|
8341
8582
|
autoUpload,
|
|
8342
8583
|
sizeType,
|
|
@@ -8384,7 +8625,7 @@ const InternalUploader = (props, ref) => {
|
|
|
8384
8625
|
return;
|
|
8385
8626
|
}
|
|
8386
8627
|
chooseImage({
|
|
8387
|
-
count: maximum * 1 - fileList.length,
|
|
8628
|
+
count: multiple ? maximum * 1 - fileList.length : 1,
|
|
8388
8629
|
sizeType,
|
|
8389
8630
|
sourceType,
|
|
8390
8631
|
success: onChangeFn
|
|
@@ -8875,11 +9116,9 @@ const DialogWrap = (props) => {
|
|
|
8875
9116
|
DialogWrap.displayName = "NutDialogWrap";
|
|
8876
9117
|
const DialogWrapper = (props) => {
|
|
8877
9118
|
const { visible, lockScroll } = props;
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
8882
|
-
style: { display: visible ? "block" : "none" }
|
|
9119
|
+
return /* @__PURE__ */ React__default.createElement(index_cjs.View, {
|
|
9120
|
+
style: { display: visible ? "block" : "none" },
|
|
9121
|
+
catchMove: lockScroll
|
|
8883
9122
|
}, /* @__PURE__ */ React__default.createElement(DialogWrap, {
|
|
8884
9123
|
...props
|
|
8885
9124
|
}));
|
|
@@ -8899,73 +9138,74 @@ const defaultProps$H = {
|
|
|
8899
9138
|
footerDirection: "horizontal",
|
|
8900
9139
|
lockScroll: false
|
|
8901
9140
|
};
|
|
8902
|
-
const BaseDialog = (
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
e2
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
e2
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
9141
|
+
const BaseDialog = forwardRef(
|
|
9142
|
+
(props, ref) => {
|
|
9143
|
+
const { locale } = useConfig$1();
|
|
9144
|
+
const {
|
|
9145
|
+
visible,
|
|
9146
|
+
footer,
|
|
9147
|
+
noOkBtn,
|
|
9148
|
+
noCancelBtn,
|
|
9149
|
+
lockScroll,
|
|
9150
|
+
okBtnDisabled,
|
|
9151
|
+
cancelAutoClose,
|
|
9152
|
+
okText,
|
|
9153
|
+
cancelText,
|
|
9154
|
+
onClosed,
|
|
9155
|
+
onCancel,
|
|
9156
|
+
onOk,
|
|
9157
|
+
...restProps
|
|
9158
|
+
} = props;
|
|
9159
|
+
const renderFooter = function() {
|
|
9160
|
+
if (footer === null)
|
|
9161
|
+
return "";
|
|
9162
|
+
const handleCancel = function(e2) {
|
|
9163
|
+
e2.stopPropagation();
|
|
9164
|
+
if (!cancelAutoClose)
|
|
9165
|
+
return;
|
|
9166
|
+
onClosed == null ? void 0 : onClosed();
|
|
9167
|
+
onCancel == null ? void 0 : onCancel();
|
|
9168
|
+
if (lockScroll && visible) {
|
|
9169
|
+
document.body.classList.remove("nut-overflow-hidden");
|
|
9170
|
+
}
|
|
9171
|
+
};
|
|
9172
|
+
const handleOk = function(e2) {
|
|
9173
|
+
e2.stopPropagation();
|
|
9174
|
+
onClosed == null ? void 0 : onClosed();
|
|
9175
|
+
onOk == null ? void 0 : onOk(e2);
|
|
9176
|
+
if (lockScroll && visible) {
|
|
9177
|
+
document.body.classList.remove("nut-overflow-hidden");
|
|
9178
|
+
}
|
|
9179
|
+
};
|
|
9180
|
+
const footerContent = footer || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !noCancelBtn && /* @__PURE__ */ React__default.createElement(Button, {
|
|
9181
|
+
size: "small",
|
|
9182
|
+
plain: true,
|
|
9183
|
+
type: "primary",
|
|
9184
|
+
className: "nut-dialog__footer-cancel",
|
|
9185
|
+
onClick: (e2) => handleCancel(e2)
|
|
9186
|
+
}, cancelText || locale.cancel), !noOkBtn && /* @__PURE__ */ React__default.createElement(Button, {
|
|
9187
|
+
size: "small",
|
|
9188
|
+
type: "primary",
|
|
9189
|
+
className: classNames("nut-dialog__footer-ok", {
|
|
9190
|
+
disabled: okBtnDisabled
|
|
9191
|
+
}),
|
|
9192
|
+
disabled: okBtnDisabled,
|
|
9193
|
+
onClick: (e2) => handleOk(e2)
|
|
9194
|
+
}, okText || locale.confirm));
|
|
9195
|
+
return footerContent;
|
|
8939
9196
|
};
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
disabled: okBtnDisabled,
|
|
8953
|
-
onClick: (e2) => handleOk(e2)
|
|
8954
|
-
}, okText || locale.confirm));
|
|
8955
|
-
return footerContent;
|
|
8956
|
-
};
|
|
8957
|
-
return /* @__PURE__ */ React__default.createElement(DialogWrapper, {
|
|
8958
|
-
...restProps,
|
|
8959
|
-
visible,
|
|
8960
|
-
lockScroll,
|
|
8961
|
-
footer: renderFooter(),
|
|
8962
|
-
onClosed,
|
|
8963
|
-
onCancel
|
|
8964
|
-
});
|
|
8965
|
-
};
|
|
8966
|
-
const Dialog = forwardRef(BaseDialog);
|
|
8967
|
-
Dialog.defaultProps = defaultProps$H;
|
|
8968
|
-
Dialog.displayName = "NutDialog";
|
|
9197
|
+
return /* @__PURE__ */ React__default.createElement(DialogWrapper, {
|
|
9198
|
+
...restProps,
|
|
9199
|
+
visible,
|
|
9200
|
+
lockScroll,
|
|
9201
|
+
footer: renderFooter(),
|
|
9202
|
+
onClosed,
|
|
9203
|
+
onCancel
|
|
9204
|
+
});
|
|
9205
|
+
}
|
|
9206
|
+
);
|
|
9207
|
+
BaseDialog.defaultProps = defaultProps$H;
|
|
9208
|
+
BaseDialog.displayName = "NutDialog";
|
|
8969
9209
|
const defaultProps$G = {
|
|
8970
9210
|
attract: false,
|
|
8971
9211
|
direction: void 0,
|
|
@@ -14035,6 +14275,19 @@ const defaultProps$C = {
|
|
|
14035
14275
|
const Swipe = forwardRef((props, instanceRef) => {
|
|
14036
14276
|
const swipeBem = cn("swipe");
|
|
14037
14277
|
const touch = useTouch();
|
|
14278
|
+
useReady(() => {
|
|
14279
|
+
const getWidth = async () => {
|
|
14280
|
+
if (leftWrapper.current) {
|
|
14281
|
+
const leftRect = await getRectByTaro(leftWrapper.current);
|
|
14282
|
+
setActionWidth((v) => ({ ...v, left: leftRect.width }));
|
|
14283
|
+
}
|
|
14284
|
+
if (rightWrapper.current) {
|
|
14285
|
+
const rightRect = await getRectByTaro(rightWrapper.current);
|
|
14286
|
+
setActionWidth((v) => ({ ...v, right: rightRect.width }));
|
|
14287
|
+
}
|
|
14288
|
+
};
|
|
14289
|
+
nextTick(() => getWidth());
|
|
14290
|
+
});
|
|
14038
14291
|
const { children, className, style } = { ...defaultProps$C, ...props };
|
|
14039
14292
|
const root2 = useRef();
|
|
14040
14293
|
const opened = useRef(false);
|
|
@@ -14144,6 +14397,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
14144
14397
|
const renderActionContent = (side) => {
|
|
14145
14398
|
if (props[`${side}Action`]) {
|
|
14146
14399
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
14400
|
+
id: "left",
|
|
14147
14401
|
ref: side === "left" ? leftWrapper : rightWrapper,
|
|
14148
14402
|
className: `${swipeBem(side)}`,
|
|
14149
14403
|
onClick: (e2) => handleOperate(e2, side)
|
|
@@ -14780,6 +15034,7 @@ AvatarGroup.defaultProps = defaultProps$v;
|
|
|
14780
15034
|
AvatarGroup.displayName = "NutAvatarGroup";
|
|
14781
15035
|
const defaultProps$u = {
|
|
14782
15036
|
...ComponentDefaults,
|
|
15037
|
+
className: "",
|
|
14783
15038
|
value: "",
|
|
14784
15039
|
dot: false,
|
|
14785
15040
|
max: 1e4,
|
|
@@ -15623,12 +15878,14 @@ const Ellipsis = (props) => {
|
|
|
15623
15878
|
className: "nut-ellipsis-wordbreak"
|
|
15624
15879
|
}, (_a = ellipsis.current) == null ? void 0 : _a.leading, ((_b = ellipsis.current) == null ? void 0 : _b.leading) && symbol, expandText ? /* @__PURE__ */ React__default.createElement("span", {
|
|
15625
15880
|
className: "nut-ellipsis-text",
|
|
15626
|
-
onClick: () => {
|
|
15881
|
+
onClick: (e2) => {
|
|
15882
|
+
e2.stopPropagation();
|
|
15627
15883
|
clickHandle(1);
|
|
15628
15884
|
}
|
|
15629
15885
|
}, expandText) : null, ((_c = ellipsis.current) == null ? void 0 : _c.tailing) && symbol, (_d = ellipsis.current) == null ? void 0 : _d.tailing)) : null, exceeded && expanded ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, content, expandText ? /* @__PURE__ */ React__default.createElement("span", {
|
|
15630
15886
|
className: "nut-ellipsis-text",
|
|
15631
|
-
onClick: () => {
|
|
15887
|
+
onClick: (e2) => {
|
|
15888
|
+
e2.stopPropagation();
|
|
15632
15889
|
clickHandle(2);
|
|
15633
15890
|
}
|
|
15634
15891
|
}, collapseText) : null) : null)), /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -16990,7 +17247,7 @@ const Popover = (props) => {
|
|
|
16990
17247
|
style: getStyle()
|
|
16991
17248
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
16992
17249
|
className: `${popoverArrow}`
|
|
16993
|
-
}), Array.isArray(children) ? children[1] : "", list.map((item, i) => {
|
|
17250
|
+
}), Array.isArray(children) ? children[1] : "", /* @__PURE__ */ React__default.createElement("div", null, " ", list.map((item, i) => {
|
|
16994
17251
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
16995
17252
|
key: item.name,
|
|
16996
17253
|
className: `popover-menu-item ${item.disabled ? "disabled" : ""}`,
|
|
@@ -17005,7 +17262,7 @@ const Popover = (props) => {
|
|
|
17005
17262
|
}) : "", /* @__PURE__ */ React__default.createElement("div", {
|
|
17006
17263
|
className: "popover-menu-item-name"
|
|
17007
17264
|
}, item.name));
|
|
17008
|
-
})) : null))), visible ? /* @__PURE__ */ React__default.createElement(Overlay, {
|
|
17265
|
+
}))) : null))), visible ? /* @__PURE__ */ React__default.createElement(Overlay, {
|
|
17009
17266
|
visible,
|
|
17010
17267
|
onClick: (e2) => handleClick(e2),
|
|
17011
17268
|
style: { background: "transparent" }
|
|
@@ -18651,7 +18908,7 @@ const defaultProps$5 = {
|
|
|
18651
18908
|
barrageList: [],
|
|
18652
18909
|
frequency: 500,
|
|
18653
18910
|
loop: true,
|
|
18654
|
-
speeds:
|
|
18911
|
+
speeds: 3e3,
|
|
18655
18912
|
rows: 3,
|
|
18656
18913
|
top: 10
|
|
18657
18914
|
};
|
|
@@ -18669,49 +18926,65 @@ const InternalBarrage = (props, ref) => {
|
|
|
18669
18926
|
...defaultProps$5,
|
|
18670
18927
|
...props
|
|
18671
18928
|
};
|
|
18929
|
+
const [styleList, setStyleList] = useState([]);
|
|
18930
|
+
const [baItemList, setBaItemList] = useState(barrageList);
|
|
18931
|
+
const barrageListSet = useRef(barrageList);
|
|
18672
18932
|
const barrageBody = useRef(null);
|
|
18673
18933
|
const barrageContainer = useRef(null);
|
|
18934
|
+
const timeId = useRef(new Date().getTime());
|
|
18674
18935
|
const timer = useRef(0);
|
|
18675
|
-
|
|
18936
|
+
useRef(0);
|
|
18676
18937
|
const b2 = cn("barrage");
|
|
18677
|
-
const classes = classNames(className, b2("")
|
|
18938
|
+
const classes = classNames(className, b2(""), {
|
|
18939
|
+
[`nut-barrage__body${timeId.current}`]: true
|
|
18940
|
+
});
|
|
18678
18941
|
useImperativeHandle(ref, () => ({
|
|
18679
18942
|
add: (word) => {
|
|
18680
|
-
|
|
18681
|
-
|
|
18943
|
+
barrageListSet.current = [...barrageListSet.current, word];
|
|
18944
|
+
run();
|
|
18682
18945
|
}
|
|
18683
18946
|
}));
|
|
18684
18947
|
useEffect(() => {
|
|
18948
|
+
barrageListSet.current = [...barrageList];
|
|
18685
18949
|
run();
|
|
18686
18950
|
return () => {
|
|
18687
18951
|
clearInterval(timer.current);
|
|
18688
18952
|
};
|
|
18689
18953
|
}, [barrageList]);
|
|
18690
18954
|
const run = () => {
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
barrageContainer.current.appendChild(el);
|
|
18703
|
-
createSelectorQuery().select(".barrage-item").boundingClientRect((res) => {
|
|
18704
|
-
console.log("res", res);
|
|
18705
|
-
const height = res == null ? void 0 : res.height;
|
|
18706
|
-
el.classList.add("move");
|
|
18707
|
-
el.style.animationDuration = `${speeds}ms`;
|
|
18708
|
-
el.style.top = `${_index % rows * (height + top) + 20}px`;
|
|
18709
|
-
el.dataset.index = `${_index}`;
|
|
18710
|
-
el.addEventListener("animationend", () => {
|
|
18711
|
-
barrageContainer.current.removeChild(el);
|
|
18955
|
+
setBaItemList(barrageListSet.current);
|
|
18956
|
+
barrageListSet.current.forEach((item, index2) => {
|
|
18957
|
+
getNode(index2);
|
|
18958
|
+
});
|
|
18959
|
+
};
|
|
18960
|
+
const getNode = (index2) => {
|
|
18961
|
+
const query = createSelectorQuery();
|
|
18962
|
+
setTimeout(() => {
|
|
18963
|
+
let width = 100;
|
|
18964
|
+
query.select(".nut-barrage__body" + timeId.current).boundingClientRect((rec) => {
|
|
18965
|
+
width = rec.width || 300;
|
|
18712
18966
|
});
|
|
18713
|
-
|
|
18714
|
-
|
|
18967
|
+
query.select(".nut-barrage__item" + index2).boundingClientRect((recs) => {
|
|
18968
|
+
let height = recs.height;
|
|
18969
|
+
let nodeTop = index2 % rows * (height + top) + 20 + "px";
|
|
18970
|
+
styleInfo(index2, nodeTop, width);
|
|
18971
|
+
}).exec();
|
|
18972
|
+
}, 500);
|
|
18973
|
+
};
|
|
18974
|
+
const styleInfo = (index2, nodeTop, width) => {
|
|
18975
|
+
let timeIndex = index2 - rows > 0 ? index2 - rows : 0;
|
|
18976
|
+
let list = styleList;
|
|
18977
|
+
let time = list[timeIndex] ? Number(list[timeIndex]["--time"]) : 0;
|
|
18978
|
+
let obj = {
|
|
18979
|
+
top: nodeTop,
|
|
18980
|
+
"--time": `${frequency * index2 + time}`,
|
|
18981
|
+
animationDuration: `${speeds}ms`,
|
|
18982
|
+
animationIterationCount: `${loop2 ? "infinite" : 1}`,
|
|
18983
|
+
animationDelay: `${frequency * index2 + time}ms`,
|
|
18984
|
+
"--move-distance": `-${width}px`
|
|
18985
|
+
};
|
|
18986
|
+
list.push(obj);
|
|
18987
|
+
setStyleList([...list]);
|
|
18715
18988
|
};
|
|
18716
18989
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
18717
18990
|
className: classes,
|
|
@@ -18720,7 +18993,12 @@ const InternalBarrage = (props, ref) => {
|
|
|
18720
18993
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
18721
18994
|
ref: barrageContainer,
|
|
18722
18995
|
className: "bContainer"
|
|
18723
|
-
})
|
|
18996
|
+
}, baItemList.map((item, index2) => {
|
|
18997
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
18998
|
+
className: `barrage-item nut-barrage__item${index2} move`,
|
|
18999
|
+
style: styleList[index2]
|
|
19000
|
+
}, item.length > 8 ? item.substr(0, 8) + "..." : item);
|
|
19001
|
+
})));
|
|
18724
19002
|
};
|
|
18725
19003
|
const Barrage = React__default.forwardRef(InternalBarrage);
|
|
18726
19004
|
Barrage.defaultProps = defaultProps$5;
|
|
@@ -19175,4 +19453,4 @@ const TimeSelect = (props) => {
|
|
|
19175
19453
|
};
|
|
19176
19454
|
TimeSelect.defaultProps = defaultProps;
|
|
19177
19455
|
TimeSelect.displayName = "NutTimeSelect";
|
|
19178
|
-
export { ActionSheet, Address, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator, Ellipsis, Empty, FixedNav, Form, FormItem, Grid, GridItem, Icon$1 as Icon, Image$1 as Image, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, PullToRefresh, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, Sticky, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, TrendArrow, Uploader, Video, VirtualList, WaterMark };
|
|
19456
|
+
export { ActionSheet, Address, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, BaseDialog as Dialog, Divider, Drag, Elevator, Ellipsis, Empty, FixedNav, Form, FormItem, Grid, GridItem, Icon$1 as Icon, Image$1 as Image, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, PullToRefresh, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, Sticky, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, TrendArrow, Uploader, Video, VirtualList, WaterMark };
|