@nutui/nutui-react-taro 2.7.8 → 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 +22 -6
- 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/Drag.js +1 -1
- package/dist/esm/Ellipsis.js +1 -1
- package/dist/esm/FixedNav.js +1 -1
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/InfiniteLoading.js +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/Menu.js +1 -1
- package/dist/esm/MenuItem.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/Sticky.js +1 -1
- package/dist/esm/Swiper/style/style.css +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/VirtualList.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-meD2sizv.js → avatarcropper.taro-BsbRSHbo.js} +3 -2
- 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/{drag.taro-r5Lmncrq.js → drag.taro-CHPSfySz.js} +2 -2
- 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/get-system-info-D27xNglo.js +11 -0
- 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/{menu.taro-2APk--BX.js → menu.taro-9N8A5UoN.js} +1 -1
- package/dist/esm/{menuitem.taro-BMlSqBSc.js → menuitem.taro-CnsORm5-.js} +5 -4
- 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 +40 -40
- 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-BiSDwLpA.js → pulltorefresh.taro-KKNiGe1Q.js} +3 -2
- 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/{sticky.taro-DtUAawu_.js → sticky.taro-l66r7WFn.js} +3 -2
- 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/{virtuallist.taro-BlPW8ibd.js → virtuallist.taro-CQDtOwWn.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 +600 -140
- package/dist/nutui.react.umd.js +599 -139
- package/dist/packages/calendar/calendar.scss +24 -0
- package/dist/packages/calendar/calendarviewmode.scss +181 -0
- package/dist/packages/swiper/swiper.scss +11 -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/dist/types/utils/get-system-info.d.ts +19 -0
- 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,11 +1,11 @@
|
|
|
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
|
*/
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import React__default, { useCallback, createContext, useContext, useState, useRef, useEffect, useMemo as useMemo$1, useImperativeHandle, isValidElement, forwardRef, Component, Children } from "react";
|
|
8
|
-
import Taro, { getEnv, createSelectorQuery, usePageScroll,
|
|
8
|
+
import Taro, { getEnv, createSelectorQuery, usePageScroll, pageScrollTo, nextTick, ENV_TYPE, useReady, canvasToTempFilePath, uploadFile, chooseMedia, chooseImage, Events, getCurrentInstance, createInnerAudioContext, getSystemInfo, createOffscreenCanvas } from "@tarojs/taro";
|
|
9
9
|
import { Image as Image$2, View, ScrollView, PickerView, PickerViewColumn, Form as Form$1, Text, Input as Input$1, Textarea, Swiper as Swiper$1, SwiperItem as SwiperItem$1, Video as Video$1, Canvas } from "@tarojs/components";
|
|
10
10
|
import ReactDOM, { createPortal } from "react-dom";
|
|
11
11
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
@@ -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(
|
|
@@ -3922,6 +3926,12 @@ const Space = (props) => {
|
|
|
3922
3926
|
}));
|
|
3923
3927
|
};
|
|
3924
3928
|
Space.displayName = "NutSpace";
|
|
3929
|
+
const getDeviceInfo = () => {
|
|
3930
|
+
return Taro.canIUse("getDeviceInfo") ? Taro.getDeviceInfo() : Taro.getSystemInfoSync();
|
|
3931
|
+
};
|
|
3932
|
+
const getWindowInfo = () => {
|
|
3933
|
+
return Taro.canIUse("getWindowInfo") ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
3934
|
+
};
|
|
3925
3935
|
function useWatch$1(dep, callback, config2 = { immediate: false }) {
|
|
3926
3936
|
const { immediate } = config2;
|
|
3927
3937
|
const prev = useRef();
|
|
@@ -4035,7 +4045,7 @@ const getRectByTaro = async (element) => {
|
|
|
4035
4045
|
}
|
|
4036
4046
|
return Promise.resolve(makeRect(0, 0));
|
|
4037
4047
|
};
|
|
4038
|
-
const defaultProps$
|
|
4048
|
+
const defaultProps$1l = {
|
|
4039
4049
|
...ComponentDefaults,
|
|
4040
4050
|
position: "top",
|
|
4041
4051
|
zIndex: 900
|
|
@@ -4052,7 +4062,7 @@ const Sticky = (props) => {
|
|
|
4052
4062
|
className,
|
|
4053
4063
|
onChange,
|
|
4054
4064
|
...rest
|
|
4055
|
-
} = { ...defaultProps$
|
|
4065
|
+
} = { ...defaultProps$1l, ...props };
|
|
4056
4066
|
const stickyRef = useRef(null);
|
|
4057
4067
|
const rootRef = useRef(null);
|
|
4058
4068
|
const [rootRect, setRootRect] = useState({});
|
|
@@ -4119,7 +4129,7 @@ const Sticky = (props) => {
|
|
|
4119
4129
|
setFixed(threshold > curRootRect.top);
|
|
4120
4130
|
}
|
|
4121
4131
|
} else {
|
|
4122
|
-
const windowHeight =
|
|
4132
|
+
const windowHeight = getWindowInfo().windowHeight;
|
|
4123
4133
|
setFixed(windowHeight - threshold < curRootRect.bottom);
|
|
4124
4134
|
}
|
|
4125
4135
|
};
|
|
@@ -4176,7 +4186,7 @@ const SafeArea = (props) => {
|
|
|
4176
4186
|
);
|
|
4177
4187
|
};
|
|
4178
4188
|
SafeArea.displayName = "NutSafeArea";
|
|
4179
|
-
const defaultProps$
|
|
4189
|
+
const defaultProps$1k = {
|
|
4180
4190
|
...ComponentDefaults,
|
|
4181
4191
|
threshold: 200,
|
|
4182
4192
|
zIndex: 900,
|
|
@@ -4185,7 +4195,7 @@ const defaultProps$1j = {
|
|
|
4185
4195
|
const BackTop = (props) => {
|
|
4186
4196
|
const rtl = useRtl();
|
|
4187
4197
|
const { children, threshold, zIndex, className, duration, style, onClick } = {
|
|
4188
|
-
...defaultProps$
|
|
4198
|
+
...defaultProps$1k,
|
|
4189
4199
|
...props
|
|
4190
4200
|
};
|
|
4191
4201
|
const classPrefix2 = "nut-backtop";
|
|
@@ -4233,7 +4243,7 @@ function useUuid() {
|
|
|
4233
4243
|
return idRef.current;
|
|
4234
4244
|
}
|
|
4235
4245
|
const elevatorContext = createContext({});
|
|
4236
|
-
const defaultProps$
|
|
4246
|
+
const defaultProps$1j = {
|
|
4237
4247
|
...ComponentDefaults,
|
|
4238
4248
|
height: "200px",
|
|
4239
4249
|
floorKey: "title",
|
|
@@ -4260,7 +4270,7 @@ const Elevator = (props) => {
|
|
|
4260
4270
|
children,
|
|
4261
4271
|
...rest
|
|
4262
4272
|
} = {
|
|
4263
|
-
...defaultProps$
|
|
4273
|
+
...defaultProps$1j,
|
|
4264
4274
|
...props
|
|
4265
4275
|
};
|
|
4266
4276
|
const uuid = useUuid();
|
|
@@ -4486,7 +4496,7 @@ const Elevator = (props) => {
|
|
|
4486
4496
|
};
|
|
4487
4497
|
Elevator.displayName = "NutElevator";
|
|
4488
4498
|
Elevator.Context = elevatorContext;
|
|
4489
|
-
const defaultProps$
|
|
4499
|
+
const defaultProps$1i = {
|
|
4490
4500
|
...ComponentDefaults,
|
|
4491
4501
|
activeText: "",
|
|
4492
4502
|
inactiveText: "",
|
|
@@ -4514,7 +4524,7 @@ const FixedNav = (props) => {
|
|
|
4514
4524
|
content,
|
|
4515
4525
|
...rest
|
|
4516
4526
|
} = {
|
|
4517
|
-
...defaultProps$
|
|
4527
|
+
...defaultProps$1i,
|
|
4518
4528
|
...props
|
|
4519
4529
|
};
|
|
4520
4530
|
const classPrefix2 = "nut-fixednav";
|
|
@@ -4567,7 +4577,7 @@ const FixedNav = (props) => {
|
|
|
4567
4577
|
);
|
|
4568
4578
|
};
|
|
4569
4579
|
FixedNav.displayName = "NutFixedNav";
|
|
4570
|
-
const defaultProps$
|
|
4580
|
+
const defaultProps$1h = {
|
|
4571
4581
|
...ComponentDefaults,
|
|
4572
4582
|
left: "",
|
|
4573
4583
|
right: "",
|
|
@@ -4592,7 +4602,7 @@ const NavBar = (props) => {
|
|
|
4592
4602
|
zIndex,
|
|
4593
4603
|
onBackClick
|
|
4594
4604
|
} = {
|
|
4595
|
-
...defaultProps$
|
|
4605
|
+
...defaultProps$1h,
|
|
4596
4606
|
...props
|
|
4597
4607
|
};
|
|
4598
4608
|
const classPrefix2 = "nut-navbar";
|
|
@@ -4670,7 +4680,7 @@ const NavBar = (props) => {
|
|
|
4670
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());
|
|
4671
4681
|
};
|
|
4672
4682
|
NavBar.displayName = "NutNavBar";
|
|
4673
|
-
const defaultProps$
|
|
4683
|
+
const defaultProps$1g = {
|
|
4674
4684
|
...ComponentDefaults,
|
|
4675
4685
|
position: "center",
|
|
4676
4686
|
transition: "",
|
|
@@ -4723,7 +4733,7 @@ const Popup = (props) => {
|
|
|
4723
4733
|
afterShow,
|
|
4724
4734
|
afterClose,
|
|
4725
4735
|
onClick
|
|
4726
|
-
} = { ...defaultProps$
|
|
4736
|
+
} = { ...defaultProps$1g, ...props };
|
|
4727
4737
|
let innerIndex = zIndex || _zIndex;
|
|
4728
4738
|
const [index, setIndex] = useState(innerIndex);
|
|
4729
4739
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
@@ -4866,7 +4876,7 @@ const Popup = (props) => {
|
|
|
4866
4876
|
};
|
|
4867
4877
|
Popup.displayName = "NutPopup";
|
|
4868
4878
|
const OffsetContext = createContext(20);
|
|
4869
|
-
const defaultProps$
|
|
4879
|
+
const defaultProps$1f = {
|
|
4870
4880
|
...ComponentDefaults,
|
|
4871
4881
|
position: "left",
|
|
4872
4882
|
width: "80%"
|
|
@@ -4884,7 +4894,7 @@ const SideNavBar = (props) => {
|
|
|
4884
4894
|
indent,
|
|
4885
4895
|
...rest
|
|
4886
4896
|
} = {
|
|
4887
|
-
...defaultProps$
|
|
4897
|
+
...defaultProps$1f,
|
|
4888
4898
|
...props
|
|
4889
4899
|
};
|
|
4890
4900
|
const innerIndent = indent ? Number(indent) : 20;
|
|
@@ -4942,13 +4952,13 @@ const SideNavBarItem = (props) => {
|
|
|
4942
4952
|
title
|
|
4943
4953
|
);
|
|
4944
4954
|
};
|
|
4945
|
-
const defaultProps$
|
|
4955
|
+
const defaultProps$1e = {
|
|
4946
4956
|
open: true
|
|
4947
4957
|
};
|
|
4948
4958
|
const SubSideNavBar = (props) => {
|
|
4949
4959
|
const classPrefix2 = "nut-subsidenavbar";
|
|
4950
4960
|
const { title, value, children, onClick, open: open2, ...rest } = {
|
|
4951
|
-
...defaultProps$
|
|
4961
|
+
...defaultProps$1e,
|
|
4952
4962
|
...props
|
|
4953
4963
|
};
|
|
4954
4964
|
const [subShow, setSubShow] = useState(open2);
|
|
@@ -5026,7 +5036,7 @@ function usePropsValue({
|
|
|
5026
5036
|
);
|
|
5027
5037
|
return [stateRef.current, setState];
|
|
5028
5038
|
}
|
|
5029
|
-
const defaultProps$
|
|
5039
|
+
const defaultProps$1d = {
|
|
5030
5040
|
...ComponentDefaults,
|
|
5031
5041
|
value: "",
|
|
5032
5042
|
dot: false,
|
|
@@ -5051,7 +5061,7 @@ const Badge = (props) => {
|
|
|
5051
5061
|
color,
|
|
5052
5062
|
fill
|
|
5053
5063
|
} = {
|
|
5054
|
-
...defaultProps$
|
|
5064
|
+
...defaultProps$1d,
|
|
5055
5065
|
...props
|
|
5056
5066
|
};
|
|
5057
5067
|
const classPrefix2 = "nut-badge";
|
|
@@ -5105,7 +5115,7 @@ const Badge = (props) => {
|
|
|
5105
5115
|
};
|
|
5106
5116
|
Badge.displayName = "NutBadge";
|
|
5107
5117
|
const TabbarContext = React__default.createContext(null);
|
|
5108
|
-
const defaultProps$
|
|
5118
|
+
const defaultProps$1c = {
|
|
5109
5119
|
...ComponentDefaults,
|
|
5110
5120
|
title: "",
|
|
5111
5121
|
icon: null,
|
|
@@ -5131,7 +5141,7 @@ const TabbarItem = (props) => {
|
|
|
5131
5141
|
index,
|
|
5132
5142
|
...rest
|
|
5133
5143
|
} = {
|
|
5134
|
-
...defaultProps$
|
|
5144
|
+
...defaultProps$1c,
|
|
5135
5145
|
...props
|
|
5136
5146
|
};
|
|
5137
5147
|
const active = index === (ctx == null ? void 0 : ctx.selectIndex);
|
|
@@ -5169,7 +5179,7 @@ const TabbarItem = (props) => {
|
|
|
5169
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))
|
|
5170
5180
|
);
|
|
5171
5181
|
};
|
|
5172
|
-
const defaultProps$
|
|
5182
|
+
const defaultProps$1b = {
|
|
5173
5183
|
...ComponentDefaults,
|
|
5174
5184
|
defaultValue: 0,
|
|
5175
5185
|
fixed: false,
|
|
@@ -5192,7 +5202,7 @@ const Tabbar = (props) => {
|
|
|
5192
5202
|
style,
|
|
5193
5203
|
onSwitch
|
|
5194
5204
|
} = {
|
|
5195
|
-
...defaultProps$
|
|
5205
|
+
...defaultProps$1b,
|
|
5196
5206
|
...props
|
|
5197
5207
|
};
|
|
5198
5208
|
const classPrefix2 = "nut-tabbar";
|
|
@@ -5234,14 +5244,14 @@ const Tabbar = (props) => {
|
|
|
5234
5244
|
};
|
|
5235
5245
|
Tabbar.displayName = "NutTabbar";
|
|
5236
5246
|
Tabbar.Item = TabbarItem;
|
|
5237
|
-
const defaultProps$
|
|
5247
|
+
const defaultProps$1a = {
|
|
5238
5248
|
title: "",
|
|
5239
5249
|
value: "",
|
|
5240
5250
|
disabled: false
|
|
5241
5251
|
};
|
|
5242
5252
|
const TabPane = (props) => {
|
|
5243
5253
|
const { children, autoHeightClassName, className, disabled } = {
|
|
5244
|
-
...defaultProps$
|
|
5254
|
+
...defaultProps$1a,
|
|
5245
5255
|
...props
|
|
5246
5256
|
};
|
|
5247
5257
|
const classPrefix2 = "nut-tabpane";
|
|
@@ -5268,7 +5278,7 @@ function requestAniFrame() {
|
|
|
5268
5278
|
};
|
|
5269
5279
|
}
|
|
5270
5280
|
const requestAniFrame$1 = requestAniFrame();
|
|
5271
|
-
const defaultProps$
|
|
5281
|
+
const defaultProps$19 = {
|
|
5272
5282
|
...ComponentDefaults,
|
|
5273
5283
|
tabStyle: {},
|
|
5274
5284
|
activeColor: "",
|
|
@@ -5297,7 +5307,7 @@ const Tabs = (props) => {
|
|
|
5297
5307
|
value: outerValue,
|
|
5298
5308
|
defaultValue: outerDefaultValue,
|
|
5299
5309
|
...rest
|
|
5300
|
-
} = { ...defaultProps$
|
|
5310
|
+
} = { ...defaultProps$19, ...props };
|
|
5301
5311
|
const uuid = useUuid();
|
|
5302
5312
|
const [value, setValue] = usePropsValue({
|
|
5303
5313
|
value: outerValue,
|
|
@@ -5364,14 +5374,8 @@ const Tabs = (props) => {
|
|
|
5364
5374
|
const [scrollLeft, setScrollLeft] = useState(0);
|
|
5365
5375
|
const [scrollTop, setScrollTop] = useState(0);
|
|
5366
5376
|
const scrollDirection = (to, direction2) => {
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
function animate() {
|
|
5370
|
-
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5371
|
-
else setScrollTop(to);
|
|
5372
|
-
if (++count < frames) requestAniFrame$1(animate);
|
|
5373
|
-
}
|
|
5374
|
-
animate();
|
|
5377
|
+
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5378
|
+
else setScrollTop(to);
|
|
5375
5379
|
};
|
|
5376
5380
|
const scrollIntoView = (index) => {
|
|
5377
5381
|
requestAniFrame$1(() => {
|
|
@@ -5388,13 +5392,11 @@ const Tabs = (props) => {
|
|
|
5388
5392
|
} else {
|
|
5389
5393
|
const left2 = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
|
|
5390
5394
|
to = left2 - (navRect.width - titleRect.width) / 2;
|
|
5391
|
-
if (to < 0) return;
|
|
5392
|
-
to = rtl ? -to : to;
|
|
5393
5395
|
}
|
|
5396
|
+
scrollDirection(to, direction);
|
|
5394
5397
|
nextTick(() => {
|
|
5395
5398
|
scrollWithAnimation.current = true;
|
|
5396
5399
|
});
|
|
5397
|
-
scrollDirection(to, direction);
|
|
5398
5400
|
});
|
|
5399
5401
|
});
|
|
5400
5402
|
};
|
|
@@ -5487,7 +5489,7 @@ const Tabs = (props) => {
|
|
|
5487
5489
|
};
|
|
5488
5490
|
Tabs.displayName = "NutTabs";
|
|
5489
5491
|
Tabs.TabPane = TabPane;
|
|
5490
|
-
const defaultProps$
|
|
5492
|
+
const defaultProps$18 = {
|
|
5491
5493
|
type: "custom",
|
|
5492
5494
|
existList: [],
|
|
5493
5495
|
defaultIcon: null,
|
|
@@ -5506,7 +5508,7 @@ const ExistRender = (props) => {
|
|
|
5506
5508
|
onSelect,
|
|
5507
5509
|
onSwitch,
|
|
5508
5510
|
...rest
|
|
5509
|
-
} = { ...defaultProps$
|
|
5511
|
+
} = { ...defaultProps$18, ...props };
|
|
5510
5512
|
const classPrefix2 = "nut-address";
|
|
5511
5513
|
const selectedExist = (item) => {
|
|
5512
5514
|
existList.forEach((list, index) => {
|
|
@@ -5668,7 +5670,7 @@ class Tree {
|
|
|
5668
5670
|
return pathNodes;
|
|
5669
5671
|
}
|
|
5670
5672
|
}
|
|
5671
|
-
const defaultProps$
|
|
5673
|
+
const defaultProps$17 = {
|
|
5672
5674
|
...ComponentDefaults,
|
|
5673
5675
|
activeColor: "",
|
|
5674
5676
|
activeIcon: "checklist",
|
|
@@ -5714,7 +5716,7 @@ const InternalCascader = (props, ref) => {
|
|
|
5714
5716
|
onClose,
|
|
5715
5717
|
onChange,
|
|
5716
5718
|
onPathChange
|
|
5717
|
-
} = { ...defaultProps$
|
|
5719
|
+
} = { ...defaultProps$17, ...props };
|
|
5718
5720
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
5719
5721
|
const [optionsData, setOptionsData] = useState([]);
|
|
5720
5722
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
@@ -6025,7 +6027,7 @@ const InternalCascader = (props, ref) => {
|
|
|
6025
6027
|
};
|
|
6026
6028
|
const Cascader = React__default.forwardRef(InternalCascader);
|
|
6027
6029
|
Cascader.displayName = "NutCascader";
|
|
6028
|
-
const defaultProps$
|
|
6030
|
+
const defaultProps$16 = {
|
|
6029
6031
|
...ComponentDefaults,
|
|
6030
6032
|
visible: false,
|
|
6031
6033
|
type: "custom",
|
|
@@ -6052,7 +6054,7 @@ const CustomRender = (props) => {
|
|
|
6052
6054
|
onPathChange,
|
|
6053
6055
|
...rest
|
|
6054
6056
|
} = {
|
|
6055
|
-
...defaultProps$
|
|
6057
|
+
...defaultProps$16,
|
|
6056
6058
|
...props
|
|
6057
6059
|
};
|
|
6058
6060
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, type4 === "custom" && /* @__PURE__ */ React__default.createElement(
|
|
@@ -6077,7 +6079,7 @@ const CustomRender = (props) => {
|
|
|
6077
6079
|
}
|
|
6078
6080
|
));
|
|
6079
6081
|
};
|
|
6080
|
-
const defaultProps$
|
|
6082
|
+
const defaultProps$15 = {
|
|
6081
6083
|
...ComponentDefaults,
|
|
6082
6084
|
defaultValue: [],
|
|
6083
6085
|
type: "custom",
|
|
@@ -6119,7 +6121,7 @@ const InternalAddress = (props, ref) => {
|
|
|
6119
6121
|
onSwitch,
|
|
6120
6122
|
...rest
|
|
6121
6123
|
} = {
|
|
6122
|
-
...defaultProps$
|
|
6124
|
+
...defaultProps$15,
|
|
6123
6125
|
...props
|
|
6124
6126
|
};
|
|
6125
6127
|
const classPrefix2 = "nut-address";
|
|
@@ -6276,33 +6278,6 @@ const isEqual = (date1, date22) => {
|
|
|
6276
6278
|
const endTime = new Date(date22.replace(/-/g, "/")).getTime();
|
|
6277
6279
|
return startTime === endTime;
|
|
6278
6280
|
};
|
|
6279
|
-
const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
|
|
6280
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
|
|
6281
|
-
const nowTime = dateNow.getTime();
|
|
6282
|
-
let day = dateNow.getDay();
|
|
6283
|
-
if (firstDayOfWeek === 0) {
|
|
6284
|
-
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
6285
|
-
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
6286
|
-
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
6287
|
-
const sunday2 = date2Str(new Date(SundayTime2));
|
|
6288
|
-
const saturday = date2Str(new Date(SaturdayTime));
|
|
6289
|
-
return [sunday2, saturday];
|
|
6290
|
-
}
|
|
6291
|
-
day = day === 0 ? 7 : day;
|
|
6292
|
-
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
6293
|
-
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
6294
|
-
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
6295
|
-
const monday = date2Str(new Date(MondayTime));
|
|
6296
|
-
const sunday = date2Str(new Date(SundayTime));
|
|
6297
|
-
return [monday, sunday];
|
|
6298
|
-
};
|
|
6299
|
-
const formatResultDate = (date4) => {
|
|
6300
|
-
const [year, month, day] = [...date4.split("-")];
|
|
6301
|
-
const formatterDay = getNumTwoBit(Number(day));
|
|
6302
|
-
const formatterDate = `${year}-${month}-${day}`;
|
|
6303
|
-
const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
|
|
6304
|
-
return [year, month, formatterDay, formatterDate, dayOfWeek];
|
|
6305
|
-
};
|
|
6306
6281
|
const getCurrMonthData = (type4, year, month) => {
|
|
6307
6282
|
{
|
|
6308
6283
|
month === 12 && (year += 1);
|
|
@@ -6344,6 +6319,74 @@ const getPreMonthDates = (type4, year, month, firstDayOfWeek) => {
|
|
|
6344
6319
|
});
|
|
6345
6320
|
return months.slice(preDates - days);
|
|
6346
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
|
+
};
|
|
6347
6390
|
const splitDate = (date4) => {
|
|
6348
6391
|
const split = date4.indexOf("-") !== -1 ? "-" : "/";
|
|
6349
6392
|
return date4.split(split);
|
|
@@ -6372,7 +6415,89 @@ const isEnd = (day, days) => {
|
|
|
6372
6415
|
const isStartAndEnd = (days) => {
|
|
6373
6416
|
return days.length >= 2 && isEqual(days[0], days[1]);
|
|
6374
6417
|
};
|
|
6375
|
-
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 = {
|
|
6376
6501
|
...ComponentDefaults,
|
|
6377
6502
|
type: "single",
|
|
6378
6503
|
autoBackfill: false,
|
|
@@ -6386,6 +6511,7 @@ const defaultProps$13 = {
|
|
|
6386
6511
|
confirmText: "",
|
|
6387
6512
|
showTitle: true,
|
|
6388
6513
|
showSubTitle: true,
|
|
6514
|
+
showMonthNumber: false,
|
|
6389
6515
|
scrollAnimation: true,
|
|
6390
6516
|
firstDayOfWeek: 0,
|
|
6391
6517
|
disableDate: (date4) => false,
|
|
@@ -6422,19 +6548,20 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6422
6548
|
confirmText,
|
|
6423
6549
|
showTitle,
|
|
6424
6550
|
showSubTitle,
|
|
6551
|
+
showMonthNumber,
|
|
6425
6552
|
scrollAnimation,
|
|
6426
6553
|
firstDayOfWeek,
|
|
6427
6554
|
disableDate,
|
|
6428
6555
|
renderHeaderButtons,
|
|
6556
|
+
renderBottomButton,
|
|
6429
6557
|
renderDay,
|
|
6430
6558
|
renderDayTop,
|
|
6431
6559
|
renderDayBottom,
|
|
6432
|
-
renderBottomButton,
|
|
6433
6560
|
onConfirm,
|
|
6434
6561
|
onUpdate,
|
|
6435
6562
|
onDayClick,
|
|
6436
6563
|
onPageChange
|
|
6437
|
-
} = { ...defaultProps$
|
|
6564
|
+
} = { ...defaultProps$14, ...props };
|
|
6438
6565
|
const classPrefix2 = "nut-calendar";
|
|
6439
6566
|
const dayPrefix = "nut-calendar-day";
|
|
6440
6567
|
const weekdays = locale.calendaritem.weekdays;
|
|
@@ -6461,7 +6588,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6461
6588
|
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
6462
6589
|
return type4 !== "single" ? [...defaultValue] : defaultValue;
|
|
6463
6590
|
}
|
|
6464
|
-
return
|
|
6591
|
+
return type4 === "single" ? "" : [];
|
|
6465
6592
|
};
|
|
6466
6593
|
const [currentDate, setCurrentDate] = usePropsValue({
|
|
6467
6594
|
value,
|
|
@@ -6496,6 +6623,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6496
6623
|
const monthInfo = {
|
|
6497
6624
|
curData: date4,
|
|
6498
6625
|
title: monthTitle(y2, m2),
|
|
6626
|
+
weekNo: getWeekNosOfYear(y2, m2, firstDayOfWeek),
|
|
6499
6627
|
monthData: days,
|
|
6500
6628
|
cssHeight,
|
|
6501
6629
|
scrollTop: scrollTop2
|
|
@@ -6517,7 +6645,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6517
6645
|
const currentMonthsData = monthsData[current];
|
|
6518
6646
|
if (currentMonthsData.title === yearMonthTitle) return;
|
|
6519
6647
|
const [year, month] = currentMonthsData.curData;
|
|
6520
|
-
onPageChange
|
|
6648
|
+
onPageChange == null ? void 0 : onPageChange([year, month, `${year}-${month}`]);
|
|
6521
6649
|
setYearMonthTitle(currentMonthsData.title);
|
|
6522
6650
|
};
|
|
6523
6651
|
const setDefaultRange = (monthNum, current) => {
|
|
@@ -6719,7 +6847,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6719
6847
|
initData();
|
|
6720
6848
|
};
|
|
6721
6849
|
useEffect(() => {
|
|
6722
|
-
setCurrentDate(resetDefaultValue()
|
|
6850
|
+
setCurrentDate(resetDefaultValue());
|
|
6723
6851
|
}, [defaultValue]);
|
|
6724
6852
|
useEffect(() => {
|
|
6725
6853
|
popup && resetRender();
|
|
@@ -6880,7 +7008,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6880
7008
|
}
|
|
6881
7009
|
}
|
|
6882
7010
|
if (!isFirst) {
|
|
6883
|
-
onDayClick
|
|
7011
|
+
onDayClick == null ? void 0 : onDayClick(state.currDateArray);
|
|
6884
7012
|
if (autoBackfill || !popup) {
|
|
6885
7013
|
confirm();
|
|
6886
7014
|
}
|
|
@@ -6890,9 +7018,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6890
7018
|
const confirm = () => {
|
|
6891
7019
|
if (type4 === "range" && state.currDateArray.length === 2 || type4 !== "range") {
|
|
6892
7020
|
const chooseData = state.currDateArray.slice(0);
|
|
6893
|
-
onConfirm
|
|
7021
|
+
onConfirm == null ? void 0 : onConfirm(chooseData);
|
|
6894
7022
|
if (popup) {
|
|
6895
|
-
onUpdate
|
|
7023
|
+
onUpdate == null ? void 0 : onUpdate();
|
|
6896
7024
|
}
|
|
6897
7025
|
}
|
|
6898
7026
|
};
|
|
@@ -6915,7 +7043,14 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6915
7043
|
return currentDate.length >= 2 && (type4 === "range" || type4 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
|
|
6916
7044
|
};
|
|
6917
7045
|
const renderHeader = () => {
|
|
6918
|
-
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
|
+
));
|
|
6919
7054
|
};
|
|
6920
7055
|
const renderItem = (month, day, index) => {
|
|
6921
7056
|
const startTip = isStartTip(day, month);
|
|
@@ -6931,7 +7066,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6931
7066
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
|
|
6932
7067
|
!startTip && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
|
|
6933
7068
|
noStartNorEnd && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
|
|
6934
|
-
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),
|
|
6935
7070
|
startTip && /* @__PURE__ */ React__default.createElement(
|
|
6936
7071
|
"div",
|
|
6937
7072
|
{
|
|
@@ -6947,9 +7082,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6947
7082
|
);
|
|
6948
7083
|
};
|
|
6949
7084
|
const renderPanel = (month, key) => {
|
|
6950
|
-
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(
|
|
6951
7086
|
(day, i2) => renderItem(month, day, i2)
|
|
6952
|
-
)));
|
|
7087
|
+
))));
|
|
6953
7088
|
};
|
|
6954
7089
|
const renderContent = () => {
|
|
6955
7090
|
return /* @__PURE__ */ React__default.createElement(
|
|
@@ -6966,7 +7101,6 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6966
7101
|
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement(
|
|
6967
7102
|
"div",
|
|
6968
7103
|
{
|
|
6969
|
-
className: "viewArea",
|
|
6970
7104
|
ref: viewAreaRef,
|
|
6971
7105
|
style: { transform: `translateY(${translateY}px)` }
|
|
6972
7106
|
},
|
|
@@ -6982,13 +7116,328 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
6982
7116
|
return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
6983
7117
|
});
|
|
6984
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";
|
|
6985
7432
|
const defaultProps$12 = {
|
|
6986
7433
|
...ComponentDefaults,
|
|
6987
7434
|
type: "single",
|
|
7435
|
+
viewMode: "day",
|
|
6988
7436
|
autoBackfill: false,
|
|
6989
7437
|
popup: true,
|
|
6990
7438
|
visible: false,
|
|
6991
7439
|
title: "",
|
|
7440
|
+
value: "",
|
|
6992
7441
|
defaultValue: "",
|
|
6993
7442
|
startDate: getDateString(0),
|
|
6994
7443
|
endDate: getDateString(365),
|
|
@@ -6998,6 +7447,7 @@ const defaultProps$12 = {
|
|
|
6998
7447
|
confirmText: "",
|
|
6999
7448
|
showTitle: true,
|
|
7000
7449
|
showSubTitle: true,
|
|
7450
|
+
showMonthNumber: false,
|
|
7001
7451
|
scrollAnimation: true,
|
|
7002
7452
|
firstDayOfWeek: 0,
|
|
7003
7453
|
disableDate: (date4) => false,
|
|
@@ -7011,6 +7461,8 @@ const defaultProps$12 = {
|
|
|
7011
7461
|
},
|
|
7012
7462
|
onDayClick: (data) => {
|
|
7013
7463
|
},
|
|
7464
|
+
onItemClick: () => {
|
|
7465
|
+
},
|
|
7014
7466
|
onPageChange: (param) => {
|
|
7015
7467
|
}
|
|
7016
7468
|
};
|
|
@@ -7023,8 +7475,10 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7023
7475
|
popup,
|
|
7024
7476
|
visible,
|
|
7025
7477
|
type: type4,
|
|
7478
|
+
viewMode,
|
|
7026
7479
|
autoBackfill,
|
|
7027
7480
|
title,
|
|
7481
|
+
value,
|
|
7028
7482
|
defaultValue,
|
|
7029
7483
|
startDate,
|
|
7030
7484
|
endDate,
|
|
@@ -7034,6 +7488,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7034
7488
|
confirmText,
|
|
7035
7489
|
showTitle,
|
|
7036
7490
|
showSubTitle,
|
|
7491
|
+
showMonthNumber,
|
|
7037
7492
|
scrollAnimation,
|
|
7038
7493
|
firstDayOfWeek,
|
|
7039
7494
|
closeIcon,
|
|
@@ -7046,6 +7501,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7046
7501
|
onClose,
|
|
7047
7502
|
onConfirm,
|
|
7048
7503
|
onDayClick,
|
|
7504
|
+
onItemClick,
|
|
7049
7505
|
onPageChange
|
|
7050
7506
|
} = { ...defaultProps$12, ...props };
|
|
7051
7507
|
const calendarRef = useRef(null);
|
|
@@ -7059,9 +7515,6 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7059
7515
|
const closePopup = () => {
|
|
7060
7516
|
close2();
|
|
7061
7517
|
};
|
|
7062
|
-
const select = (param) => {
|
|
7063
|
-
onDayClick && onDayClick(param);
|
|
7064
|
-
};
|
|
7065
7518
|
const scrollToDate = (date4) => {
|
|
7066
7519
|
var _a;
|
|
7067
7520
|
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date4);
|
|
@@ -7073,7 +7526,25 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7073
7526
|
scrollToDate
|
|
7074
7527
|
}));
|
|
7075
7528
|
const renderItem = () => {
|
|
7076
|
-
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(
|
|
7077
7548
|
CalendarItem,
|
|
7078
7549
|
{
|
|
7079
7550
|
ref: calendarRef,
|
|
@@ -7093,6 +7564,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7093
7564
|
confirmText: confirmText || locale.calendaritem.confirm,
|
|
7094
7565
|
showTitle,
|
|
7095
7566
|
showSubTitle,
|
|
7567
|
+
showMonthNumber,
|
|
7096
7568
|
scrollAnimation,
|
|
7097
7569
|
firstDayOfWeek,
|
|
7098
7570
|
disableDate,
|
|
@@ -7102,12 +7574,12 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7102
7574
|
renderDayTop,
|
|
7103
7575
|
renderDayBottom,
|
|
7104
7576
|
onConfirm: choose,
|
|
7105
|
-
onDayClick
|
|
7577
|
+
onDayClick,
|
|
7106
7578
|
onPageChange: yearMonthChange
|
|
7107
7579
|
}
|
|
7108
|
-
);
|
|
7580
|
+
));
|
|
7109
7581
|
};
|
|
7110
|
-
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(
|
|
7111
7583
|
Popup,
|
|
7112
7584
|
{
|
|
7113
7585
|
className: "nut-calendar-popup",
|
|
@@ -7115,11 +7587,11 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
7115
7587
|
position: "bottom",
|
|
7116
7588
|
round: true,
|
|
7117
7589
|
closeable: true,
|
|
7590
|
+
closeIcon,
|
|
7118
7591
|
destroyOnClose: true,
|
|
7119
7592
|
onOverlayClick: closePopup,
|
|
7120
7593
|
onCloseIconClick: closePopup,
|
|
7121
|
-
style: { height: "83%" }
|
|
7122
|
-
closeIcon
|
|
7594
|
+
style: { height: "83%" }
|
|
7123
7595
|
},
|
|
7124
7596
|
renderItem()
|
|
7125
7597
|
) : renderItem());
|
|
@@ -10866,7 +11338,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10866
11338
|
useEffect(() => {
|
|
10867
11339
|
getParentOffset();
|
|
10868
11340
|
}, [showPopup, getParentOffset]);
|
|
10869
|
-
const windowHeight = useMemo$1(() =>
|
|
11341
|
+
const windowHeight = useMemo$1(() => getWindowInfo().windowHeight, []);
|
|
10870
11342
|
const updateItemOffset = useCallback(() => {
|
|
10871
11343
|
if (!parent.lockScroll) return;
|
|
10872
11344
|
const p = parent.menuRef.current;
|
|
@@ -10916,7 +11388,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10916
11388
|
bottom: "0",
|
|
10917
11389
|
height: "initial"
|
|
10918
11390
|
} : {
|
|
10919
|
-
bottom: `${
|
|
11391
|
+
bottom: `${getWindowInfo().windowHeight - position.top}px`,
|
|
10920
11392
|
top: "0",
|
|
10921
11393
|
height: "initial"
|
|
10922
11394
|
};
|
|
@@ -10929,7 +11401,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
10929
11401
|
};
|
|
10930
11402
|
}
|
|
10931
11403
|
return {
|
|
10932
|
-
height: `${
|
|
11404
|
+
height: `${getWindowInfo().windowHeight - position.top}px`,
|
|
10933
11405
|
top: "auto",
|
|
10934
11406
|
...isShow()
|
|
10935
11407
|
};
|
|
@@ -13557,7 +14029,7 @@ function useParams(args) {
|
|
|
13557
14029
|
const stateRef = useRef(args);
|
|
13558
14030
|
const currentRef = useRef();
|
|
13559
14031
|
const previousRef = useRef();
|
|
13560
|
-
if (!
|
|
14032
|
+
if (!isEqual$1(currentRef.current, args)) {
|
|
13561
14033
|
previousRef.current = currentRef.current;
|
|
13562
14034
|
currentRef.current = args;
|
|
13563
14035
|
stateRef.current = args;
|
|
@@ -13794,7 +14266,7 @@ const Drag = (props) => {
|
|
|
13794
14266
|
const el = myDrag.current;
|
|
13795
14267
|
if (el) {
|
|
13796
14268
|
const { top, left: left2, bottom, right: right2 } = boundary;
|
|
13797
|
-
const { screenWidth, windowHeight } =
|
|
14269
|
+
const { screenWidth, windowHeight } = getWindowInfo();
|
|
13798
14270
|
const {
|
|
13799
14271
|
width,
|
|
13800
14272
|
height,
|
|
@@ -15071,7 +15543,7 @@ const PullToRefresh = (p) => {
|
|
|
15071
15543
|
setStatus("pulling");
|
|
15072
15544
|
}
|
|
15073
15545
|
};
|
|
15074
|
-
const isAndroidWeApp =
|
|
15546
|
+
const isAndroidWeApp = getDeviceInfo().platform === "android" && Taro.getEnv() === "WEAPP";
|
|
15075
15547
|
const springStyles = {
|
|
15076
15548
|
height: `${height}px`,
|
|
15077
15549
|
...!pullingRef.current || isAndroidWeApp ? { transition: "height .3s ease" } : {}
|
|
@@ -17983,18 +18455,6 @@ const getTaroRectById = (id) => {
|
|
|
17983
18455
|
}
|
|
17984
18456
|
});
|
|
17985
18457
|
};
|
|
17986
|
-
const defaultConfigRef = {
|
|
17987
|
-
current: {
|
|
17988
|
-
locale: zhCN
|
|
17989
|
-
}
|
|
17990
|
-
};
|
|
17991
|
-
const getDefaultConfig = () => {
|
|
17992
|
-
return defaultConfigRef.current;
|
|
17993
|
-
};
|
|
17994
|
-
const ConfigContext = createContext(null);
|
|
17995
|
-
const useConfig = () => {
|
|
17996
|
-
return useContext(ConfigContext) ?? getDefaultConfig();
|
|
17997
|
-
};
|
|
17998
18458
|
const defaultProps$9 = {
|
|
17999
18459
|
...ComponentDefaults,
|
|
18000
18460
|
visible: false,
|
|
@@ -18275,7 +18735,7 @@ const VirtualList = (props) => {
|
|
|
18275
18735
|
...props
|
|
18276
18736
|
};
|
|
18277
18737
|
const clientHeight = useMemo$1(
|
|
18278
|
-
() =>
|
|
18738
|
+
() => getWindowInfo().windowHeight - 5 || 667,
|
|
18279
18739
|
[]
|
|
18280
18740
|
);
|
|
18281
18741
|
const containerHeight = useMemo$1(
|
|
@@ -19049,7 +19509,7 @@ const AvatarCropper = (props) => {
|
|
|
19049
19509
|
const [visible, setVisible] = useState(false);
|
|
19050
19510
|
const [moving, setMoving] = useState(false);
|
|
19051
19511
|
const [zooming, setZooming] = useState(false);
|
|
19052
|
-
const systemInfo =
|
|
19512
|
+
const systemInfo = getWindowInfo();
|
|
19053
19513
|
const showAlipayCanvas2D = useMemo$1(() => {
|
|
19054
19514
|
return Taro.getEnv() === "ALIPAY" && parseInt(Taro.SDKVersion.replace(/\./g, "")) >= 270;
|
|
19055
19515
|
}, []);
|