@nutui/nutui-react-taro 2.7.9 → 2.7.10
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 +13 -4
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Audio.js +1 -1
- package/dist/esm/AvatarCropper.js +1 -1
- package/dist/esm/BackTop.js +1 -1
- package/dist/esm/Badge.js +1 -1
- package/dist/esm/Calendar/style/index.js +3 -1
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +1 -1
- package/dist/esm/CalendarCard.js +1 -1
- package/dist/esm/CalendarItem.js +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/ConfigProvider.js +2 -2
- package/dist/esm/DatePicker.js +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/Ellipsis.js +1 -1
- package/dist/esm/FixedNav.js +1 -1
- package/dist/esm/InfiniteLoading.js +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/NumberKeyboard.js +1 -1
- package/dist/esm/Pagination.js +1 -1
- package/dist/esm/Picker.js +1 -1
- package/dist/esm/Popover.js +1 -1
- package/dist/esm/Progress.js +1 -1
- package/dist/esm/PullToRefresh.js +1 -1
- package/dist/esm/Range.js +1 -1
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword.js +1 -1
- package/dist/esm/Tabbar.js +1 -1
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/Table.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/TextArea.js +1 -1
- package/dist/esm/TimeSelect.js +1 -1
- package/dist/esm/Tour.js +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/WaterMark.js +1 -1
- package/dist/esm/{address.taro-Ck0ZmxRg.js → address.taro-BM2ZWeTm.js} +2 -2
- package/dist/esm/{audio.taro-DtIUjg89.js → audio.taro-C9DxpSXx.js} +2 -2
- package/dist/esm/{avatarcropper.taro-5JSFH7Q9.js → avatarcropper.taro-BsbRSHbo.js} +1 -1
- package/dist/esm/{backtop.taro-D3Lo3jFO.js → backtop.taro-Cj60ZYba.js} +1 -1
- package/dist/esm/{badge.taro-B42_7q8v.js → badge.taro-W8s89KAj.js} +1 -1
- package/dist/esm/calendar.taro-C-5Lmq9i.js +317 -0
- package/dist/esm/{calendarcard.taro-BiOnui_b.js → calendarcard.taro-Cp3yzc6h.js} +2 -2
- package/dist/esm/{calendaritem.taro-DveeC4_t.js → calendaritem.taro-B0QA0q4N.js} +208 -15
- package/dist/esm/{cascader.taro-DUJvcGw0.js → cascader.taro-Djw9IdKW.js} +2 -2
- package/dist/esm/{configprovider.taro-C3WyeHSO.js → configprovider.taro-DpK4IiCE.js} +4 -0
- package/dist/esm/date-C7eJqrqk.js +74 -0
- package/dist/esm/{datepicker.taro-Dwh8sKhJ.js → datepicker.taro-CPSTcVSz.js} +2 -2
- package/dist/esm/{dialog.taro-yjDaaRHA.js → dialog.taro-1Vukbvap.js} +1 -1
- package/dist/esm/{ellipsis.taro-K9VJCTL6.js → ellipsis.taro-rMWnB7Vp.js} +1 -1
- package/dist/esm/{fixednav.taro-BodErnYy.js → fixednav.taro-DlVXnggt.js} +1 -1
- package/dist/esm/{infiniteloading.taro-DzIrZvc0.js → infiniteloading.taro-6r-XMUlU.js} +1 -1
- package/dist/esm/{input.taro-CA9ZpM9a.js → input.taro-s1Zw62KR.js} +1 -1
- package/dist/esm/{noticebar.taro-B0qm66Cu.js → noticebar.taro-DjmvFSpp.js} +1 -1
- package/dist/esm/{numberkeyboard.taro-BvVO_MyJ.js → numberkeyboard.taro-blGUntGo.js} +1 -1
- package/dist/esm/nutui-react.es.js +35 -35
- package/dist/esm/{pagination.taro-BSwytb0-.js → pagination.taro-V57qqxwc.js} +1 -1
- package/dist/esm/{picker.taro-B7EE52qf.js → picker.taro-Ctc0Wt4S.js} +1 -1
- package/dist/esm/{popover.taro-C9qhPJCb.js → popover.taro-Da7xRN6D.js} +1 -1
- package/dist/esm/{progress.taro-CaIUT9Uo.js → progress.taro-cveY9Y_I.js} +1 -1
- package/dist/esm/{pulltorefresh.taro-DAFv7upo.js → pulltorefresh.taro-KKNiGe1Q.js} +1 -1
- package/dist/esm/{range.taro-Bbs4JcXp.js → range.taro-C5SuX_2b.js} +1 -1
- package/dist/esm/{searchbar.taro-LaO2Xr2t.js → searchbar.taro-BgwUn_Ma.js} +1 -1
- package/dist/esm/{shortpassword.taro-CUnXqjab.js → shortpassword.taro--atvsdZp.js} +1 -1
- package/dist/esm/{tabbar.taro-BiQDgZQF.js → tabbar.taro-BQpwulp5.js} +1 -1
- package/dist/esm/{tabbaritem.taro-BiIVucQz.js → tabbaritem.taro-BPe2bsMQ.js} +1 -1
- package/dist/esm/{table.taro-1nFkDxbh.js → table.taro-H3kjB4kV.js} +1 -1
- package/dist/esm/{tabs.taro-sp_DNWis.js → tabs.taro-Cb7JS_Gz.js} +6 -16
- package/dist/esm/{textarea.taro-PsaohYay.js → textarea.taro-CGMI5QNw.js} +1 -1
- package/dist/esm/{timeselect.taro-FIl91wiO.js → timeselect.taro-3Sc_hERv.js} +1 -1
- package/dist/esm/{tour.taro-BidQx8Fg.js → tour.taro-xqFUxSBB.js} +1 -1
- package/dist/esm/{uploader.taro-BBJsHrew.js → uploader.taro-DAWwySrs.js} +2 -2
- package/dist/esm/{watermark.taro-CbO7mKFD.js → watermark.taro-DuJQHymA.js} +1 -1
- package/dist/locales/base.d.ts +4 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +5 -1
- package/dist/locales/id-ID.js +5 -1
- package/dist/locales/tr-TR.js +5 -1
- package/dist/locales/zh-CN.js +5 -1
- package/dist/locales/zh-TW.js +5 -1
- package/dist/locales/zh-UG.js +5 -1
- package/dist/nutui.react.es.js +585 -131
- package/dist/nutui.react.umd.js +585 -131
- package/dist/packages/calendar/calendar.scss +24 -0
- package/dist/packages/calendar/calendarviewmode.scss +181 -0
- package/dist/style.css +1 -1
- package/dist/styles/variables.scss +4 -0
- package/dist/types/locales/base.d.ts +4 -0
- package/dist/types/packages/calendar/calendar.d.ts +4 -0
- package/dist/types/packages/calendar/calendar.taro.d.ts +4 -0
- package/dist/types/packages/calendar/calendarviewmodeitem.d.ts +20 -0
- package/dist/types/packages/calendar/calendarviewmodeitem.taro.d.ts +20 -0
- package/dist/types/packages/calendar/types.d.ts +27 -0
- package/dist/types/packages/calendar/utils.d.ts +40 -0
- package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -0
- package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -0
- package/dist/types/packages/calendaritem/utils.d.ts +17 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/utils/date.d.ts +0 -17
- package/package.json +1 -1
- package/dist/esm/calendar.taro-CUDVpJBa.js +0 -47
- package/dist/esm/date-BmUWlDuN.js +0 -147
package/dist/nutui.react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v2.7.
|
|
2
|
+
* @nutui/nutui-react-taro v2.7.10 Fri Mar 14 2025 14:50:54 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -264,7 +264,7 @@ const ComponentDefaults = {
|
|
|
264
264
|
style: {}
|
|
265
265
|
};
|
|
266
266
|
const prefixCls$2 = "nut-button";
|
|
267
|
-
const defaultProps$
|
|
267
|
+
const defaultProps$1v = {
|
|
268
268
|
...ComponentDefaults,
|
|
269
269
|
color: "",
|
|
270
270
|
type: "default",
|
|
@@ -299,7 +299,7 @@ const Button = React__default.forwardRef(
|
|
|
299
299
|
onClick,
|
|
300
300
|
...rest
|
|
301
301
|
} = {
|
|
302
|
-
...defaultProps$
|
|
302
|
+
...defaultProps$1v,
|
|
303
303
|
...props
|
|
304
304
|
};
|
|
305
305
|
const getStyle = useCallback(() => {
|
|
@@ -366,7 +366,7 @@ const Button = React__default.forwardRef(
|
|
|
366
366
|
);
|
|
367
367
|
Button.displayName = "NutButton";
|
|
368
368
|
const CellGroupContext = createContext(null);
|
|
369
|
-
const defaultProps$
|
|
369
|
+
const defaultProps$1u = {
|
|
370
370
|
...ComponentDefaults,
|
|
371
371
|
title: "",
|
|
372
372
|
description: "",
|
|
@@ -375,7 +375,7 @@ const defaultProps$1t = {
|
|
|
375
375
|
const classPrefix$r = "nut-cell-group";
|
|
376
376
|
const CellGroup = (props) => {
|
|
377
377
|
const { children, className, title, description, divider, ...rest } = {
|
|
378
|
-
...defaultProps$
|
|
378
|
+
...defaultProps$1u,
|
|
379
379
|
...props
|
|
380
380
|
};
|
|
381
381
|
return /* @__PURE__ */ React__default.createElement("div", { className: classNames(classPrefix$r, className), ...rest }, title ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$r}-title` }, title) : null, description ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$r}-description` }, description) : null, /* @__PURE__ */ React__default.createElement(
|
|
@@ -387,7 +387,7 @@ const CellGroup = (props) => {
|
|
|
387
387
|
));
|
|
388
388
|
};
|
|
389
389
|
CellGroup.displayName = "NutCellGroup";
|
|
390
|
-
const defaultProps$
|
|
390
|
+
const defaultProps$1t = {
|
|
391
391
|
...ComponentDefaults,
|
|
392
392
|
title: null,
|
|
393
393
|
description: null,
|
|
@@ -414,7 +414,7 @@ const Cell = (props) => {
|
|
|
414
414
|
clickable,
|
|
415
415
|
...rest
|
|
416
416
|
} = {
|
|
417
|
-
...defaultProps$
|
|
417
|
+
...defaultProps$1t,
|
|
418
418
|
...props
|
|
419
419
|
};
|
|
420
420
|
const handleClick = (event) => {
|
|
@@ -1382,7 +1382,7 @@ lodash_isequal.exports;
|
|
|
1382
1382
|
module.exports = isEqual2;
|
|
1383
1383
|
})(lodash_isequal, lodash_isequal.exports);
|
|
1384
1384
|
var lodash_isequalExports = lodash_isequal.exports;
|
|
1385
|
-
const
|
|
1385
|
+
const isEqual$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_isequalExports);
|
|
1386
1386
|
function useMemo(getValue2, condition, shouldUpdate) {
|
|
1387
1387
|
const cacheRef = React.useRef({});
|
|
1388
1388
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
@@ -1427,6 +1427,10 @@ const zhCN = {
|
|
|
1427
1427
|
start: "开始",
|
|
1428
1428
|
confirm: "确认",
|
|
1429
1429
|
title: "日历选择",
|
|
1430
|
+
week: "周",
|
|
1431
|
+
month: "月",
|
|
1432
|
+
year: "年",
|
|
1433
|
+
quarter: "季度",
|
|
1430
1434
|
monthTitle: (year, month) => `${year}年${Number(month) < 10 ? `0${Number(month)}` : month}月`,
|
|
1431
1435
|
today: "今天",
|
|
1432
1436
|
loadPreviousMonth: "加载上一个月",
|
|
@@ -1570,7 +1574,7 @@ const ConfigProvider = (props) => {
|
|
|
1570
1574
|
[config2, direction],
|
|
1571
1575
|
(prev, next) => prev.some((prevTheme, index) => {
|
|
1572
1576
|
const nextTheme = next[index];
|
|
1573
|
-
return !
|
|
1577
|
+
return !isEqual$1(prevTheme, nextTheme);
|
|
1574
1578
|
})
|
|
1575
1579
|
);
|
|
1576
1580
|
const cssVarStyle = React__default.useMemo(() => {
|
|
@@ -1593,7 +1597,7 @@ ConfigProvider.displayName = "NutConfigProvider";
|
|
|
1593
1597
|
const pxCheck = (value) => {
|
|
1594
1598
|
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
1595
1599
|
};
|
|
1596
|
-
const defaultProps$
|
|
1600
|
+
const defaultProps$1s = {
|
|
1597
1601
|
src: "",
|
|
1598
1602
|
error: true,
|
|
1599
1603
|
loading: true
|
|
@@ -1612,7 +1616,7 @@ const Image$1 = (props) => {
|
|
|
1612
1616
|
onLoad,
|
|
1613
1617
|
onError,
|
|
1614
1618
|
...rest
|
|
1615
|
-
} = { ...defaultProps$
|
|
1619
|
+
} = { ...defaultProps$1s, ...props };
|
|
1616
1620
|
const [innerLoading, setInnerLoading] = useState(true);
|
|
1617
1621
|
const [isError, setIsError] = useState(false);
|
|
1618
1622
|
const handleLoad = (e2) => {
|
|
@@ -3631,7 +3635,7 @@ const Overlay = (props) => {
|
|
|
3631
3635
|
};
|
|
3632
3636
|
Overlay.displayName = "NutOverlay";
|
|
3633
3637
|
const DataContext$1 = createContext({});
|
|
3634
|
-
const defaultProps$
|
|
3638
|
+
const defaultProps$1r = {
|
|
3635
3639
|
...ComponentDefaults,
|
|
3636
3640
|
span: "24",
|
|
3637
3641
|
offset: "0",
|
|
@@ -3639,7 +3643,7 @@ const defaultProps$1q = {
|
|
|
3639
3643
|
};
|
|
3640
3644
|
const Col = (props) => {
|
|
3641
3645
|
const { className, style, span, offset, children, onClick } = {
|
|
3642
|
-
...defaultProps$
|
|
3646
|
+
...defaultProps$1r,
|
|
3643
3647
|
...props
|
|
3644
3648
|
};
|
|
3645
3649
|
const [colName, setColName] = useState("");
|
|
@@ -3672,7 +3676,7 @@ const Col = (props) => {
|
|
|
3672
3676
|
);
|
|
3673
3677
|
};
|
|
3674
3678
|
Col.displayName = "NutCol";
|
|
3675
|
-
const defaultProps$
|
|
3679
|
+
const defaultProps$1q = {
|
|
3676
3680
|
...ComponentDefaults,
|
|
3677
3681
|
contentPosition: "center",
|
|
3678
3682
|
direction: "horizontal"
|
|
@@ -3680,7 +3684,7 @@ const defaultProps$1p = {
|
|
|
3680
3684
|
const classPrefix$o = `nut-divider`;
|
|
3681
3685
|
const Divider = (props) => {
|
|
3682
3686
|
const { children, contentPosition, style, className, direction, ...rest } = {
|
|
3683
|
-
...defaultProps$
|
|
3687
|
+
...defaultProps$1q,
|
|
3684
3688
|
...props
|
|
3685
3689
|
};
|
|
3686
3690
|
const classes = direction === "horizontal" ? classNames({
|
|
@@ -3701,7 +3705,7 @@ const gridContext = {
|
|
|
3701
3705
|
}
|
|
3702
3706
|
};
|
|
3703
3707
|
const GridContext = React__default.createContext(gridContext);
|
|
3704
|
-
const defaultProps$
|
|
3708
|
+
const defaultProps$1p = {
|
|
3705
3709
|
text: "",
|
|
3706
3710
|
columns: 4,
|
|
3707
3711
|
gap: 0,
|
|
@@ -3726,7 +3730,7 @@ const GridItem = (props) => {
|
|
|
3726
3730
|
onClick,
|
|
3727
3731
|
...rest
|
|
3728
3732
|
} = {
|
|
3729
|
-
...defaultProps$
|
|
3733
|
+
...defaultProps$1p,
|
|
3730
3734
|
...props
|
|
3731
3735
|
};
|
|
3732
3736
|
const classPrefix2 = "nut-grid-item";
|
|
@@ -3785,7 +3789,7 @@ const GridItem = (props) => {
|
|
|
3785
3789
|
);
|
|
3786
3790
|
};
|
|
3787
3791
|
GridItem.displayName = "NutGridItem";
|
|
3788
|
-
const defaultProps$
|
|
3792
|
+
const defaultProps$1o = {
|
|
3789
3793
|
columns: 4,
|
|
3790
3794
|
gap: 0,
|
|
3791
3795
|
center: true,
|
|
@@ -3806,7 +3810,7 @@ const Grid = (props) => {
|
|
|
3806
3810
|
className,
|
|
3807
3811
|
onClick,
|
|
3808
3812
|
...rest
|
|
3809
|
-
} = { ...defaultProps$
|
|
3813
|
+
} = { ...defaultProps$1o, ...props };
|
|
3810
3814
|
const childrenDom = React__default.Children.toArray(children);
|
|
3811
3815
|
const classPrefix2 = "nut-grid";
|
|
3812
3816
|
const rootClass = () => {
|
|
@@ -3847,7 +3851,7 @@ const Layout = () => {
|
|
|
3847
3851
|
};
|
|
3848
3852
|
Layout.displayName = "NutLayout";
|
|
3849
3853
|
const classPrefix$n = "nut-row";
|
|
3850
|
-
const defaultProps$
|
|
3854
|
+
const defaultProps$1n = {
|
|
3851
3855
|
...ComponentDefaults,
|
|
3852
3856
|
type: "",
|
|
3853
3857
|
justify: "start",
|
|
@@ -3867,7 +3871,7 @@ const Row = (props) => {
|
|
|
3867
3871
|
gutter,
|
|
3868
3872
|
onClick
|
|
3869
3873
|
} = {
|
|
3870
|
-
...defaultProps$
|
|
3874
|
+
...defaultProps$1n,
|
|
3871
3875
|
...props
|
|
3872
3876
|
};
|
|
3873
3877
|
const getClass = (prefix, type22) => {
|
|
@@ -3901,12 +3905,12 @@ const Row = (props) => {
|
|
|
3901
3905
|
};
|
|
3902
3906
|
Row.displayName = "NutRow";
|
|
3903
3907
|
const prefixCls$1 = "nut-space";
|
|
3904
|
-
const defaultProps$
|
|
3908
|
+
const defaultProps$1m = {
|
|
3905
3909
|
direction: "horizontal"
|
|
3906
3910
|
};
|
|
3907
3911
|
const Space = (props) => {
|
|
3908
3912
|
const { className, style, children, wrap, align, direction, justify } = {
|
|
3909
|
-
...defaultProps$
|
|
3913
|
+
...defaultProps$1m,
|
|
3910
3914
|
...props
|
|
3911
3915
|
};
|
|
3912
3916
|
const cls = classNames(
|
|
@@ -4041,7 +4045,7 @@ const getRectByTaro = async (element) => {
|
|
|
4041
4045
|
}
|
|
4042
4046
|
return Promise.resolve(makeRect(0, 0));
|
|
4043
4047
|
};
|
|
4044
|
-
const defaultProps$
|
|
4048
|
+
const defaultProps$1l = {
|
|
4045
4049
|
...ComponentDefaults,
|
|
4046
4050
|
position: "top",
|
|
4047
4051
|
zIndex: 900
|
|
@@ -4058,7 +4062,7 @@ const Sticky = (props) => {
|
|
|
4058
4062
|
className,
|
|
4059
4063
|
onChange,
|
|
4060
4064
|
...rest
|
|
4061
|
-
} = { ...defaultProps$
|
|
4065
|
+
} = { ...defaultProps$1l, ...props };
|
|
4062
4066
|
const stickyRef = useRef(null);
|
|
4063
4067
|
const rootRef = useRef(null);
|
|
4064
4068
|
const [rootRect, setRootRect] = useState({});
|
|
@@ -4182,7 +4186,7 @@ const SafeArea = (props) => {
|
|
|
4182
4186
|
);
|
|
4183
4187
|
};
|
|
4184
4188
|
SafeArea.displayName = "NutSafeArea";
|
|
4185
|
-
const defaultProps$
|
|
4189
|
+
const defaultProps$1k = {
|
|
4186
4190
|
...ComponentDefaults,
|
|
4187
4191
|
threshold: 200,
|
|
4188
4192
|
zIndex: 900,
|
|
@@ -4191,7 +4195,7 @@ const defaultProps$1j = {
|
|
|
4191
4195
|
const BackTop = (props) => {
|
|
4192
4196
|
const rtl = useRtl();
|
|
4193
4197
|
const { children, threshold, zIndex, className, duration, style, onClick } = {
|
|
4194
|
-
...defaultProps$
|
|
4198
|
+
...defaultProps$1k,
|
|
4195
4199
|
...props
|
|
4196
4200
|
};
|
|
4197
4201
|
const classPrefix2 = "nut-backtop";
|
|
@@ -4239,7 +4243,7 @@ function useUuid() {
|
|
|
4239
4243
|
return idRef.current;
|
|
4240
4244
|
}
|
|
4241
4245
|
const elevatorContext = createContext({});
|
|
4242
|
-
const defaultProps$
|
|
4246
|
+
const defaultProps$1j = {
|
|
4243
4247
|
...ComponentDefaults,
|
|
4244
4248
|
height: "200px",
|
|
4245
4249
|
floorKey: "title",
|
|
@@ -4266,7 +4270,7 @@ const Elevator = (props) => {
|
|
|
4266
4270
|
children,
|
|
4267
4271
|
...rest
|
|
4268
4272
|
} = {
|
|
4269
|
-
...defaultProps$
|
|
4273
|
+
...defaultProps$1j,
|
|
4270
4274
|
...props
|
|
4271
4275
|
};
|
|
4272
4276
|
const uuid = useUuid();
|
|
@@ -4492,7 +4496,7 @@ const Elevator = (props) => {
|
|
|
4492
4496
|
};
|
|
4493
4497
|
Elevator.displayName = "NutElevator";
|
|
4494
4498
|
Elevator.Context = elevatorContext;
|
|
4495
|
-
const defaultProps$
|
|
4499
|
+
const defaultProps$1i = {
|
|
4496
4500
|
...ComponentDefaults,
|
|
4497
4501
|
activeText: "",
|
|
4498
4502
|
inactiveText: "",
|
|
@@ -4520,7 +4524,7 @@ const FixedNav = (props) => {
|
|
|
4520
4524
|
content,
|
|
4521
4525
|
...rest
|
|
4522
4526
|
} = {
|
|
4523
|
-
...defaultProps$
|
|
4527
|
+
...defaultProps$1i,
|
|
4524
4528
|
...props
|
|
4525
4529
|
};
|
|
4526
4530
|
const classPrefix2 = "nut-fixednav";
|
|
@@ -4573,7 +4577,7 @@ const FixedNav = (props) => {
|
|
|
4573
4577
|
);
|
|
4574
4578
|
};
|
|
4575
4579
|
FixedNav.displayName = "NutFixedNav";
|
|
4576
|
-
const defaultProps$
|
|
4580
|
+
const defaultProps$1h = {
|
|
4577
4581
|
...ComponentDefaults,
|
|
4578
4582
|
left: "",
|
|
4579
4583
|
right: "",
|
|
@@ -4598,7 +4602,7 @@ const NavBar = (props) => {
|
|
|
4598
4602
|
zIndex,
|
|
4599
4603
|
onBackClick
|
|
4600
4604
|
} = {
|
|
4601
|
-
...defaultProps$
|
|
4605
|
+
...defaultProps$1h,
|
|
4602
4606
|
...props
|
|
4603
4607
|
};
|
|
4604
4608
|
const classPrefix2 = "nut-navbar";
|
|
@@ -4676,7 +4680,7 @@ const NavBar = (props) => {
|
|
|
4676
4680
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React__default.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4677
4681
|
};
|
|
4678
4682
|
NavBar.displayName = "NutNavBar";
|
|
4679
|
-
const defaultProps$
|
|
4683
|
+
const defaultProps$1g = {
|
|
4680
4684
|
...ComponentDefaults,
|
|
4681
4685
|
position: "center",
|
|
4682
4686
|
transition: "",
|
|
@@ -4729,7 +4733,7 @@ const Popup = (props) => {
|
|
|
4729
4733
|
afterShow,
|
|
4730
4734
|
afterClose,
|
|
4731
4735
|
onClick
|
|
4732
|
-
} = { ...defaultProps$
|
|
4736
|
+
} = { ...defaultProps$1g, ...props };
|
|
4733
4737
|
let innerIndex = zIndex || _zIndex;
|
|
4734
4738
|
const [index, setIndex] = useState(innerIndex);
|
|
4735
4739
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
@@ -4872,7 +4876,7 @@ const Popup = (props) => {
|
|
|
4872
4876
|
};
|
|
4873
4877
|
Popup.displayName = "NutPopup";
|
|
4874
4878
|
const OffsetContext = createContext(20);
|
|
4875
|
-
const defaultProps$
|
|
4879
|
+
const defaultProps$1f = {
|
|
4876
4880
|
...ComponentDefaults,
|
|
4877
4881
|
position: "left",
|
|
4878
4882
|
width: "80%"
|
|
@@ -4890,7 +4894,7 @@ const SideNavBar = (props) => {
|
|
|
4890
4894
|
indent,
|
|
4891
4895
|
...rest
|
|
4892
4896
|
} = {
|
|
4893
|
-
...defaultProps$
|
|
4897
|
+
...defaultProps$1f,
|
|
4894
4898
|
...props
|
|
4895
4899
|
};
|
|
4896
4900
|
const innerIndent = indent ? Number(indent) : 20;
|
|
@@ -4948,13 +4952,13 @@ const SideNavBarItem = (props) => {
|
|
|
4948
4952
|
title
|
|
4949
4953
|
);
|
|
4950
4954
|
};
|
|
4951
|
-
const defaultProps$
|
|
4955
|
+
const defaultProps$1e = {
|
|
4952
4956
|
open: true
|
|
4953
4957
|
};
|
|
4954
4958
|
const SubSideNavBar = (props) => {
|
|
4955
4959
|
const classPrefix2 = "nut-subsidenavbar";
|
|
4956
4960
|
const { title, value, children, onClick, open: open2, ...rest } = {
|
|
4957
|
-
...defaultProps$
|
|
4961
|
+
...defaultProps$1e,
|
|
4958
4962
|
...props
|
|
4959
4963
|
};
|
|
4960
4964
|
const [subShow, setSubShow] = useState(open2);
|
|
@@ -5032,7 +5036,7 @@ function usePropsValue({
|
|
|
5032
5036
|
);
|
|
5033
5037
|
return [stateRef.current, setState];
|
|
5034
5038
|
}
|
|
5035
|
-
const defaultProps$
|
|
5039
|
+
const defaultProps$1d = {
|
|
5036
5040
|
...ComponentDefaults,
|
|
5037
5041
|
value: "",
|
|
5038
5042
|
dot: false,
|
|
@@ -5057,7 +5061,7 @@ const Badge = (props) => {
|
|
|
5057
5061
|
color,
|
|
5058
5062
|
fill
|
|
5059
5063
|
} = {
|
|
5060
|
-
...defaultProps$
|
|
5064
|
+
...defaultProps$1d,
|
|
5061
5065
|
...props
|
|
5062
5066
|
};
|
|
5063
5067
|
const classPrefix2 = "nut-badge";
|
|
@@ -5111,7 +5115,7 @@ const Badge = (props) => {
|
|
|
5111
5115
|
};
|
|
5112
5116
|
Badge.displayName = "NutBadge";
|
|
5113
5117
|
const TabbarContext = React__default.createContext(null);
|
|
5114
|
-
const defaultProps$
|
|
5118
|
+
const defaultProps$1c = {
|
|
5115
5119
|
...ComponentDefaults,
|
|
5116
5120
|
title: "",
|
|
5117
5121
|
icon: null,
|
|
@@ -5137,7 +5141,7 @@ const TabbarItem = (props) => {
|
|
|
5137
5141
|
index,
|
|
5138
5142
|
...rest
|
|
5139
5143
|
} = {
|
|
5140
|
-
...defaultProps$
|
|
5144
|
+
...defaultProps$1c,
|
|
5141
5145
|
...props
|
|
5142
5146
|
};
|
|
5143
5147
|
const active = index === (ctx == null ? void 0 : ctx.selectIndex);
|
|
@@ -5175,7 +5179,7 @@ const TabbarItem = (props) => {
|
|
|
5175
5179
|
icon ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React__default.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React__default.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React__default.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React__default.createElement("div", { className: titleClass }, title))
|
|
5176
5180
|
);
|
|
5177
5181
|
};
|
|
5178
|
-
const defaultProps$
|
|
5182
|
+
const defaultProps$1b = {
|
|
5179
5183
|
...ComponentDefaults,
|
|
5180
5184
|
defaultValue: 0,
|
|
5181
5185
|
fixed: false,
|
|
@@ -5198,7 +5202,7 @@ const Tabbar = (props) => {
|
|
|
5198
5202
|
style,
|
|
5199
5203
|
onSwitch
|
|
5200
5204
|
} = {
|
|
5201
|
-
...defaultProps$
|
|
5205
|
+
...defaultProps$1b,
|
|
5202
5206
|
...props
|
|
5203
5207
|
};
|
|
5204
5208
|
const classPrefix2 = "nut-tabbar";
|
|
@@ -5240,14 +5244,14 @@ const Tabbar = (props) => {
|
|
|
5240
5244
|
};
|
|
5241
5245
|
Tabbar.displayName = "NutTabbar";
|
|
5242
5246
|
Tabbar.Item = TabbarItem;
|
|
5243
|
-
const defaultProps$
|
|
5247
|
+
const defaultProps$1a = {
|
|
5244
5248
|
title: "",
|
|
5245
5249
|
value: "",
|
|
5246
5250
|
disabled: false
|
|
5247
5251
|
};
|
|
5248
5252
|
const TabPane = (props) => {
|
|
5249
5253
|
const { children, autoHeightClassName, className, disabled } = {
|
|
5250
|
-
...defaultProps$
|
|
5254
|
+
...defaultProps$1a,
|
|
5251
5255
|
...props
|
|
5252
5256
|
};
|
|
5253
5257
|
const classPrefix2 = "nut-tabpane";
|
|
@@ -5274,7 +5278,7 @@ function requestAniFrame() {
|
|
|
5274
5278
|
};
|
|
5275
5279
|
}
|
|
5276
5280
|
const requestAniFrame$1 = requestAniFrame();
|
|
5277
|
-
const defaultProps$
|
|
5281
|
+
const defaultProps$19 = {
|
|
5278
5282
|
...ComponentDefaults,
|
|
5279
5283
|
tabStyle: {},
|
|
5280
5284
|
activeColor: "",
|
|
@@ -5303,7 +5307,7 @@ const Tabs = (props) => {
|
|
|
5303
5307
|
value: outerValue,
|
|
5304
5308
|
defaultValue: outerDefaultValue,
|
|
5305
5309
|
...rest
|
|
5306
|
-
} = { ...defaultProps$
|
|
5310
|
+
} = { ...defaultProps$19, ...props };
|
|
5307
5311
|
const uuid = useUuid();
|
|
5308
5312
|
const [value, setValue] = usePropsValue({
|
|
5309
5313
|
value: outerValue,
|
|
@@ -5370,14 +5374,8 @@ const Tabs = (props) => {
|
|
|
5370
5374
|
const [scrollLeft, setScrollLeft] = useState(0);
|
|
5371
5375
|
const [scrollTop, setScrollTop] = useState(0);
|
|
5372
5376
|
const scrollDirection = (to, direction2) => {
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
function animate() {
|
|
5376
|
-
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5377
|
-
else setScrollTop(to);
|
|
5378
|
-
if (++count < frames) requestAniFrame$1(animate);
|
|
5379
|
-
}
|
|
5380
|
-
animate();
|
|
5377
|
+
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5378
|
+
else setScrollTop(to);
|
|
5381
5379
|
};
|
|
5382
5380
|
const scrollIntoView = (index) => {
|
|
5383
5381
|
requestAniFrame$1(() => {
|
|
@@ -5394,13 +5392,11 @@ const Tabs = (props) => {
|
|
|
5394
5392
|
} else {
|
|
5395
5393
|
const left2 = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
|
|
5396
5394
|
to = left2 - (navRect.width - titleRect.width) / 2;
|
|
5397
|
-
if (to < 0) return;
|
|
5398
|
-
to = rtl ? -to : to;
|
|
5399
5395
|
}
|
|
5396
|
+
scrollDirection(to, direction);
|
|
5400
5397
|
nextTick(() => {
|
|
5401
5398
|
scrollWithAnimation.current = true;
|
|
5402
5399
|
});
|
|
5403
|
-
scrollDirection(to, direction);
|
|
5404
5400
|
});
|
|
5405
5401
|
});
|
|
5406
5402
|
};
|
|
@@ -5493,7 +5489,7 @@ const Tabs = (props) => {
|
|
|
5493
5489
|
};
|
|
5494
5490
|
Tabs.displayName = "NutTabs";
|
|
5495
5491
|
Tabs.TabPane = TabPane;
|
|
5496
|
-
const defaultProps$
|
|
5492
|
+
const defaultProps$18 = {
|
|
5497
5493
|
type: "custom",
|
|
5498
5494
|
existList: [],
|
|
5499
5495
|
defaultIcon: null,
|
|
@@ -5512,7 +5508,7 @@ const ExistRender = (props) => {
|
|
|
5512
5508
|
onSelect,
|
|
5513
5509
|
onSwitch,
|
|
5514
5510
|
...rest
|
|
5515
|
-
} = { ...defaultProps$
|
|
5511
|
+
} = { ...defaultProps$18, ...props };
|
|
5516
5512
|
const classPrefix2 = "nut-address";
|
|
5517
5513
|
const selectedExist = (item) => {
|
|
5518
5514
|
existList.forEach((list, index) => {
|
|
@@ -5674,7 +5670,7 @@ class Tree {
|
|
|
5674
5670
|
return pathNodes;
|
|
5675
5671
|
}
|
|
5676
5672
|
}
|
|
5677
|
-
const defaultProps$
|
|
5673
|
+
const defaultProps$17 = {
|
|
5678
5674
|
...ComponentDefaults,
|
|
5679
5675
|
activeColor: "",
|
|
5680
5676
|
activeIcon: "checklist",
|
|
@@ -5720,7 +5716,7 @@ const InternalCascader = (props, ref) => {
|
|
|
5720
5716
|
onClose,
|
|
5721
5717
|
onChange,
|
|
5722
5718
|
onPathChange
|
|
5723
|
-
} = { ...defaultProps$
|
|
5719
|
+
} = { ...defaultProps$17, ...props };
|
|
5724
5720
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
5725
5721
|
const [optionsData, setOptionsData] = useState([]);
|
|
5726
5722
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
@@ -6031,7 +6027,7 @@ const InternalCascader = (props, ref) => {
|
|
|
6031
6027
|
};
|
|
6032
6028
|
const Cascader = React__default.forwardRef(InternalCascader);
|
|
6033
6029
|
Cascader.displayName = "NutCascader";
|
|
6034
|
-
const defaultProps$
|
|
6030
|
+
const defaultProps$16 = {
|
|
6035
6031
|
...ComponentDefaults,
|
|
6036
6032
|
visible: false,
|
|
6037
6033
|
type: "custom",
|
|
@@ -6058,7 +6054,7 @@ const CustomRender = (props) => {
|
|
|
6058
6054
|
onPathChange,
|
|
6059
6055
|
...rest
|
|
6060
6056
|
} = {
|
|
6061
|
-
...defaultProps$
|
|
6057
|
+
...defaultProps$16,
|
|
6062
6058
|
...props
|
|
6063
6059
|
};
|
|
6064
6060
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, type4 === "custom" && /* @__PURE__ */ React__default.createElement(
|
|
@@ -6083,7 +6079,7 @@ const CustomRender = (props) => {
|
|
|
6083
6079
|
}
|
|
6084
6080
|
));
|
|
6085
6081
|
};
|
|
6086
|
-
const defaultProps$
|
|
6082
|
+
const defaultProps$15 = {
|
|
6087
6083
|
...ComponentDefaults,
|
|
6088
6084
|
defaultValue: [],
|
|
6089
6085
|
type: "custom",
|
|
@@ -6125,7 +6121,7 @@ const InternalAddress = (props, ref) => {
|
|
|
6125
6121
|
onSwitch,
|
|
6126
6122
|
...rest
|
|
6127
6123
|
} = {
|
|
6128
|
-
...defaultProps$
|
|
6124
|
+
...defaultProps$15,
|
|
6129
6125
|
...props
|
|
6130
6126
|
};
|
|
6131
6127
|
const classPrefix2 = "nut-address";
|
|
@@ -6282,33 +6278,6 @@ const isEqual = (date1, date22) => {
|
|
|
6282
6278
|
const endTime = new Date(date22.replace(/-/g, "/")).getTime();
|
|
6283
6279
|
return startTime === endTime;
|
|
6284
6280
|
};
|
|
6285
|
-
const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
|
|
6286
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
|
|
6287
|
-
const nowTime = dateNow.getTime();
|
|
6288
|
-
let day = dateNow.getDay();
|
|
6289
|
-
if (firstDayOfWeek === 0) {
|
|
6290
|
-
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
6291
|
-
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
6292
|
-
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
6293
|
-
const sunday2 = date2Str(new Date(SundayTime2));
|
|
6294
|
-
const saturday = date2Str(new Date(SaturdayTime));
|
|
6295
|
-
return [sunday2, saturday];
|
|
6296
|
-
}
|
|
6297
|
-
day = day === 0 ? 7 : day;
|
|
6298
|
-
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
6299
|
-
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
6300
|
-
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
6301
|
-
const monday = date2Str(new Date(MondayTime));
|
|
6302
|
-
const sunday = date2Str(new Date(SundayTime));
|
|
6303
|
-
return [monday, sunday];
|
|
6304
|
-
};
|
|
6305
|
-
const formatResultDate = (date4) => {
|
|
6306
|
-
const [year, month, day] = [...date4.split("-")];
|
|
6307
|
-
const formatterDay = getNumTwoBit(Number(day));
|
|
6308
|
-
const formatterDate = `${year}-${month}-${day}`;
|
|
6309
|
-
const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
|
|
6310
|
-
return [year, month, formatterDay, formatterDate, dayOfWeek];
|
|
6311
|
-
};
|
|
6312
6281
|
const getCurrMonthData = (type4, year, month) => {
|
|
6313
6282
|
{
|
|
6314
6283
|
month === 12 && (year += 1);
|
|
@@ -6350,6 +6319,74 @@ const getPreMonthDates = (type4, year, month, firstDayOfWeek) => {
|
|
|
6350
6319
|
});
|
|
6351
6320
|
return months.slice(preDates - days);
|
|
6352
6321
|
};
|
|
6322
|
+
const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
|
|
6323
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
|
|
6324
|
+
const nowTime = dateNow.getTime();
|
|
6325
|
+
let day = dateNow.getDay();
|
|
6326
|
+
if (firstDayOfWeek === 0) {
|
|
6327
|
+
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
6328
|
+
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
6329
|
+
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
6330
|
+
const sunday2 = date2Str(new Date(SundayTime2));
|
|
6331
|
+
const saturday = date2Str(new Date(SaturdayTime));
|
|
6332
|
+
return [sunday2, saturday];
|
|
6333
|
+
}
|
|
6334
|
+
day = day === 0 ? 7 : day;
|
|
6335
|
+
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
6336
|
+
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
6337
|
+
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
6338
|
+
const monday = date2Str(new Date(MondayTime));
|
|
6339
|
+
const sunday = date2Str(new Date(SundayTime));
|
|
6340
|
+
return [monday, sunday];
|
|
6341
|
+
};
|
|
6342
|
+
const formatResultDate = (date4) => {
|
|
6343
|
+
const [year, month, day] = [...date4.split("-")];
|
|
6344
|
+
const formatterDay = getNumTwoBit(Number(day));
|
|
6345
|
+
const formatterDate = `${year}-${month}-${day}`;
|
|
6346
|
+
const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
|
|
6347
|
+
return [year, month, formatterDay, formatterDate, dayOfWeek];
|
|
6348
|
+
};
|
|
6349
|
+
const getWeekOfYearByYMD = (year, month, date4, firstDayOfWeek = 0) => {
|
|
6350
|
+
const MILLISECONDS_PER_DAY = 864e5;
|
|
6351
|
+
const dateNow = new Date(year, month - 1, date4);
|
|
6352
|
+
const dateFirst = new Date(year, 0, 1);
|
|
6353
|
+
const dayOfYear = Math.round(
|
|
6354
|
+
(dateNow.valueOf() - dateFirst.valueOf()) / MILLISECONDS_PER_DAY
|
|
6355
|
+
);
|
|
6356
|
+
const DAYS_OF_FIRST_WEEK = 3;
|
|
6357
|
+
let dayOfWeek = dateNow.getDay();
|
|
6358
|
+
let remainder = 6 - dayOfWeek - DAYS_OF_FIRST_WEEK;
|
|
6359
|
+
if (firstDayOfWeek !== 0) {
|
|
6360
|
+
dayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
6361
|
+
remainder = 7 - dayOfWeek - DAYS_OF_FIRST_WEEK;
|
|
6362
|
+
}
|
|
6363
|
+
let weekNo = Math.ceil((dayOfYear + remainder + 1) / 7);
|
|
6364
|
+
if (weekNo === 0) {
|
|
6365
|
+
weekNo = getWeekOfYearByYMD(year - 1, 12, 31, firstDayOfWeek);
|
|
6366
|
+
} else if (weekNo === 53) {
|
|
6367
|
+
const remainder2 = 7 - dayOfWeek - DAYS_OF_FIRST_WEEK;
|
|
6368
|
+
weekNo = remainder2 > 0 ? 1 : weekNo;
|
|
6369
|
+
}
|
|
6370
|
+
return weekNo;
|
|
6371
|
+
};
|
|
6372
|
+
const getWeekNosOfYear = (year, month, firstDayOfWeek) => {
|
|
6373
|
+
const startWeekNo = getWeekOfYearByYMD(year, month, 1, firstDayOfWeek);
|
|
6374
|
+
const endWeekNo = getWeekOfYearByYMD(
|
|
6375
|
+
year,
|
|
6376
|
+
month,
|
|
6377
|
+
getMonthDays(`${year}`, `${month}`),
|
|
6378
|
+
firstDayOfWeek
|
|
6379
|
+
);
|
|
6380
|
+
return Array.from(
|
|
6381
|
+
{
|
|
6382
|
+
length: (endWeekNo === 1 ? 53 : endWeekNo) - (startWeekNo === 53 || startWeekNo === 52 ? 0 : startWeekNo) + 1
|
|
6383
|
+
},
|
|
6384
|
+
(_, i2) => {
|
|
6385
|
+
const lastIndex = (endWeekNo === 1 ? 53 : endWeekNo) - startWeekNo;
|
|
6386
|
+
return `${endWeekNo === 1 && i2 === lastIndex ? 1 : ((startWeekNo === 53 || startWeekNo === 52) && i2 !== 0 ? 0 : startWeekNo) + i2}`;
|
|
6387
|
+
}
|
|
6388
|
+
);
|
|
6389
|
+
};
|
|
6353
6390
|
const splitDate = (date4) => {
|
|
6354
6391
|
const split = date4.indexOf("-") !== -1 ? "-" : "/";
|
|
6355
6392
|
return date4.split(split);
|
|
@@ -6378,7 +6415,89 @@ const isEnd = (day, days) => {
|
|
|
6378
6415
|
const isStartAndEnd = (days) => {
|
|
6379
6416
|
return days.length >= 2 && isEqual(days[0], days[1]);
|
|
6380
6417
|
};
|
|
6381
|
-
const
|
|
6418
|
+
const getPreMonths = (type4, year, month) => {
|
|
6419
|
+
const preMonth = +month - 1;
|
|
6420
|
+
const months = Array.from(Array(preMonth), (v, k) => {
|
|
6421
|
+
return {
|
|
6422
|
+
year,
|
|
6423
|
+
month: k + 1,
|
|
6424
|
+
yearAndMonth: formatMonth(year, k + 1),
|
|
6425
|
+
type: type4
|
|
6426
|
+
};
|
|
6427
|
+
});
|
|
6428
|
+
return months;
|
|
6429
|
+
};
|
|
6430
|
+
const getMonths = (type4, year, month, endMonth = 12) => {
|
|
6431
|
+
const nextMonth = endMonth - month + 1;
|
|
6432
|
+
const months = Array.from(Array(nextMonth), (v, k) => {
|
|
6433
|
+
return {
|
|
6434
|
+
year,
|
|
6435
|
+
month: k + month,
|
|
6436
|
+
yearAndMonth: formatMonth(year, k + month),
|
|
6437
|
+
type: type4
|
|
6438
|
+
};
|
|
6439
|
+
});
|
|
6440
|
+
return months;
|
|
6441
|
+
};
|
|
6442
|
+
const formatMonth = (year, month) => {
|
|
6443
|
+
return `${year}-${String(month).padStart(2, "0")}`;
|
|
6444
|
+
};
|
|
6445
|
+
const formatQuarter = (year, quarter) => {
|
|
6446
|
+
return `${year}-Q${quarter}`;
|
|
6447
|
+
};
|
|
6448
|
+
const getQuarter = (month) => {
|
|
6449
|
+
if (month < 1 || month > 12) {
|
|
6450
|
+
throw new Error("月份必须在 1 到 12 之间");
|
|
6451
|
+
}
|
|
6452
|
+
const quarter = Math.floor((month - 1) / 3) + 1;
|
|
6453
|
+
return quarter;
|
|
6454
|
+
};
|
|
6455
|
+
const getQuarters = (type4, year, month, endMonth = 12) => {
|
|
6456
|
+
const quarters = [];
|
|
6457
|
+
const startIndex = month;
|
|
6458
|
+
const endIndex = endMonth;
|
|
6459
|
+
for (let index = startIndex; index <= endIndex; index += 3) {
|
|
6460
|
+
const quarter = getQuarter(index);
|
|
6461
|
+
quarters.push({
|
|
6462
|
+
year,
|
|
6463
|
+
quarter,
|
|
6464
|
+
yearAndQuarter: formatQuarter(year, quarter),
|
|
6465
|
+
type: type4
|
|
6466
|
+
});
|
|
6467
|
+
}
|
|
6468
|
+
return quarters;
|
|
6469
|
+
};
|
|
6470
|
+
const getPreQuarters = (type4, year, month) => {
|
|
6471
|
+
const quarters = [];
|
|
6472
|
+
const startIndex = 1;
|
|
6473
|
+
const endIndex = month - 3;
|
|
6474
|
+
for (let index = startIndex; index <= endIndex; index += 3) {
|
|
6475
|
+
const quarter = getQuarter(index);
|
|
6476
|
+
quarters.push({
|
|
6477
|
+
year,
|
|
6478
|
+
quarter,
|
|
6479
|
+
yearAndQuarter: formatQuarter(year, quarter),
|
|
6480
|
+
type: type4
|
|
6481
|
+
});
|
|
6482
|
+
}
|
|
6483
|
+
return quarters;
|
|
6484
|
+
};
|
|
6485
|
+
const getNextQuarters = (type4, year, month, endMonth = 12) => {
|
|
6486
|
+
const quarters = [];
|
|
6487
|
+
const startIndex = month + 3;
|
|
6488
|
+
const endIndex = endMonth;
|
|
6489
|
+
for (let index = startIndex; index <= endIndex; index += 3) {
|
|
6490
|
+
const quarter = getQuarter(index);
|
|
6491
|
+
quarters.push({
|
|
6492
|
+
year,
|
|
6493
|
+
quarter,
|
|
6494
|
+
yearAndQuarter: formatQuarter(year, quarter),
|
|
6495
|
+
type: type4
|
|
6496
|
+
});
|
|
6497
|
+
}
|
|
6498
|
+
return quarters;
|
|
6499
|
+
};
|
|
6500
|
+
const defaultProps$14 = {
|
|
6382
6501
|
...ComponentDefaults,
|
|
6383
6502
|
type: "single",
|
|
6384
6503
|
autoBackfill: false,
|
|
@@ -6392,6 +6511,7 @@ const defaultProps$13 = {
|
|
|
6392
6511
|
confirmText: "",
|
|
6393
6512
|
showTitle: true,
|
|
6394
6513
|
showSubTitle: true,
|
|
6514
|
+
showMonthNumber: false,
|
|
6395
6515
|
scrollAnimation: true,
|
|
6396
6516
|
firstDayOfWeek: 0,
|
|
6397
6517
|
disableDate: (date4) => false,
|
|
@@ -6428,19 +6548,20 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6428
6548
|
confirmText,
|
|
6429
6549
|
showTitle,
|
|
6430
6550
|
showSubTitle,
|
|
6551
|
+
showMonthNumber,
|
|
6431
6552
|
scrollAnimation,
|
|
6432
6553
|
firstDayOfWeek,
|
|
6433
6554
|
disableDate,
|
|
6434
6555
|
renderHeaderButtons,
|
|
6556
|
+
renderBottomButton,
|
|
6435
6557
|
renderDay,
|
|
6436
6558
|
renderDayTop,
|
|
6437
6559
|
renderDayBottom,
|
|
6438
|
-
renderBottomButton,
|
|
6439
6560
|
onConfirm,
|
|
6440
6561
|
onUpdate,
|
|
6441
6562
|
onDayClick,
|
|
6442
6563
|
onPageChange
|
|
6443
|
-
} = { ...defaultProps$
|
|
6564
|
+
} = { ...defaultProps$14, ...props };
|
|
6444
6565
|
const classPrefix2 = "nut-calendar";
|
|
6445
6566
|
const dayPrefix = "nut-calendar-day";
|
|
6446
6567
|
const weekdays = locale.calendaritem.weekdays;
|
|
@@ -6467,7 +6588,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6467
6588
|
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
6468
6589
|
return type4 !== "single" ? [...defaultValue] : defaultValue;
|
|
6469
6590
|
}
|
|
6470
|
-
return
|
|
6591
|
+
return type4 === "single" ? "" : [];
|
|
6471
6592
|
};
|
|
6472
6593
|
const [currentDate, setCurrentDate] = usePropsValue({
|
|
6473
6594
|
value,
|
|
@@ -6502,6 +6623,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6502
6623
|
const monthInfo = {
|
|
6503
6624
|
curData: date4,
|
|
6504
6625
|
title: monthTitle(y2, m2),
|
|
6626
|
+
weekNo: getWeekNosOfYear(y2, m2, firstDayOfWeek),
|
|
6505
6627
|
monthData: days,
|
|
6506
6628
|
cssHeight,
|
|
6507
6629
|
scrollTop: scrollTop2
|
|
@@ -6523,7 +6645,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6523
6645
|
const currentMonthsData = monthsData[current];
|
|
6524
6646
|
if (currentMonthsData.title === yearMonthTitle) return;
|
|
6525
6647
|
const [year, month] = currentMonthsData.curData;
|
|
6526
|
-
onPageChange
|
|
6648
|
+
onPageChange == null ? void 0 : onPageChange([year, month, `${year}-${month}`]);
|
|
6527
6649
|
setYearMonthTitle(currentMonthsData.title);
|
|
6528
6650
|
};
|
|
6529
6651
|
const setDefaultRange = (monthNum, current) => {
|
|
@@ -6725,7 +6847,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6725
6847
|
initData();
|
|
6726
6848
|
};
|
|
6727
6849
|
useEffect(() => {
|
|
6728
|
-
setCurrentDate(resetDefaultValue()
|
|
6850
|
+
setCurrentDate(resetDefaultValue());
|
|
6729
6851
|
}, [defaultValue]);
|
|
6730
6852
|
useEffect(() => {
|
|
6731
6853
|
popup && resetRender();
|
|
@@ -6886,7 +7008,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6886
7008
|
}
|
|
6887
7009
|
}
|
|
6888
7010
|
if (!isFirst) {
|
|
6889
|
-
onDayClick
|
|
7011
|
+
onDayClick == null ? void 0 : onDayClick(state.currDateArray);
|
|
6890
7012
|
if (autoBackfill || !popup) {
|
|
6891
7013
|
confirm();
|
|
6892
7014
|
}
|
|
@@ -6896,9 +7018,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6896
7018
|
const confirm = () => {
|
|
6897
7019
|
if (type4 === "range" && state.currDateArray.length === 2 || type4 !== "range") {
|
|
6898
7020
|
const chooseData = state.currDateArray.slice(0);
|
|
6899
|
-
onConfirm
|
|
7021
|
+
onConfirm == null ? void 0 : onConfirm(chooseData);
|
|
6900
7022
|
if (popup) {
|
|
6901
|
-
onUpdate
|
|
7023
|
+
onUpdate == null ? void 0 : onUpdate();
|
|
6902
7024
|
}
|
|
6903
7025
|
}
|
|
6904
7026
|
};
|
|
@@ -6921,7 +7043,14 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6921
7043
|
return currentDate.length >= 2 && (type4 === "range" || type4 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
|
|
6922
7044
|
};
|
|
6923
7045
|
const renderHeader = () => {
|
|
6924
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement(
|
|
7046
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement(
|
|
7047
|
+
"div",
|
|
7048
|
+
{
|
|
7049
|
+
className: `${classPrefix2}-weeks ${showMonthNumber ? `${classPrefix2}-weeks-shrink` : ""}`,
|
|
7050
|
+
ref: weeksPanel
|
|
7051
|
+
},
|
|
7052
|
+
weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))
|
|
7053
|
+
));
|
|
6925
7054
|
};
|
|
6926
7055
|
const renderItem = (month, day, index) => {
|
|
6927
7056
|
const startTip = isStartTip(day, month);
|
|
@@ -6937,7 +7066,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6937
7066
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
|
|
6938
7067
|
!startTip && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
|
|
6939
7068
|
noStartNorEnd && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
|
|
6940
|
-
noStartNorEnd && isCurrDay(month, day.day) &&
|
|
7069
|
+
noStartNorEnd && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
|
|
6941
7070
|
startTip && /* @__PURE__ */ React__default.createElement(
|
|
6942
7071
|
"div",
|
|
6943
7072
|
{
|
|
@@ -6953,9 +7082,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6953
7082
|
);
|
|
6954
7083
|
};
|
|
6955
7084
|
const renderPanel = (month, key) => {
|
|
6956
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
|
|
7085
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${showMonthNumber ? "shrink" : ""}` }, showMonthNumber && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeknumber` }, month.weekNo.map((item, index) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeknumber-index`, key: index }, item))), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
|
|
6957
7086
|
(day, i2) => renderItem(month, day, i2)
|
|
6958
|
-
)));
|
|
7087
|
+
))));
|
|
6959
7088
|
};
|
|
6960
7089
|
const renderContent = () => {
|
|
6961
7090
|
return /* @__PURE__ */ React__default.createElement(
|
|
@@ -6972,7 +7101,6 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6972
7101
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement(
|
|
6973
7102
|
"div",
|
|
6974
7103
|
{
|
|
6975
|
-
className: "viewArea",
|
|
6976
7104
|
ref: viewAreaRef,
|
|
6977
7105
|
style: { transform: `translateY(${translateY}px)` }
|
|
6978
7106
|
},
|
|
@@ -6988,13 +7116,328 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6988
7116
|
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
6989
7117
|
});
|
|
6990
7118
|
CalendarItem.displayName = "NutCalendarItem";
|
|
7119
|
+
const defaultConfigRef = {
|
|
7120
|
+
current: {
|
|
7121
|
+
locale: zhCN
|
|
7122
|
+
}
|
|
7123
|
+
};
|
|
7124
|
+
const getDefaultConfig = () => {
|
|
7125
|
+
return defaultConfigRef.current;
|
|
7126
|
+
};
|
|
7127
|
+
const ConfigContext = createContext(null);
|
|
7128
|
+
const useConfig = () => {
|
|
7129
|
+
return useContext(ConfigContext) ?? getDefaultConfig();
|
|
7130
|
+
};
|
|
7131
|
+
const YearMonthPanelHeight = 231;
|
|
7132
|
+
const YearQuarterPanelHeight = 103;
|
|
7133
|
+
const defaultProps$13 = {
|
|
7134
|
+
...ComponentDefaults,
|
|
7135
|
+
type: "single",
|
|
7136
|
+
viewMode: "month",
|
|
7137
|
+
title: "",
|
|
7138
|
+
startDate: getDateString(0),
|
|
7139
|
+
endDate: getDateString(365),
|
|
7140
|
+
showToday: true,
|
|
7141
|
+
showTitle: true,
|
|
7142
|
+
scrollAnimation: true,
|
|
7143
|
+
renderDay: void 0,
|
|
7144
|
+
onItemClick: () => {
|
|
7145
|
+
}
|
|
7146
|
+
};
|
|
7147
|
+
const CalendarViewModeItem = React__default.forwardRef((props) => {
|
|
7148
|
+
const { locale } = useConfig();
|
|
7149
|
+
const {
|
|
7150
|
+
style,
|
|
7151
|
+
className,
|
|
7152
|
+
viewMode,
|
|
7153
|
+
title,
|
|
7154
|
+
value,
|
|
7155
|
+
defaultValue,
|
|
7156
|
+
startDate,
|
|
7157
|
+
endDate,
|
|
7158
|
+
showTitle,
|
|
7159
|
+
renderDay,
|
|
7160
|
+
onItemClick
|
|
7161
|
+
} = { ...defaultProps$13, ...props };
|
|
7162
|
+
const classPrefix2 = "nut-calendar-viewmode";
|
|
7163
|
+
const [panelDate, setPanelDate] = useState({
|
|
7164
|
+
months: [
|
|
7165
|
+
{
|
|
7166
|
+
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
7167
|
+
months: [],
|
|
7168
|
+
cssHeight: 0,
|
|
7169
|
+
scrollTop: 0,
|
|
7170
|
+
currYear: false
|
|
7171
|
+
}
|
|
7172
|
+
],
|
|
7173
|
+
quarters: [
|
|
7174
|
+
{
|
|
7175
|
+
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
7176
|
+
quarters: [],
|
|
7177
|
+
cssHeight: 0,
|
|
7178
|
+
scrollTop: 0,
|
|
7179
|
+
currYear: false
|
|
7180
|
+
}
|
|
7181
|
+
]
|
|
7182
|
+
});
|
|
7183
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
7184
|
+
const propStartDate = startDate || getDateString(0);
|
|
7185
|
+
const propEndDate = endDate || getDateString(365);
|
|
7186
|
+
const startDates = splitDate(propStartDate);
|
|
7187
|
+
const endDates = splitDate(propEndDate);
|
|
7188
|
+
const [innerValue, setInnerValue] = usePropsValue({
|
|
7189
|
+
value,
|
|
7190
|
+
defaultValue,
|
|
7191
|
+
finalValue: [],
|
|
7192
|
+
onChange: (val) => {
|
|
7193
|
+
}
|
|
7194
|
+
});
|
|
7195
|
+
const monthsRef = useRef(null);
|
|
7196
|
+
const monthsPanel = useRef(null);
|
|
7197
|
+
const viewAreaRef = useRef(null);
|
|
7198
|
+
const getMonthsPanel = () => {
|
|
7199
|
+
return monthsPanel.current;
|
|
7200
|
+
};
|
|
7201
|
+
const getMonthsRef = () => {
|
|
7202
|
+
return monthsRef.current;
|
|
7203
|
+
};
|
|
7204
|
+
const requestAniFrameFunc = (viewMode2) => {
|
|
7205
|
+
switch (viewMode2) {
|
|
7206
|
+
case "month":
|
|
7207
|
+
{
|
|
7208
|
+
const lastItem = panelDate.months[panelDate.months.length - 1];
|
|
7209
|
+
const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
7210
|
+
const currentIndex = panelDate.months.findIndex(
|
|
7211
|
+
(item) => item.currYear === true
|
|
7212
|
+
);
|
|
7213
|
+
requestAniFrame$1(() => {
|
|
7214
|
+
var _a;
|
|
7215
|
+
if (monthsRef && monthsPanel && viewAreaRef) {
|
|
7216
|
+
getMonthsRef().clientHeight;
|
|
7217
|
+
getMonthsPanel().style.height = `${containerHeight}px`;
|
|
7218
|
+
const currTop = ((_a = panelDate.months[currentIndex]) == null ? void 0 : _a.scrollTop) || 0;
|
|
7219
|
+
getMonthsRef().scrollTop = currTop;
|
|
7220
|
+
setScrollTop(currTop);
|
|
7221
|
+
}
|
|
7222
|
+
});
|
|
7223
|
+
}
|
|
7224
|
+
break;
|
|
7225
|
+
case "quarter":
|
|
7226
|
+
{
|
|
7227
|
+
const lastItem = panelDate.quarters[panelDate.quarters.length - 1];
|
|
7228
|
+
const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
7229
|
+
const currentIndex = panelDate.quarters.findIndex(
|
|
7230
|
+
(item) => item.currYear === true
|
|
7231
|
+
);
|
|
7232
|
+
requestAniFrame$1(() => {
|
|
7233
|
+
var _a;
|
|
7234
|
+
if (monthsRef && monthsPanel && viewAreaRef) {
|
|
7235
|
+
getMonthsRef().clientHeight;
|
|
7236
|
+
getMonthsPanel().style.height = `${containerHeight}px`;
|
|
7237
|
+
const currTop = ((_a = panelDate.quarters[currentIndex]) == null ? void 0 : _a.scrollTop) || 0;
|
|
7238
|
+
getMonthsRef().scrollTop = currTop;
|
|
7239
|
+
setScrollTop(currTop);
|
|
7240
|
+
}
|
|
7241
|
+
});
|
|
7242
|
+
}
|
|
7243
|
+
break;
|
|
7244
|
+
}
|
|
7245
|
+
};
|
|
7246
|
+
const isCurrYear = (year) => {
|
|
7247
|
+
return innerValue.split("-")[0] === `${year}`;
|
|
7248
|
+
};
|
|
7249
|
+
const getMonthsData = () => {
|
|
7250
|
+
const startYear = Number(startDates[0]);
|
|
7251
|
+
const startMonth = Number(startDates[1]);
|
|
7252
|
+
const endYear = Number(endDates[0]);
|
|
7253
|
+
const endMonth = Number(endDates[1]);
|
|
7254
|
+
const panelData = [];
|
|
7255
|
+
const addPanelData = (year, months, scrollTop2) => {
|
|
7256
|
+
panelData.push({
|
|
7257
|
+
year,
|
|
7258
|
+
months,
|
|
7259
|
+
scrollTop: scrollTop2,
|
|
7260
|
+
cssHeight: YearMonthPanelHeight,
|
|
7261
|
+
currYear: isCurrYear(year)
|
|
7262
|
+
});
|
|
7263
|
+
};
|
|
7264
|
+
if (startYear === endYear) {
|
|
7265
|
+
addPanelData(
|
|
7266
|
+
startYear,
|
|
7267
|
+
[
|
|
7268
|
+
...getPreMonths("prev", startYear, startMonth),
|
|
7269
|
+
...getMonths("curr", startYear, startMonth, endMonth),
|
|
7270
|
+
...getMonths("next", endYear, endMonth + 1)
|
|
7271
|
+
],
|
|
7272
|
+
0
|
|
7273
|
+
);
|
|
7274
|
+
} else {
|
|
7275
|
+
let scrollTop2 = panelData.length * YearMonthPanelHeight;
|
|
7276
|
+
const startMonths = [
|
|
7277
|
+
...getPreMonths("prev", startYear, startMonth),
|
|
7278
|
+
...getMonths("curr", startYear, startMonth)
|
|
7279
|
+
];
|
|
7280
|
+
addPanelData(startYear, startMonths, scrollTop2);
|
|
7281
|
+
for (let i2 = startYear + 1; i2 < endYear; i2++) {
|
|
7282
|
+
scrollTop2 = panelData.length * YearMonthPanelHeight;
|
|
7283
|
+
const midMonths = [...getMonths("curr", i2, 1)];
|
|
7284
|
+
addPanelData(i2, midMonths, scrollTop2);
|
|
7285
|
+
}
|
|
7286
|
+
const lastMonths = [
|
|
7287
|
+
...getPreMonths("curr", endYear, endMonth + 1),
|
|
7288
|
+
...getMonths("next", endYear, endMonth + 1)
|
|
7289
|
+
];
|
|
7290
|
+
scrollTop2 = panelData.length * YearMonthPanelHeight;
|
|
7291
|
+
addPanelData(endYear, lastMonths, scrollTop2);
|
|
7292
|
+
}
|
|
7293
|
+
return panelData;
|
|
7294
|
+
};
|
|
7295
|
+
const getQuartersData = () => {
|
|
7296
|
+
const startYear = Number(startDates[0]);
|
|
7297
|
+
const startMonth = Number(startDates[1]);
|
|
7298
|
+
const endYear = Number(endDates[0]);
|
|
7299
|
+
const endMonth = Number(endDates[1]);
|
|
7300
|
+
const panelData = [];
|
|
7301
|
+
const addPanelData = (year, quarters, scrollTop2) => {
|
|
7302
|
+
panelData.push({
|
|
7303
|
+
year,
|
|
7304
|
+
quarters,
|
|
7305
|
+
scrollTop: scrollTop2,
|
|
7306
|
+
cssHeight: YearQuarterPanelHeight,
|
|
7307
|
+
currYear: isCurrYear(year)
|
|
7308
|
+
});
|
|
7309
|
+
};
|
|
7310
|
+
if (startYear === endYear) {
|
|
7311
|
+
const quarters = [
|
|
7312
|
+
...getPreQuarters("prev", startYear, startMonth),
|
|
7313
|
+
...getQuarters("curr", startYear, startMonth, endMonth),
|
|
7314
|
+
...getNextQuarters("next", endYear, endMonth)
|
|
7315
|
+
];
|
|
7316
|
+
addPanelData(startYear, quarters, 0);
|
|
7317
|
+
} else {
|
|
7318
|
+
let scrollTop2 = panelData.length * YearQuarterPanelHeight;
|
|
7319
|
+
const startQuarters = [
|
|
7320
|
+
...getPreQuarters("prev", startYear, startMonth),
|
|
7321
|
+
...getQuarters("curr", startYear, startMonth)
|
|
7322
|
+
];
|
|
7323
|
+
addPanelData(startYear, startQuarters, scrollTop2);
|
|
7324
|
+
for (let i2 = startYear + 1; i2 < endYear; i2++) {
|
|
7325
|
+
scrollTop2 = panelData.length * YearQuarterPanelHeight;
|
|
7326
|
+
const midQuarters = [...getQuarters("curr", i2, 1)];
|
|
7327
|
+
addPanelData(i2, midQuarters, scrollTop2);
|
|
7328
|
+
}
|
|
7329
|
+
const lastQuarters = [
|
|
7330
|
+
...getQuarters("curr", endYear, 1, endMonth),
|
|
7331
|
+
...getNextQuarters("next", endYear, endMonth)
|
|
7332
|
+
];
|
|
7333
|
+
scrollTop2 = panelData.length * YearQuarterPanelHeight;
|
|
7334
|
+
addPanelData(endYear, lastQuarters, scrollTop2);
|
|
7335
|
+
}
|
|
7336
|
+
return panelData;
|
|
7337
|
+
};
|
|
7338
|
+
const initData = () => {
|
|
7339
|
+
const data = (
|
|
7340
|
+
// eslint-disable-next-line no-nested-ternary
|
|
7341
|
+
viewMode === "month" ? getMonthsData() : viewMode === "quarter" ? getQuartersData() : null
|
|
7342
|
+
);
|
|
7343
|
+
setPanelDate({ ...panelDate, [`${viewMode}s`]: data });
|
|
7344
|
+
};
|
|
7345
|
+
useEffect(() => {
|
|
7346
|
+
requestAniFrameFunc(viewMode);
|
|
7347
|
+
}, [panelDate]);
|
|
7348
|
+
useEffect(() => {
|
|
7349
|
+
initData();
|
|
7350
|
+
}, []);
|
|
7351
|
+
const monthsViewScroll = (e2) => {
|
|
7352
|
+
const scrollTop2 = e2.target.scrollTop;
|
|
7353
|
+
Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
|
|
7354
|
+
};
|
|
7355
|
+
const handleItemClick = (viewMode2, item) => {
|
|
7356
|
+
if (item.type !== "curr") return;
|
|
7357
|
+
const val = viewMode2 === "month" ? item.yearAndMonth : item.yearAndQuarter;
|
|
7358
|
+
setInnerValue(val);
|
|
7359
|
+
onItemClick == null ? void 0 : onItemClick(val);
|
|
7360
|
+
};
|
|
7361
|
+
const isDisable = (item) => {
|
|
7362
|
+
return item.type === "prev" || item.type === "next";
|
|
7363
|
+
};
|
|
7364
|
+
const isActive = (item) => {
|
|
7365
|
+
const val = viewMode === "month" ? item.yearAndMonth : item.yearAndQuarter;
|
|
7366
|
+
return val === innerValue;
|
|
7367
|
+
};
|
|
7368
|
+
const getClasses = (item) => {
|
|
7369
|
+
if (isDisable(item)) {
|
|
7370
|
+
return ["disabled"];
|
|
7371
|
+
}
|
|
7372
|
+
const res = [];
|
|
7373
|
+
if (item.type === "curr") {
|
|
7374
|
+
if (isActive(item)) {
|
|
7375
|
+
res.push("active");
|
|
7376
|
+
}
|
|
7377
|
+
}
|
|
7378
|
+
return res;
|
|
7379
|
+
};
|
|
7380
|
+
const classes = classNames(classPrefix2, className);
|
|
7381
|
+
const renderHeader = () => {
|
|
7382
|
+
return showTitle && /* @__PURE__ */ React__default.createElement(
|
|
7383
|
+
View,
|
|
7384
|
+
{
|
|
7385
|
+
className: classNames({
|
|
7386
|
+
[`${classPrefix2}-header`]: true
|
|
7387
|
+
})
|
|
7388
|
+
},
|
|
7389
|
+
/* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-title` }, title)
|
|
7390
|
+
);
|
|
7391
|
+
};
|
|
7392
|
+
const renderItem = (item, index) => {
|
|
7393
|
+
const units = {
|
|
7394
|
+
month: locale.calendaritem.month,
|
|
7395
|
+
quarter: locale.calendaritem.quarter
|
|
7396
|
+
};
|
|
7397
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
7398
|
+
"div",
|
|
7399
|
+
{
|
|
7400
|
+
className: classNames(
|
|
7401
|
+
`${classPrefix2}-item`,
|
|
7402
|
+
item.type,
|
|
7403
|
+
getClasses(item)
|
|
7404
|
+
),
|
|
7405
|
+
onClick: () => handleItemClick(viewMode, item),
|
|
7406
|
+
key: index
|
|
7407
|
+
},
|
|
7408
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-item-${item.type}` }, renderDay ? renderDay(item) : `${item[viewMode]}${units[viewMode]}`)
|
|
7409
|
+
);
|
|
7410
|
+
};
|
|
7411
|
+
const renderPanel = () => {
|
|
7412
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, panelDate[`${viewMode}s`].map((item, key) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-panel`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-panel-title` }, item.year), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-content` }, item[`${viewMode}s`].map(
|
|
7413
|
+
(item2, i2) => renderItem(item2, i2)
|
|
7414
|
+
)))));
|
|
7415
|
+
};
|
|
7416
|
+
const renderContent = () => {
|
|
7417
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
7418
|
+
ScrollView,
|
|
7419
|
+
{
|
|
7420
|
+
scrollTop,
|
|
7421
|
+
scrollY: true,
|
|
7422
|
+
className: `${classPrefix2}-content`,
|
|
7423
|
+
onScroll: monthsViewScroll,
|
|
7424
|
+
ref: monthsRef
|
|
7425
|
+
},
|
|
7426
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement("div", { ref: viewAreaRef }, renderPanel()))
|
|
7427
|
+
);
|
|
7428
|
+
};
|
|
7429
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent());
|
|
7430
|
+
});
|
|
7431
|
+
CalendarViewModeItem.displayName = "NutCalendarViewModeItem";
|
|
6991
7432
|
const defaultProps$12 = {
|
|
6992
7433
|
...ComponentDefaults,
|
|
6993
7434
|
type: "single",
|
|
7435
|
+
viewMode: "day",
|
|
6994
7436
|
autoBackfill: false,
|
|
6995
7437
|
popup: true,
|
|
6996
7438
|
visible: false,
|
|
6997
7439
|
title: "",
|
|
7440
|
+
value: "",
|
|
6998
7441
|
defaultValue: "",
|
|
6999
7442
|
startDate: getDateString(0),
|
|
7000
7443
|
endDate: getDateString(365),
|
|
@@ -7004,6 +7447,7 @@ const defaultProps$12 = {
|
|
|
7004
7447
|
confirmText: "",
|
|
7005
7448
|
showTitle: true,
|
|
7006
7449
|
showSubTitle: true,
|
|
7450
|
+
showMonthNumber: false,
|
|
7007
7451
|
scrollAnimation: true,
|
|
7008
7452
|
firstDayOfWeek: 0,
|
|
7009
7453
|
disableDate: (date4) => false,
|
|
@@ -7017,6 +7461,8 @@ const defaultProps$12 = {
|
|
|
7017
7461
|
},
|
|
7018
7462
|
onDayClick: (data) => {
|
|
7019
7463
|
},
|
|
7464
|
+
onItemClick: () => {
|
|
7465
|
+
},
|
|
7020
7466
|
onPageChange: (param) => {
|
|
7021
7467
|
}
|
|
7022
7468
|
};
|
|
@@ -7029,8 +7475,10 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7029
7475
|
popup,
|
|
7030
7476
|
visible,
|
|
7031
7477
|
type: type4,
|
|
7478
|
+
viewMode,
|
|
7032
7479
|
autoBackfill,
|
|
7033
7480
|
title,
|
|
7481
|
+
value,
|
|
7034
7482
|
defaultValue,
|
|
7035
7483
|
startDate,
|
|
7036
7484
|
endDate,
|
|
@@ -7040,6 +7488,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7040
7488
|
confirmText,
|
|
7041
7489
|
showTitle,
|
|
7042
7490
|
showSubTitle,
|
|
7491
|
+
showMonthNumber,
|
|
7043
7492
|
scrollAnimation,
|
|
7044
7493
|
firstDayOfWeek,
|
|
7045
7494
|
closeIcon,
|
|
@@ -7052,6 +7501,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7052
7501
|
onClose,
|
|
7053
7502
|
onConfirm,
|
|
7054
7503
|
onDayClick,
|
|
7504
|
+
onItemClick,
|
|
7055
7505
|
onPageChange
|
|
7056
7506
|
} = { ...defaultProps$12, ...props };
|
|
7057
7507
|
const calendarRef = useRef(null);
|
|
@@ -7065,9 +7515,6 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7065
7515
|
const closePopup = () => {
|
|
7066
7516
|
close2();
|
|
7067
7517
|
};
|
|
7068
|
-
const select = (param) => {
|
|
7069
|
-
onDayClick && onDayClick(param);
|
|
7070
|
-
};
|
|
7071
7518
|
const scrollToDate = (date4) => {
|
|
7072
7519
|
var _a;
|
|
7073
7520
|
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date4);
|
|
@@ -7079,7 +7526,25 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7079
7526
|
scrollToDate
|
|
7080
7527
|
}));
|
|
7081
7528
|
const renderItem = () => {
|
|
7082
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
7529
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, viewMode !== "day" ? /* @__PURE__ */ React__default.createElement(
|
|
7530
|
+
CalendarViewModeItem,
|
|
7531
|
+
{
|
|
7532
|
+
ref: calendarRef,
|
|
7533
|
+
style,
|
|
7534
|
+
className,
|
|
7535
|
+
type: type4,
|
|
7536
|
+
viewMode,
|
|
7537
|
+
title: title || locale.calendaritem.title,
|
|
7538
|
+
value,
|
|
7539
|
+
defaultValue,
|
|
7540
|
+
startDate,
|
|
7541
|
+
endDate,
|
|
7542
|
+
showTitle,
|
|
7543
|
+
scrollAnimation,
|
|
7544
|
+
renderDay,
|
|
7545
|
+
onItemClick
|
|
7546
|
+
}
|
|
7547
|
+
) : /* @__PURE__ */ React__default.createElement(
|
|
7083
7548
|
CalendarItem,
|
|
7084
7549
|
{
|
|
7085
7550
|
ref: calendarRef,
|
|
@@ -7099,6 +7564,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7099
7564
|
confirmText: confirmText || locale.calendaritem.confirm,
|
|
7100
7565
|
showTitle,
|
|
7101
7566
|
showSubTitle,
|
|
7567
|
+
showMonthNumber,
|
|
7102
7568
|
scrollAnimation,
|
|
7103
7569
|
firstDayOfWeek,
|
|
7104
7570
|
disableDate,
|
|
@@ -7108,12 +7574,12 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7108
7574
|
renderDayTop,
|
|
7109
7575
|
renderDayBottom,
|
|
7110
7576
|
onConfirm: choose,
|
|
7111
|
-
onDayClick
|
|
7577
|
+
onDayClick,
|
|
7112
7578
|
onPageChange: yearMonthChange
|
|
7113
7579
|
}
|
|
7114
|
-
);
|
|
7580
|
+
));
|
|
7115
7581
|
};
|
|
7116
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, popup ? /* @__PURE__ */ React__default.createElement(
|
|
7582
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, popup && viewMode === "day" ? /* @__PURE__ */ React__default.createElement(
|
|
7117
7583
|
Popup,
|
|
7118
7584
|
{
|
|
7119
7585
|
className: "nut-calendar-popup",
|
|
@@ -7121,11 +7587,11 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7121
7587
|
position: "bottom",
|
|
7122
7588
|
round: true,
|
|
7123
7589
|
closeable: true,
|
|
7590
|
+
closeIcon,
|
|
7124
7591
|
destroyOnClose: true,
|
|
7125
7592
|
onOverlayClick: closePopup,
|
|
7126
7593
|
onCloseIconClick: closePopup,
|
|
7127
|
-
style: { height: "83%" }
|
|
7128
|
-
closeIcon
|
|
7594
|
+
style: { height: "83%" }
|
|
7129
7595
|
},
|
|
7130
7596
|
renderItem()
|
|
7131
7597
|
) : renderItem());
|
|
@@ -13563,7 +14029,7 @@ function useParams(args) {
|
|
|
13563
14029
|
const stateRef = useRef(args);
|
|
13564
14030
|
const currentRef = useRef();
|
|
13565
14031
|
const previousRef = useRef();
|
|
13566
|
-
if (!
|
|
14032
|
+
if (!isEqual$1(currentRef.current, args)) {
|
|
13567
14033
|
previousRef.current = currentRef.current;
|
|
13568
14034
|
currentRef.current = args;
|
|
13569
14035
|
stateRef.current = args;
|
|
@@ -17989,18 +18455,6 @@ const getTaroRectById = (id) => {
|
|
|
17989
18455
|
}
|
|
17990
18456
|
});
|
|
17991
18457
|
};
|
|
17992
|
-
const defaultConfigRef = {
|
|
17993
|
-
current: {
|
|
17994
|
-
locale: zhCN
|
|
17995
|
-
}
|
|
17996
|
-
};
|
|
17997
|
-
const getDefaultConfig = () => {
|
|
17998
|
-
return defaultConfigRef.current;
|
|
17999
|
-
};
|
|
18000
|
-
const ConfigContext = createContext(null);
|
|
18001
|
-
const useConfig = () => {
|
|
18002
|
-
return useContext(ConfigContext) ?? getDefaultConfig();
|
|
18003
|
-
};
|
|
18004
18458
|
const defaultProps$9 = {
|
|
18005
18459
|
...ComponentDefaults,
|
|
18006
18460
|
visible: false,
|