@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.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
|
|
3
3
|
})(this, function(exports2, React, Taro, components, ReactDOM) {
|
|
4
4
|
"use strict";/*!
|
|
5
|
-
* @nutui/nutui-react-taro v2.7.
|
|
5
|
+
* @nutui/nutui-react-taro v2.7.10 Fri Mar 14 2025 14:50:54 GMT+0800 (China Standard Time)
|
|
6
6
|
* (c) 2023 @jdf2e.
|
|
7
7
|
* Released under the MIT License.
|
|
8
8
|
*/
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
style: {}
|
|
281
281
|
};
|
|
282
282
|
const prefixCls$2 = "nut-button";
|
|
283
|
-
const defaultProps$
|
|
283
|
+
const defaultProps$1v = {
|
|
284
284
|
...ComponentDefaults,
|
|
285
285
|
color: "",
|
|
286
286
|
type: "default",
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
onClick,
|
|
316
316
|
...rest
|
|
317
317
|
} = {
|
|
318
|
-
...defaultProps$
|
|
318
|
+
...defaultProps$1v,
|
|
319
319
|
...props
|
|
320
320
|
};
|
|
321
321
|
const getStyle = React.useCallback(() => {
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
);
|
|
383
383
|
Button.displayName = "NutButton";
|
|
384
384
|
const CellGroupContext = React.createContext(null);
|
|
385
|
-
const defaultProps$
|
|
385
|
+
const defaultProps$1u = {
|
|
386
386
|
...ComponentDefaults,
|
|
387
387
|
title: "",
|
|
388
388
|
description: "",
|
|
@@ -391,7 +391,7 @@
|
|
|
391
391
|
const classPrefix$r = "nut-cell-group";
|
|
392
392
|
const CellGroup = (props) => {
|
|
393
393
|
const { children, className, title, description, divider, ...rest } = {
|
|
394
|
-
...defaultProps$
|
|
394
|
+
...defaultProps$1u,
|
|
395
395
|
...props
|
|
396
396
|
};
|
|
397
397
|
return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix$r, className), ...rest }, title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$r}-title` }, title) : null, description ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$r}-description` }, description) : null, /* @__PURE__ */ React.createElement(
|
|
@@ -403,7 +403,7 @@
|
|
|
403
403
|
));
|
|
404
404
|
};
|
|
405
405
|
CellGroup.displayName = "NutCellGroup";
|
|
406
|
-
const defaultProps$
|
|
406
|
+
const defaultProps$1t = {
|
|
407
407
|
...ComponentDefaults,
|
|
408
408
|
title: null,
|
|
409
409
|
description: null,
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
clickable,
|
|
431
431
|
...rest
|
|
432
432
|
} = {
|
|
433
|
-
...defaultProps$
|
|
433
|
+
...defaultProps$1t,
|
|
434
434
|
...props
|
|
435
435
|
};
|
|
436
436
|
const handleClick = (event) => {
|
|
@@ -1398,7 +1398,7 @@
|
|
|
1398
1398
|
module2.exports = isEqual2;
|
|
1399
1399
|
})(lodash_isequal, lodash_isequal.exports);
|
|
1400
1400
|
var lodash_isequalExports = lodash_isequal.exports;
|
|
1401
|
-
const
|
|
1401
|
+
const isEqual$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_isequalExports);
|
|
1402
1402
|
function useMemo(getValue2, condition, shouldUpdate) {
|
|
1403
1403
|
const cacheRef = React__namespace.useRef({});
|
|
1404
1404
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
@@ -1443,6 +1443,10 @@
|
|
|
1443
1443
|
start: "开始",
|
|
1444
1444
|
confirm: "确认",
|
|
1445
1445
|
title: "日历选择",
|
|
1446
|
+
week: "周",
|
|
1447
|
+
month: "月",
|
|
1448
|
+
year: "年",
|
|
1449
|
+
quarter: "季度",
|
|
1446
1450
|
monthTitle: (year, month) => `${year}年${Number(month) < 10 ? `0${Number(month)}` : month}月`,
|
|
1447
1451
|
today: "今天",
|
|
1448
1452
|
loadPreviousMonth: "加载上一个月",
|
|
@@ -1586,7 +1590,7 @@
|
|
|
1586
1590
|
[config2, direction],
|
|
1587
1591
|
(prev, next) => prev.some((prevTheme, index) => {
|
|
1588
1592
|
const nextTheme = next[index];
|
|
1589
|
-
return !
|
|
1593
|
+
return !isEqual$1(prevTheme, nextTheme);
|
|
1590
1594
|
})
|
|
1591
1595
|
);
|
|
1592
1596
|
const cssVarStyle = React.useMemo(() => {
|
|
@@ -1609,7 +1613,7 @@
|
|
|
1609
1613
|
const pxCheck = (value) => {
|
|
1610
1614
|
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
1611
1615
|
};
|
|
1612
|
-
const defaultProps$
|
|
1616
|
+
const defaultProps$1s = {
|
|
1613
1617
|
src: "",
|
|
1614
1618
|
error: true,
|
|
1615
1619
|
loading: true
|
|
@@ -1628,7 +1632,7 @@
|
|
|
1628
1632
|
onLoad,
|
|
1629
1633
|
onError,
|
|
1630
1634
|
...rest
|
|
1631
|
-
} = { ...defaultProps$
|
|
1635
|
+
} = { ...defaultProps$1s, ...props };
|
|
1632
1636
|
const [innerLoading, setInnerLoading] = React.useState(true);
|
|
1633
1637
|
const [isError, setIsError] = React.useState(false);
|
|
1634
1638
|
const handleLoad = (e2) => {
|
|
@@ -3647,7 +3651,7 @@
|
|
|
3647
3651
|
};
|
|
3648
3652
|
Overlay.displayName = "NutOverlay";
|
|
3649
3653
|
const DataContext$1 = React.createContext({});
|
|
3650
|
-
const defaultProps$
|
|
3654
|
+
const defaultProps$1r = {
|
|
3651
3655
|
...ComponentDefaults,
|
|
3652
3656
|
span: "24",
|
|
3653
3657
|
offset: "0",
|
|
@@ -3655,7 +3659,7 @@
|
|
|
3655
3659
|
};
|
|
3656
3660
|
const Col = (props) => {
|
|
3657
3661
|
const { className, style, span, offset, children, onClick } = {
|
|
3658
|
-
...defaultProps$
|
|
3662
|
+
...defaultProps$1r,
|
|
3659
3663
|
...props
|
|
3660
3664
|
};
|
|
3661
3665
|
const [colName, setColName] = React.useState("");
|
|
@@ -3688,7 +3692,7 @@
|
|
|
3688
3692
|
);
|
|
3689
3693
|
};
|
|
3690
3694
|
Col.displayName = "NutCol";
|
|
3691
|
-
const defaultProps$
|
|
3695
|
+
const defaultProps$1q = {
|
|
3692
3696
|
...ComponentDefaults,
|
|
3693
3697
|
contentPosition: "center",
|
|
3694
3698
|
direction: "horizontal"
|
|
@@ -3696,7 +3700,7 @@
|
|
|
3696
3700
|
const classPrefix$o = `nut-divider`;
|
|
3697
3701
|
const Divider = (props) => {
|
|
3698
3702
|
const { children, contentPosition, style, className, direction, ...rest } = {
|
|
3699
|
-
...defaultProps$
|
|
3703
|
+
...defaultProps$1q,
|
|
3700
3704
|
...props
|
|
3701
3705
|
};
|
|
3702
3706
|
const classes = direction === "horizontal" ? classNames({
|
|
@@ -3717,7 +3721,7 @@
|
|
|
3717
3721
|
}
|
|
3718
3722
|
};
|
|
3719
3723
|
const GridContext = React.createContext(gridContext);
|
|
3720
|
-
const defaultProps$
|
|
3724
|
+
const defaultProps$1p = {
|
|
3721
3725
|
text: "",
|
|
3722
3726
|
columns: 4,
|
|
3723
3727
|
gap: 0,
|
|
@@ -3742,7 +3746,7 @@
|
|
|
3742
3746
|
onClick,
|
|
3743
3747
|
...rest
|
|
3744
3748
|
} = {
|
|
3745
|
-
...defaultProps$
|
|
3749
|
+
...defaultProps$1p,
|
|
3746
3750
|
...props
|
|
3747
3751
|
};
|
|
3748
3752
|
const classPrefix2 = "nut-grid-item";
|
|
@@ -3801,7 +3805,7 @@
|
|
|
3801
3805
|
);
|
|
3802
3806
|
};
|
|
3803
3807
|
GridItem.displayName = "NutGridItem";
|
|
3804
|
-
const defaultProps$
|
|
3808
|
+
const defaultProps$1o = {
|
|
3805
3809
|
columns: 4,
|
|
3806
3810
|
gap: 0,
|
|
3807
3811
|
center: true,
|
|
@@ -3822,7 +3826,7 @@
|
|
|
3822
3826
|
className,
|
|
3823
3827
|
onClick,
|
|
3824
3828
|
...rest
|
|
3825
|
-
} = { ...defaultProps$
|
|
3829
|
+
} = { ...defaultProps$1o, ...props };
|
|
3826
3830
|
const childrenDom = React.Children.toArray(children);
|
|
3827
3831
|
const classPrefix2 = "nut-grid";
|
|
3828
3832
|
const rootClass = () => {
|
|
@@ -3863,7 +3867,7 @@
|
|
|
3863
3867
|
};
|
|
3864
3868
|
Layout.displayName = "NutLayout";
|
|
3865
3869
|
const classPrefix$n = "nut-row";
|
|
3866
|
-
const defaultProps$
|
|
3870
|
+
const defaultProps$1n = {
|
|
3867
3871
|
...ComponentDefaults,
|
|
3868
3872
|
type: "",
|
|
3869
3873
|
justify: "start",
|
|
@@ -3883,7 +3887,7 @@
|
|
|
3883
3887
|
gutter,
|
|
3884
3888
|
onClick
|
|
3885
3889
|
} = {
|
|
3886
|
-
...defaultProps$
|
|
3890
|
+
...defaultProps$1n,
|
|
3887
3891
|
...props
|
|
3888
3892
|
};
|
|
3889
3893
|
const getClass = (prefix, type22) => {
|
|
@@ -3917,12 +3921,12 @@
|
|
|
3917
3921
|
};
|
|
3918
3922
|
Row.displayName = "NutRow";
|
|
3919
3923
|
const prefixCls$1 = "nut-space";
|
|
3920
|
-
const defaultProps$
|
|
3924
|
+
const defaultProps$1m = {
|
|
3921
3925
|
direction: "horizontal"
|
|
3922
3926
|
};
|
|
3923
3927
|
const Space = (props) => {
|
|
3924
3928
|
const { className, style, children, wrap, align, direction, justify } = {
|
|
3925
|
-
...defaultProps$
|
|
3929
|
+
...defaultProps$1m,
|
|
3926
3930
|
...props
|
|
3927
3931
|
};
|
|
3928
3932
|
const cls = classNames(
|
|
@@ -3938,6 +3942,12 @@
|
|
|
3938
3942
|
}));
|
|
3939
3943
|
};
|
|
3940
3944
|
Space.displayName = "NutSpace";
|
|
3945
|
+
const getDeviceInfo = () => {
|
|
3946
|
+
return Taro.canIUse("getDeviceInfo") ? Taro.getDeviceInfo() : Taro.getSystemInfoSync();
|
|
3947
|
+
};
|
|
3948
|
+
const getWindowInfo = () => {
|
|
3949
|
+
return Taro.canIUse("getWindowInfo") ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
3950
|
+
};
|
|
3941
3951
|
function useWatch$1(dep, callback, config2 = { immediate: false }) {
|
|
3942
3952
|
const { immediate } = config2;
|
|
3943
3953
|
const prev = React.useRef();
|
|
@@ -4051,7 +4061,7 @@
|
|
|
4051
4061
|
}
|
|
4052
4062
|
return Promise.resolve(makeRect(0, 0));
|
|
4053
4063
|
};
|
|
4054
|
-
const defaultProps$
|
|
4064
|
+
const defaultProps$1l = {
|
|
4055
4065
|
...ComponentDefaults,
|
|
4056
4066
|
position: "top",
|
|
4057
4067
|
zIndex: 900
|
|
@@ -4068,7 +4078,7 @@
|
|
|
4068
4078
|
className,
|
|
4069
4079
|
onChange,
|
|
4070
4080
|
...rest
|
|
4071
|
-
} = { ...defaultProps$
|
|
4081
|
+
} = { ...defaultProps$1l, ...props };
|
|
4072
4082
|
const stickyRef = React.useRef(null);
|
|
4073
4083
|
const rootRef = React.useRef(null);
|
|
4074
4084
|
const [rootRect, setRootRect] = React.useState({});
|
|
@@ -4135,7 +4145,7 @@
|
|
|
4135
4145
|
setFixed(threshold > curRootRect.top);
|
|
4136
4146
|
}
|
|
4137
4147
|
} else {
|
|
4138
|
-
const windowHeight =
|
|
4148
|
+
const windowHeight = getWindowInfo().windowHeight;
|
|
4139
4149
|
setFixed(windowHeight - threshold < curRootRect.bottom);
|
|
4140
4150
|
}
|
|
4141
4151
|
};
|
|
@@ -4192,7 +4202,7 @@
|
|
|
4192
4202
|
);
|
|
4193
4203
|
};
|
|
4194
4204
|
SafeArea.displayName = "NutSafeArea";
|
|
4195
|
-
const defaultProps$
|
|
4205
|
+
const defaultProps$1k = {
|
|
4196
4206
|
...ComponentDefaults,
|
|
4197
4207
|
threshold: 200,
|
|
4198
4208
|
zIndex: 900,
|
|
@@ -4201,7 +4211,7 @@
|
|
|
4201
4211
|
const BackTop = (props) => {
|
|
4202
4212
|
const rtl = useRtl();
|
|
4203
4213
|
const { children, threshold, zIndex, className, duration, style, onClick } = {
|
|
4204
|
-
...defaultProps$
|
|
4214
|
+
...defaultProps$1k,
|
|
4205
4215
|
...props
|
|
4206
4216
|
};
|
|
4207
4217
|
const classPrefix2 = "nut-backtop";
|
|
@@ -4249,7 +4259,7 @@
|
|
|
4249
4259
|
return idRef.current;
|
|
4250
4260
|
}
|
|
4251
4261
|
const elevatorContext = React.createContext({});
|
|
4252
|
-
const defaultProps$
|
|
4262
|
+
const defaultProps$1j = {
|
|
4253
4263
|
...ComponentDefaults,
|
|
4254
4264
|
height: "200px",
|
|
4255
4265
|
floorKey: "title",
|
|
@@ -4276,7 +4286,7 @@
|
|
|
4276
4286
|
children,
|
|
4277
4287
|
...rest
|
|
4278
4288
|
} = {
|
|
4279
|
-
...defaultProps$
|
|
4289
|
+
...defaultProps$1j,
|
|
4280
4290
|
...props
|
|
4281
4291
|
};
|
|
4282
4292
|
const uuid = useUuid();
|
|
@@ -4502,7 +4512,7 @@
|
|
|
4502
4512
|
};
|
|
4503
4513
|
Elevator.displayName = "NutElevator";
|
|
4504
4514
|
Elevator.Context = elevatorContext;
|
|
4505
|
-
const defaultProps$
|
|
4515
|
+
const defaultProps$1i = {
|
|
4506
4516
|
...ComponentDefaults,
|
|
4507
4517
|
activeText: "",
|
|
4508
4518
|
inactiveText: "",
|
|
@@ -4530,7 +4540,7 @@
|
|
|
4530
4540
|
content,
|
|
4531
4541
|
...rest
|
|
4532
4542
|
} = {
|
|
4533
|
-
...defaultProps$
|
|
4543
|
+
...defaultProps$1i,
|
|
4534
4544
|
...props
|
|
4535
4545
|
};
|
|
4536
4546
|
const classPrefix2 = "nut-fixednav";
|
|
@@ -4583,7 +4593,7 @@
|
|
|
4583
4593
|
);
|
|
4584
4594
|
};
|
|
4585
4595
|
FixedNav.displayName = "NutFixedNav";
|
|
4586
|
-
const defaultProps$
|
|
4596
|
+
const defaultProps$1h = {
|
|
4587
4597
|
...ComponentDefaults,
|
|
4588
4598
|
left: "",
|
|
4589
4599
|
right: "",
|
|
@@ -4608,7 +4618,7 @@
|
|
|
4608
4618
|
zIndex,
|
|
4609
4619
|
onBackClick
|
|
4610
4620
|
} = {
|
|
4611
|
-
...defaultProps$
|
|
4621
|
+
...defaultProps$1h,
|
|
4612
4622
|
...props
|
|
4613
4623
|
};
|
|
4614
4624
|
const classPrefix2 = "nut-navbar";
|
|
@@ -4686,7 +4696,7 @@
|
|
|
4686
4696
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
|
|
4687
4697
|
};
|
|
4688
4698
|
NavBar.displayName = "NutNavBar";
|
|
4689
|
-
const defaultProps$
|
|
4699
|
+
const defaultProps$1g = {
|
|
4690
4700
|
...ComponentDefaults,
|
|
4691
4701
|
position: "center",
|
|
4692
4702
|
transition: "",
|
|
@@ -4739,7 +4749,7 @@
|
|
|
4739
4749
|
afterShow,
|
|
4740
4750
|
afterClose,
|
|
4741
4751
|
onClick
|
|
4742
|
-
} = { ...defaultProps$
|
|
4752
|
+
} = { ...defaultProps$1g, ...props };
|
|
4743
4753
|
let innerIndex = zIndex || _zIndex;
|
|
4744
4754
|
const [index, setIndex] = React.useState(innerIndex);
|
|
4745
4755
|
const [innerVisible, setInnerVisible] = React.useState(visible);
|
|
@@ -4882,7 +4892,7 @@
|
|
|
4882
4892
|
};
|
|
4883
4893
|
Popup.displayName = "NutPopup";
|
|
4884
4894
|
const OffsetContext = React.createContext(20);
|
|
4885
|
-
const defaultProps$
|
|
4895
|
+
const defaultProps$1f = {
|
|
4886
4896
|
...ComponentDefaults,
|
|
4887
4897
|
position: "left",
|
|
4888
4898
|
width: "80%"
|
|
@@ -4900,7 +4910,7 @@
|
|
|
4900
4910
|
indent,
|
|
4901
4911
|
...rest
|
|
4902
4912
|
} = {
|
|
4903
|
-
...defaultProps$
|
|
4913
|
+
...defaultProps$1f,
|
|
4904
4914
|
...props
|
|
4905
4915
|
};
|
|
4906
4916
|
const innerIndent = indent ? Number(indent) : 20;
|
|
@@ -4958,13 +4968,13 @@
|
|
|
4958
4968
|
title
|
|
4959
4969
|
);
|
|
4960
4970
|
};
|
|
4961
|
-
const defaultProps$
|
|
4971
|
+
const defaultProps$1e = {
|
|
4962
4972
|
open: true
|
|
4963
4973
|
};
|
|
4964
4974
|
const SubSideNavBar = (props) => {
|
|
4965
4975
|
const classPrefix2 = "nut-subsidenavbar";
|
|
4966
4976
|
const { title, value, children, onClick, open: open2, ...rest } = {
|
|
4967
|
-
...defaultProps$
|
|
4977
|
+
...defaultProps$1e,
|
|
4968
4978
|
...props
|
|
4969
4979
|
};
|
|
4970
4980
|
const [subShow, setSubShow] = React.useState(open2);
|
|
@@ -5042,7 +5052,7 @@
|
|
|
5042
5052
|
);
|
|
5043
5053
|
return [stateRef.current, setState];
|
|
5044
5054
|
}
|
|
5045
|
-
const defaultProps$
|
|
5055
|
+
const defaultProps$1d = {
|
|
5046
5056
|
...ComponentDefaults,
|
|
5047
5057
|
value: "",
|
|
5048
5058
|
dot: false,
|
|
@@ -5067,7 +5077,7 @@
|
|
|
5067
5077
|
color,
|
|
5068
5078
|
fill
|
|
5069
5079
|
} = {
|
|
5070
|
-
...defaultProps$
|
|
5080
|
+
...defaultProps$1d,
|
|
5071
5081
|
...props
|
|
5072
5082
|
};
|
|
5073
5083
|
const classPrefix2 = "nut-badge";
|
|
@@ -5121,7 +5131,7 @@
|
|
|
5121
5131
|
};
|
|
5122
5132
|
Badge.displayName = "NutBadge";
|
|
5123
5133
|
const TabbarContext = React.createContext(null);
|
|
5124
|
-
const defaultProps$
|
|
5134
|
+
const defaultProps$1c = {
|
|
5125
5135
|
...ComponentDefaults,
|
|
5126
5136
|
title: "",
|
|
5127
5137
|
icon: null,
|
|
@@ -5147,7 +5157,7 @@
|
|
|
5147
5157
|
index,
|
|
5148
5158
|
...rest
|
|
5149
5159
|
} = {
|
|
5150
|
-
...defaultProps$
|
|
5160
|
+
...defaultProps$1c,
|
|
5151
5161
|
...props
|
|
5152
5162
|
};
|
|
5153
5163
|
const active = index === (ctx == null ? void 0 : ctx.selectIndex);
|
|
@@ -5185,7 +5195,7 @@
|
|
|
5185
5195
|
icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: titleClass }, title))
|
|
5186
5196
|
);
|
|
5187
5197
|
};
|
|
5188
|
-
const defaultProps$
|
|
5198
|
+
const defaultProps$1b = {
|
|
5189
5199
|
...ComponentDefaults,
|
|
5190
5200
|
defaultValue: 0,
|
|
5191
5201
|
fixed: false,
|
|
@@ -5208,7 +5218,7 @@
|
|
|
5208
5218
|
style,
|
|
5209
5219
|
onSwitch
|
|
5210
5220
|
} = {
|
|
5211
|
-
...defaultProps$
|
|
5221
|
+
...defaultProps$1b,
|
|
5212
5222
|
...props
|
|
5213
5223
|
};
|
|
5214
5224
|
const classPrefix2 = "nut-tabbar";
|
|
@@ -5250,14 +5260,14 @@
|
|
|
5250
5260
|
};
|
|
5251
5261
|
Tabbar.displayName = "NutTabbar";
|
|
5252
5262
|
Tabbar.Item = TabbarItem;
|
|
5253
|
-
const defaultProps$
|
|
5263
|
+
const defaultProps$1a = {
|
|
5254
5264
|
title: "",
|
|
5255
5265
|
value: "",
|
|
5256
5266
|
disabled: false
|
|
5257
5267
|
};
|
|
5258
5268
|
const TabPane = (props) => {
|
|
5259
5269
|
const { children, autoHeightClassName, className, disabled } = {
|
|
5260
|
-
...defaultProps$
|
|
5270
|
+
...defaultProps$1a,
|
|
5261
5271
|
...props
|
|
5262
5272
|
};
|
|
5263
5273
|
const classPrefix2 = "nut-tabpane";
|
|
@@ -5284,7 +5294,7 @@
|
|
|
5284
5294
|
};
|
|
5285
5295
|
}
|
|
5286
5296
|
const requestAniFrame$1 = requestAniFrame();
|
|
5287
|
-
const defaultProps$
|
|
5297
|
+
const defaultProps$19 = {
|
|
5288
5298
|
...ComponentDefaults,
|
|
5289
5299
|
tabStyle: {},
|
|
5290
5300
|
activeColor: "",
|
|
@@ -5313,7 +5323,7 @@
|
|
|
5313
5323
|
value: outerValue,
|
|
5314
5324
|
defaultValue: outerDefaultValue,
|
|
5315
5325
|
...rest
|
|
5316
|
-
} = { ...defaultProps$
|
|
5326
|
+
} = { ...defaultProps$19, ...props };
|
|
5317
5327
|
const uuid = useUuid();
|
|
5318
5328
|
const [value, setValue] = usePropsValue({
|
|
5319
5329
|
value: outerValue,
|
|
@@ -5380,14 +5390,8 @@
|
|
|
5380
5390
|
const [scrollLeft, setScrollLeft] = React.useState(0);
|
|
5381
5391
|
const [scrollTop, setScrollTop] = React.useState(0);
|
|
5382
5392
|
const scrollDirection = (to, direction2) => {
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
function animate() {
|
|
5386
|
-
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5387
|
-
else setScrollTop(to);
|
|
5388
|
-
if (++count < frames) requestAniFrame$1(animate);
|
|
5389
|
-
}
|
|
5390
|
-
animate();
|
|
5393
|
+
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5394
|
+
else setScrollTop(to);
|
|
5391
5395
|
};
|
|
5392
5396
|
const scrollIntoView = (index) => {
|
|
5393
5397
|
requestAniFrame$1(() => {
|
|
@@ -5404,13 +5408,11 @@
|
|
|
5404
5408
|
} else {
|
|
5405
5409
|
const left2 = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
|
|
5406
5410
|
to = left2 - (navRect.width - titleRect.width) / 2;
|
|
5407
|
-
if (to < 0) return;
|
|
5408
|
-
to = rtl ? -to : to;
|
|
5409
5411
|
}
|
|
5412
|
+
scrollDirection(to, direction);
|
|
5410
5413
|
Taro.nextTick(() => {
|
|
5411
5414
|
scrollWithAnimation.current = true;
|
|
5412
5415
|
});
|
|
5413
|
-
scrollDirection(to, direction);
|
|
5414
5416
|
});
|
|
5415
5417
|
});
|
|
5416
5418
|
};
|
|
@@ -5503,7 +5505,7 @@
|
|
|
5503
5505
|
};
|
|
5504
5506
|
Tabs.displayName = "NutTabs";
|
|
5505
5507
|
Tabs.TabPane = TabPane;
|
|
5506
|
-
const defaultProps$
|
|
5508
|
+
const defaultProps$18 = {
|
|
5507
5509
|
type: "custom",
|
|
5508
5510
|
existList: [],
|
|
5509
5511
|
defaultIcon: null,
|
|
@@ -5522,7 +5524,7 @@
|
|
|
5522
5524
|
onSelect,
|
|
5523
5525
|
onSwitch,
|
|
5524
5526
|
...rest
|
|
5525
|
-
} = { ...defaultProps$
|
|
5527
|
+
} = { ...defaultProps$18, ...props };
|
|
5526
5528
|
const classPrefix2 = "nut-address";
|
|
5527
5529
|
const selectedExist = (item) => {
|
|
5528
5530
|
existList.forEach((list, index) => {
|
|
@@ -5684,7 +5686,7 @@
|
|
|
5684
5686
|
return pathNodes;
|
|
5685
5687
|
}
|
|
5686
5688
|
}
|
|
5687
|
-
const defaultProps$
|
|
5689
|
+
const defaultProps$17 = {
|
|
5688
5690
|
...ComponentDefaults,
|
|
5689
5691
|
activeColor: "",
|
|
5690
5692
|
activeIcon: "checklist",
|
|
@@ -5730,7 +5732,7 @@
|
|
|
5730
5732
|
onClose,
|
|
5731
5733
|
onChange,
|
|
5732
5734
|
onPathChange
|
|
5733
|
-
} = { ...defaultProps$
|
|
5735
|
+
} = { ...defaultProps$17, ...props };
|
|
5734
5736
|
const [tabvalue, setTabvalue] = React.useState("c1");
|
|
5735
5737
|
const [optionsData, setOptionsData] = React.useState([]);
|
|
5736
5738
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
@@ -6041,7 +6043,7 @@
|
|
|
6041
6043
|
};
|
|
6042
6044
|
const Cascader = React.forwardRef(InternalCascader);
|
|
6043
6045
|
Cascader.displayName = "NutCascader";
|
|
6044
|
-
const defaultProps$
|
|
6046
|
+
const defaultProps$16 = {
|
|
6045
6047
|
...ComponentDefaults,
|
|
6046
6048
|
visible: false,
|
|
6047
6049
|
type: "custom",
|
|
@@ -6068,7 +6070,7 @@
|
|
|
6068
6070
|
onPathChange,
|
|
6069
6071
|
...rest
|
|
6070
6072
|
} = {
|
|
6071
|
-
...defaultProps$
|
|
6073
|
+
...defaultProps$16,
|
|
6072
6074
|
...props
|
|
6073
6075
|
};
|
|
6074
6076
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, type2 === "custom" && /* @__PURE__ */ React.createElement(
|
|
@@ -6093,7 +6095,7 @@
|
|
|
6093
6095
|
}
|
|
6094
6096
|
));
|
|
6095
6097
|
};
|
|
6096
|
-
const defaultProps$
|
|
6098
|
+
const defaultProps$15 = {
|
|
6097
6099
|
...ComponentDefaults,
|
|
6098
6100
|
defaultValue: [],
|
|
6099
6101
|
type: "custom",
|
|
@@ -6135,7 +6137,7 @@
|
|
|
6135
6137
|
onSwitch,
|
|
6136
6138
|
...rest
|
|
6137
6139
|
} = {
|
|
6138
|
-
...defaultProps$
|
|
6140
|
+
...defaultProps$15,
|
|
6139
6141
|
...props
|
|
6140
6142
|
};
|
|
6141
6143
|
const classPrefix2 = "nut-address";
|
|
@@ -6292,33 +6294,6 @@
|
|
|
6292
6294
|
const endTime = new Date(date2.replace(/-/g, "/")).getTime();
|
|
6293
6295
|
return startTime === endTime;
|
|
6294
6296
|
};
|
|
6295
|
-
const getWeekDate = (year, month, date2, firstDayOfWeek = 0) => {
|
|
6296
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
|
|
6297
|
-
const nowTime = dateNow.getTime();
|
|
6298
|
-
let day = dateNow.getDay();
|
|
6299
|
-
if (firstDayOfWeek === 0) {
|
|
6300
|
-
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
6301
|
-
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
6302
|
-
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
6303
|
-
const sunday2 = date2Str(new Date(SundayTime2));
|
|
6304
|
-
const saturday = date2Str(new Date(SaturdayTime));
|
|
6305
|
-
return [sunday2, saturday];
|
|
6306
|
-
}
|
|
6307
|
-
day = day === 0 ? 7 : day;
|
|
6308
|
-
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
6309
|
-
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
6310
|
-
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
6311
|
-
const monday = date2Str(new Date(MondayTime));
|
|
6312
|
-
const sunday = date2Str(new Date(SundayTime));
|
|
6313
|
-
return [monday, sunday];
|
|
6314
|
-
};
|
|
6315
|
-
const formatResultDate = (date2) => {
|
|
6316
|
-
const [year, month, day] = [...date2.split("-")];
|
|
6317
|
-
const formatterDay = getNumTwoBit(Number(day));
|
|
6318
|
-
const formatterDate = `${year}-${month}-${day}`;
|
|
6319
|
-
const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
|
|
6320
|
-
return [year, month, formatterDay, formatterDate, dayOfWeek];
|
|
6321
|
-
};
|
|
6322
6297
|
const getCurrMonthData = (type2, year, month) => {
|
|
6323
6298
|
{
|
|
6324
6299
|
month === 12 && (year += 1);
|
|
@@ -6360,6 +6335,74 @@
|
|
|
6360
6335
|
});
|
|
6361
6336
|
return months.slice(preDates - days);
|
|
6362
6337
|
};
|
|
6338
|
+
const getWeekDate = (year, month, date2, firstDayOfWeek = 0) => {
|
|
6339
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
|
|
6340
|
+
const nowTime = dateNow.getTime();
|
|
6341
|
+
let day = dateNow.getDay();
|
|
6342
|
+
if (firstDayOfWeek === 0) {
|
|
6343
|
+
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
6344
|
+
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
6345
|
+
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
6346
|
+
const sunday2 = date2Str(new Date(SundayTime2));
|
|
6347
|
+
const saturday = date2Str(new Date(SaturdayTime));
|
|
6348
|
+
return [sunday2, saturday];
|
|
6349
|
+
}
|
|
6350
|
+
day = day === 0 ? 7 : day;
|
|
6351
|
+
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
6352
|
+
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
6353
|
+
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
6354
|
+
const monday = date2Str(new Date(MondayTime));
|
|
6355
|
+
const sunday = date2Str(new Date(SundayTime));
|
|
6356
|
+
return [monday, sunday];
|
|
6357
|
+
};
|
|
6358
|
+
const formatResultDate = (date2) => {
|
|
6359
|
+
const [year, month, day] = [...date2.split("-")];
|
|
6360
|
+
const formatterDay = getNumTwoBit(Number(day));
|
|
6361
|
+
const formatterDate = `${year}-${month}-${day}`;
|
|
6362
|
+
const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
|
|
6363
|
+
return [year, month, formatterDay, formatterDate, dayOfWeek];
|
|
6364
|
+
};
|
|
6365
|
+
const getWeekOfYearByYMD = (year, month, date2, firstDayOfWeek = 0) => {
|
|
6366
|
+
const MILLISECONDS_PER_DAY = 864e5;
|
|
6367
|
+
const dateNow = new Date(year, month - 1, date2);
|
|
6368
|
+
const dateFirst = new Date(year, 0, 1);
|
|
6369
|
+
const dayOfYear = Math.round(
|
|
6370
|
+
(dateNow.valueOf() - dateFirst.valueOf()) / MILLISECONDS_PER_DAY
|
|
6371
|
+
);
|
|
6372
|
+
const DAYS_OF_FIRST_WEEK = 3;
|
|
6373
|
+
let dayOfWeek = dateNow.getDay();
|
|
6374
|
+
let remainder = 6 - dayOfWeek - DAYS_OF_FIRST_WEEK;
|
|
6375
|
+
if (firstDayOfWeek !== 0) {
|
|
6376
|
+
dayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
6377
|
+
remainder = 7 - dayOfWeek - DAYS_OF_FIRST_WEEK;
|
|
6378
|
+
}
|
|
6379
|
+
let weekNo = Math.ceil((dayOfYear + remainder + 1) / 7);
|
|
6380
|
+
if (weekNo === 0) {
|
|
6381
|
+
weekNo = getWeekOfYearByYMD(year - 1, 12, 31, firstDayOfWeek);
|
|
6382
|
+
} else if (weekNo === 53) {
|
|
6383
|
+
const remainder2 = 7 - dayOfWeek - DAYS_OF_FIRST_WEEK;
|
|
6384
|
+
weekNo = remainder2 > 0 ? 1 : weekNo;
|
|
6385
|
+
}
|
|
6386
|
+
return weekNo;
|
|
6387
|
+
};
|
|
6388
|
+
const getWeekNosOfYear = (year, month, firstDayOfWeek) => {
|
|
6389
|
+
const startWeekNo = getWeekOfYearByYMD(year, month, 1, firstDayOfWeek);
|
|
6390
|
+
const endWeekNo = getWeekOfYearByYMD(
|
|
6391
|
+
year,
|
|
6392
|
+
month,
|
|
6393
|
+
getMonthDays(`${year}`, `${month}`),
|
|
6394
|
+
firstDayOfWeek
|
|
6395
|
+
);
|
|
6396
|
+
return Array.from(
|
|
6397
|
+
{
|
|
6398
|
+
length: (endWeekNo === 1 ? 53 : endWeekNo) - (startWeekNo === 53 || startWeekNo === 52 ? 0 : startWeekNo) + 1
|
|
6399
|
+
},
|
|
6400
|
+
(_, i2) => {
|
|
6401
|
+
const lastIndex = (endWeekNo === 1 ? 53 : endWeekNo) - startWeekNo;
|
|
6402
|
+
return `${endWeekNo === 1 && i2 === lastIndex ? 1 : ((startWeekNo === 53 || startWeekNo === 52) && i2 !== 0 ? 0 : startWeekNo) + i2}`;
|
|
6403
|
+
}
|
|
6404
|
+
);
|
|
6405
|
+
};
|
|
6363
6406
|
const splitDate = (date2) => {
|
|
6364
6407
|
const split = date2.indexOf("-") !== -1 ? "-" : "/";
|
|
6365
6408
|
return date2.split(split);
|
|
@@ -6388,7 +6431,89 @@
|
|
|
6388
6431
|
const isStartAndEnd = (days) => {
|
|
6389
6432
|
return days.length >= 2 && isEqual(days[0], days[1]);
|
|
6390
6433
|
};
|
|
6391
|
-
const
|
|
6434
|
+
const getPreMonths = (type2, year, month) => {
|
|
6435
|
+
const preMonth = +month - 1;
|
|
6436
|
+
const months = Array.from(Array(preMonth), (v, k) => {
|
|
6437
|
+
return {
|
|
6438
|
+
year,
|
|
6439
|
+
month: k + 1,
|
|
6440
|
+
yearAndMonth: formatMonth(year, k + 1),
|
|
6441
|
+
type: type2
|
|
6442
|
+
};
|
|
6443
|
+
});
|
|
6444
|
+
return months;
|
|
6445
|
+
};
|
|
6446
|
+
const getMonths = (type2, year, month, endMonth = 12) => {
|
|
6447
|
+
const nextMonth = endMonth - month + 1;
|
|
6448
|
+
const months = Array.from(Array(nextMonth), (v, k) => {
|
|
6449
|
+
return {
|
|
6450
|
+
year,
|
|
6451
|
+
month: k + month,
|
|
6452
|
+
yearAndMonth: formatMonth(year, k + month),
|
|
6453
|
+
type: type2
|
|
6454
|
+
};
|
|
6455
|
+
});
|
|
6456
|
+
return months;
|
|
6457
|
+
};
|
|
6458
|
+
const formatMonth = (year, month) => {
|
|
6459
|
+
return `${year}-${String(month).padStart(2, "0")}`;
|
|
6460
|
+
};
|
|
6461
|
+
const formatQuarter = (year, quarter) => {
|
|
6462
|
+
return `${year}-Q${quarter}`;
|
|
6463
|
+
};
|
|
6464
|
+
const getQuarter = (month) => {
|
|
6465
|
+
if (month < 1 || month > 12) {
|
|
6466
|
+
throw new Error("月份必须在 1 到 12 之间");
|
|
6467
|
+
}
|
|
6468
|
+
const quarter = Math.floor((month - 1) / 3) + 1;
|
|
6469
|
+
return quarter;
|
|
6470
|
+
};
|
|
6471
|
+
const getQuarters = (type2, year, month, endMonth = 12) => {
|
|
6472
|
+
const quarters = [];
|
|
6473
|
+
const startIndex = month;
|
|
6474
|
+
const endIndex = endMonth;
|
|
6475
|
+
for (let index = startIndex; index <= endIndex; index += 3) {
|
|
6476
|
+
const quarter = getQuarter(index);
|
|
6477
|
+
quarters.push({
|
|
6478
|
+
year,
|
|
6479
|
+
quarter,
|
|
6480
|
+
yearAndQuarter: formatQuarter(year, quarter),
|
|
6481
|
+
type: type2
|
|
6482
|
+
});
|
|
6483
|
+
}
|
|
6484
|
+
return quarters;
|
|
6485
|
+
};
|
|
6486
|
+
const getPreQuarters = (type2, year, month) => {
|
|
6487
|
+
const quarters = [];
|
|
6488
|
+
const startIndex = 1;
|
|
6489
|
+
const endIndex = month - 3;
|
|
6490
|
+
for (let index = startIndex; index <= endIndex; index += 3) {
|
|
6491
|
+
const quarter = getQuarter(index);
|
|
6492
|
+
quarters.push({
|
|
6493
|
+
year,
|
|
6494
|
+
quarter,
|
|
6495
|
+
yearAndQuarter: formatQuarter(year, quarter),
|
|
6496
|
+
type: type2
|
|
6497
|
+
});
|
|
6498
|
+
}
|
|
6499
|
+
return quarters;
|
|
6500
|
+
};
|
|
6501
|
+
const getNextQuarters = (type2, year, month, endMonth = 12) => {
|
|
6502
|
+
const quarters = [];
|
|
6503
|
+
const startIndex = month + 3;
|
|
6504
|
+
const endIndex = endMonth;
|
|
6505
|
+
for (let index = startIndex; index <= endIndex; index += 3) {
|
|
6506
|
+
const quarter = getQuarter(index);
|
|
6507
|
+
quarters.push({
|
|
6508
|
+
year,
|
|
6509
|
+
quarter,
|
|
6510
|
+
yearAndQuarter: formatQuarter(year, quarter),
|
|
6511
|
+
type: type2
|
|
6512
|
+
});
|
|
6513
|
+
}
|
|
6514
|
+
return quarters;
|
|
6515
|
+
};
|
|
6516
|
+
const defaultProps$14 = {
|
|
6392
6517
|
...ComponentDefaults,
|
|
6393
6518
|
type: "single",
|
|
6394
6519
|
autoBackfill: false,
|
|
@@ -6402,6 +6527,7 @@
|
|
|
6402
6527
|
confirmText: "",
|
|
6403
6528
|
showTitle: true,
|
|
6404
6529
|
showSubTitle: true,
|
|
6530
|
+
showMonthNumber: false,
|
|
6405
6531
|
scrollAnimation: true,
|
|
6406
6532
|
firstDayOfWeek: 0,
|
|
6407
6533
|
disableDate: (date2) => false,
|
|
@@ -6438,19 +6564,20 @@
|
|
|
6438
6564
|
confirmText,
|
|
6439
6565
|
showTitle,
|
|
6440
6566
|
showSubTitle,
|
|
6567
|
+
showMonthNumber,
|
|
6441
6568
|
scrollAnimation,
|
|
6442
6569
|
firstDayOfWeek,
|
|
6443
6570
|
disableDate,
|
|
6444
6571
|
renderHeaderButtons,
|
|
6572
|
+
renderBottomButton,
|
|
6445
6573
|
renderDay,
|
|
6446
6574
|
renderDayTop,
|
|
6447
6575
|
renderDayBottom,
|
|
6448
|
-
renderBottomButton,
|
|
6449
6576
|
onConfirm,
|
|
6450
6577
|
onUpdate,
|
|
6451
6578
|
onDayClick,
|
|
6452
6579
|
onPageChange
|
|
6453
|
-
} = { ...defaultProps$
|
|
6580
|
+
} = { ...defaultProps$14, ...props };
|
|
6454
6581
|
const classPrefix2 = "nut-calendar";
|
|
6455
6582
|
const dayPrefix = "nut-calendar-day";
|
|
6456
6583
|
const weekdays = locale.calendaritem.weekdays;
|
|
@@ -6477,7 +6604,7 @@
|
|
|
6477
6604
|
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
6478
6605
|
return type2 !== "single" ? [...defaultValue] : defaultValue;
|
|
6479
6606
|
}
|
|
6480
|
-
return
|
|
6607
|
+
return type2 === "single" ? "" : [];
|
|
6481
6608
|
};
|
|
6482
6609
|
const [currentDate, setCurrentDate] = usePropsValue({
|
|
6483
6610
|
value,
|
|
@@ -6512,6 +6639,7 @@
|
|
|
6512
6639
|
const monthInfo = {
|
|
6513
6640
|
curData: date2,
|
|
6514
6641
|
title: monthTitle(y2, m2),
|
|
6642
|
+
weekNo: getWeekNosOfYear(y2, m2, firstDayOfWeek),
|
|
6515
6643
|
monthData: days,
|
|
6516
6644
|
cssHeight,
|
|
6517
6645
|
scrollTop: scrollTop2
|
|
@@ -6533,7 +6661,7 @@
|
|
|
6533
6661
|
const currentMonthsData = monthsData[current];
|
|
6534
6662
|
if (currentMonthsData.title === yearMonthTitle) return;
|
|
6535
6663
|
const [year, month] = currentMonthsData.curData;
|
|
6536
|
-
onPageChange
|
|
6664
|
+
onPageChange == null ? void 0 : onPageChange([year, month, `${year}-${month}`]);
|
|
6537
6665
|
setYearMonthTitle(currentMonthsData.title);
|
|
6538
6666
|
};
|
|
6539
6667
|
const setDefaultRange = (monthNum, current) => {
|
|
@@ -6735,7 +6863,7 @@
|
|
|
6735
6863
|
initData();
|
|
6736
6864
|
};
|
|
6737
6865
|
React.useEffect(() => {
|
|
6738
|
-
setCurrentDate(resetDefaultValue()
|
|
6866
|
+
setCurrentDate(resetDefaultValue());
|
|
6739
6867
|
}, [defaultValue]);
|
|
6740
6868
|
React.useEffect(() => {
|
|
6741
6869
|
popup && resetRender();
|
|
@@ -6896,7 +7024,7 @@
|
|
|
6896
7024
|
}
|
|
6897
7025
|
}
|
|
6898
7026
|
if (!isFirst) {
|
|
6899
|
-
onDayClick
|
|
7027
|
+
onDayClick == null ? void 0 : onDayClick(state.currDateArray);
|
|
6900
7028
|
if (autoBackfill || !popup) {
|
|
6901
7029
|
confirm();
|
|
6902
7030
|
}
|
|
@@ -6906,9 +7034,9 @@
|
|
|
6906
7034
|
const confirm = () => {
|
|
6907
7035
|
if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
|
|
6908
7036
|
const chooseData = state.currDateArray.slice(0);
|
|
6909
|
-
onConfirm
|
|
7037
|
+
onConfirm == null ? void 0 : onConfirm(chooseData);
|
|
6910
7038
|
if (popup) {
|
|
6911
|
-
onUpdate
|
|
7039
|
+
onUpdate == null ? void 0 : onUpdate();
|
|
6912
7040
|
}
|
|
6913
7041
|
}
|
|
6914
7042
|
};
|
|
@@ -6931,7 +7059,14 @@
|
|
|
6931
7059
|
return currentDate.length >= 2 && (type2 === "range" || type2 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
|
|
6932
7060
|
};
|
|
6933
7061
|
const renderHeader = () => {
|
|
6934
|
-
return /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement(
|
|
7062
|
+
return /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement(
|
|
7063
|
+
"div",
|
|
7064
|
+
{
|
|
7065
|
+
className: `${classPrefix2}-weeks ${showMonthNumber ? `${classPrefix2}-weeks-shrink` : ""}`,
|
|
7066
|
+
ref: weeksPanel
|
|
7067
|
+
},
|
|
7068
|
+
weeks.map((item) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))
|
|
7069
|
+
));
|
|
6935
7070
|
};
|
|
6936
7071
|
const renderItem = (month, day, index) => {
|
|
6937
7072
|
const startTip = isStartTip(day, month);
|
|
@@ -6947,7 +7082,7 @@
|
|
|
6947
7082
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
|
|
6948
7083
|
!startTip && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
|
|
6949
7084
|
noStartNorEnd && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
|
|
6950
|
-
noStartNorEnd && isCurrDay(month, day.day) &&
|
|
7085
|
+
noStartNorEnd && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
|
|
6951
7086
|
startTip && /* @__PURE__ */ React.createElement(
|
|
6952
7087
|
"div",
|
|
6953
7088
|
{
|
|
@@ -6963,9 +7098,9 @@
|
|
|
6963
7098
|
);
|
|
6964
7099
|
};
|
|
6965
7100
|
const renderPanel = (month, key) => {
|
|
6966
|
-
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
|
|
7101
|
+
return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${showMonthNumber ? "shrink" : ""}` }, showMonthNumber && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeknumber` }, month.weekNo.map((item, index) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeknumber-index`, key: index }, item))), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
|
|
6967
7102
|
(day, i2) => renderItem(month, day, i2)
|
|
6968
|
-
)));
|
|
7103
|
+
))));
|
|
6969
7104
|
};
|
|
6970
7105
|
const renderContent = () => {
|
|
6971
7106
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -6982,7 +7117,6 @@
|
|
|
6982
7117
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
|
|
6983
7118
|
"div",
|
|
6984
7119
|
{
|
|
6985
|
-
className: "viewArea",
|
|
6986
7120
|
ref: viewAreaRef,
|
|
6987
7121
|
style: { transform: `translateY(${translateY}px)` }
|
|
6988
7122
|
},
|
|
@@ -6998,13 +7132,328 @@
|
|
|
6998
7132
|
return /* @__PURE__ */ React.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
6999
7133
|
});
|
|
7000
7134
|
CalendarItem.displayName = "NutCalendarItem";
|
|
7135
|
+
const defaultConfigRef = {
|
|
7136
|
+
current: {
|
|
7137
|
+
locale: zhCN
|
|
7138
|
+
}
|
|
7139
|
+
};
|
|
7140
|
+
const getDefaultConfig = () => {
|
|
7141
|
+
return defaultConfigRef.current;
|
|
7142
|
+
};
|
|
7143
|
+
const ConfigContext = React.createContext(null);
|
|
7144
|
+
const useConfig = () => {
|
|
7145
|
+
return React.useContext(ConfigContext) ?? getDefaultConfig();
|
|
7146
|
+
};
|
|
7147
|
+
const YearMonthPanelHeight = 231;
|
|
7148
|
+
const YearQuarterPanelHeight = 103;
|
|
7149
|
+
const defaultProps$13 = {
|
|
7150
|
+
...ComponentDefaults,
|
|
7151
|
+
type: "single",
|
|
7152
|
+
viewMode: "month",
|
|
7153
|
+
title: "",
|
|
7154
|
+
startDate: getDateString(0),
|
|
7155
|
+
endDate: getDateString(365),
|
|
7156
|
+
showToday: true,
|
|
7157
|
+
showTitle: true,
|
|
7158
|
+
scrollAnimation: true,
|
|
7159
|
+
renderDay: void 0,
|
|
7160
|
+
onItemClick: () => {
|
|
7161
|
+
}
|
|
7162
|
+
};
|
|
7163
|
+
const CalendarViewModeItem = React.forwardRef((props) => {
|
|
7164
|
+
const { locale } = useConfig();
|
|
7165
|
+
const {
|
|
7166
|
+
style,
|
|
7167
|
+
className,
|
|
7168
|
+
viewMode,
|
|
7169
|
+
title,
|
|
7170
|
+
value,
|
|
7171
|
+
defaultValue,
|
|
7172
|
+
startDate,
|
|
7173
|
+
endDate,
|
|
7174
|
+
showTitle,
|
|
7175
|
+
renderDay,
|
|
7176
|
+
onItemClick
|
|
7177
|
+
} = { ...defaultProps$13, ...props };
|
|
7178
|
+
const classPrefix2 = "nut-calendar-viewmode";
|
|
7179
|
+
const [panelDate, setPanelDate] = React.useState({
|
|
7180
|
+
months: [
|
|
7181
|
+
{
|
|
7182
|
+
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
7183
|
+
months: [],
|
|
7184
|
+
cssHeight: 0,
|
|
7185
|
+
scrollTop: 0,
|
|
7186
|
+
currYear: false
|
|
7187
|
+
}
|
|
7188
|
+
],
|
|
7189
|
+
quarters: [
|
|
7190
|
+
{
|
|
7191
|
+
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
7192
|
+
quarters: [],
|
|
7193
|
+
cssHeight: 0,
|
|
7194
|
+
scrollTop: 0,
|
|
7195
|
+
currYear: false
|
|
7196
|
+
}
|
|
7197
|
+
]
|
|
7198
|
+
});
|
|
7199
|
+
const [scrollTop, setScrollTop] = React.useState(0);
|
|
7200
|
+
const propStartDate = startDate || getDateString(0);
|
|
7201
|
+
const propEndDate = endDate || getDateString(365);
|
|
7202
|
+
const startDates = splitDate(propStartDate);
|
|
7203
|
+
const endDates = splitDate(propEndDate);
|
|
7204
|
+
const [innerValue, setInnerValue] = usePropsValue({
|
|
7205
|
+
value,
|
|
7206
|
+
defaultValue,
|
|
7207
|
+
finalValue: [],
|
|
7208
|
+
onChange: (val) => {
|
|
7209
|
+
}
|
|
7210
|
+
});
|
|
7211
|
+
const monthsRef = React.useRef(null);
|
|
7212
|
+
const monthsPanel = React.useRef(null);
|
|
7213
|
+
const viewAreaRef = React.useRef(null);
|
|
7214
|
+
const getMonthsPanel = () => {
|
|
7215
|
+
return monthsPanel.current;
|
|
7216
|
+
};
|
|
7217
|
+
const getMonthsRef = () => {
|
|
7218
|
+
return monthsRef.current;
|
|
7219
|
+
};
|
|
7220
|
+
const requestAniFrameFunc = (viewMode2) => {
|
|
7221
|
+
switch (viewMode2) {
|
|
7222
|
+
case "month":
|
|
7223
|
+
{
|
|
7224
|
+
const lastItem = panelDate.months[panelDate.months.length - 1];
|
|
7225
|
+
const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
7226
|
+
const currentIndex = panelDate.months.findIndex(
|
|
7227
|
+
(item) => item.currYear === true
|
|
7228
|
+
);
|
|
7229
|
+
requestAniFrame$1(() => {
|
|
7230
|
+
var _a;
|
|
7231
|
+
if (monthsRef && monthsPanel && viewAreaRef) {
|
|
7232
|
+
getMonthsRef().clientHeight;
|
|
7233
|
+
getMonthsPanel().style.height = `${containerHeight}px`;
|
|
7234
|
+
const currTop = ((_a = panelDate.months[currentIndex]) == null ? void 0 : _a.scrollTop) || 0;
|
|
7235
|
+
getMonthsRef().scrollTop = currTop;
|
|
7236
|
+
setScrollTop(currTop);
|
|
7237
|
+
}
|
|
7238
|
+
});
|
|
7239
|
+
}
|
|
7240
|
+
break;
|
|
7241
|
+
case "quarter":
|
|
7242
|
+
{
|
|
7243
|
+
const lastItem = panelDate.quarters[panelDate.quarters.length - 1];
|
|
7244
|
+
const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
|
|
7245
|
+
const currentIndex = panelDate.quarters.findIndex(
|
|
7246
|
+
(item) => item.currYear === true
|
|
7247
|
+
);
|
|
7248
|
+
requestAniFrame$1(() => {
|
|
7249
|
+
var _a;
|
|
7250
|
+
if (monthsRef && monthsPanel && viewAreaRef) {
|
|
7251
|
+
getMonthsRef().clientHeight;
|
|
7252
|
+
getMonthsPanel().style.height = `${containerHeight}px`;
|
|
7253
|
+
const currTop = ((_a = panelDate.quarters[currentIndex]) == null ? void 0 : _a.scrollTop) || 0;
|
|
7254
|
+
getMonthsRef().scrollTop = currTop;
|
|
7255
|
+
setScrollTop(currTop);
|
|
7256
|
+
}
|
|
7257
|
+
});
|
|
7258
|
+
}
|
|
7259
|
+
break;
|
|
7260
|
+
}
|
|
7261
|
+
};
|
|
7262
|
+
const isCurrYear = (year) => {
|
|
7263
|
+
return innerValue.split("-")[0] === `${year}`;
|
|
7264
|
+
};
|
|
7265
|
+
const getMonthsData = () => {
|
|
7266
|
+
const startYear = Number(startDates[0]);
|
|
7267
|
+
const startMonth = Number(startDates[1]);
|
|
7268
|
+
const endYear = Number(endDates[0]);
|
|
7269
|
+
const endMonth = Number(endDates[1]);
|
|
7270
|
+
const panelData = [];
|
|
7271
|
+
const addPanelData = (year, months, scrollTop2) => {
|
|
7272
|
+
panelData.push({
|
|
7273
|
+
year,
|
|
7274
|
+
months,
|
|
7275
|
+
scrollTop: scrollTop2,
|
|
7276
|
+
cssHeight: YearMonthPanelHeight,
|
|
7277
|
+
currYear: isCurrYear(year)
|
|
7278
|
+
});
|
|
7279
|
+
};
|
|
7280
|
+
if (startYear === endYear) {
|
|
7281
|
+
addPanelData(
|
|
7282
|
+
startYear,
|
|
7283
|
+
[
|
|
7284
|
+
...getPreMonths("prev", startYear, startMonth),
|
|
7285
|
+
...getMonths("curr", startYear, startMonth, endMonth),
|
|
7286
|
+
...getMonths("next", endYear, endMonth + 1)
|
|
7287
|
+
],
|
|
7288
|
+
0
|
|
7289
|
+
);
|
|
7290
|
+
} else {
|
|
7291
|
+
let scrollTop2 = panelData.length * YearMonthPanelHeight;
|
|
7292
|
+
const startMonths = [
|
|
7293
|
+
...getPreMonths("prev", startYear, startMonth),
|
|
7294
|
+
...getMonths("curr", startYear, startMonth)
|
|
7295
|
+
];
|
|
7296
|
+
addPanelData(startYear, startMonths, scrollTop2);
|
|
7297
|
+
for (let i2 = startYear + 1; i2 < endYear; i2++) {
|
|
7298
|
+
scrollTop2 = panelData.length * YearMonthPanelHeight;
|
|
7299
|
+
const midMonths = [...getMonths("curr", i2, 1)];
|
|
7300
|
+
addPanelData(i2, midMonths, scrollTop2);
|
|
7301
|
+
}
|
|
7302
|
+
const lastMonths = [
|
|
7303
|
+
...getPreMonths("curr", endYear, endMonth + 1),
|
|
7304
|
+
...getMonths("next", endYear, endMonth + 1)
|
|
7305
|
+
];
|
|
7306
|
+
scrollTop2 = panelData.length * YearMonthPanelHeight;
|
|
7307
|
+
addPanelData(endYear, lastMonths, scrollTop2);
|
|
7308
|
+
}
|
|
7309
|
+
return panelData;
|
|
7310
|
+
};
|
|
7311
|
+
const getQuartersData = () => {
|
|
7312
|
+
const startYear = Number(startDates[0]);
|
|
7313
|
+
const startMonth = Number(startDates[1]);
|
|
7314
|
+
const endYear = Number(endDates[0]);
|
|
7315
|
+
const endMonth = Number(endDates[1]);
|
|
7316
|
+
const panelData = [];
|
|
7317
|
+
const addPanelData = (year, quarters, scrollTop2) => {
|
|
7318
|
+
panelData.push({
|
|
7319
|
+
year,
|
|
7320
|
+
quarters,
|
|
7321
|
+
scrollTop: scrollTop2,
|
|
7322
|
+
cssHeight: YearQuarterPanelHeight,
|
|
7323
|
+
currYear: isCurrYear(year)
|
|
7324
|
+
});
|
|
7325
|
+
};
|
|
7326
|
+
if (startYear === endYear) {
|
|
7327
|
+
const quarters = [
|
|
7328
|
+
...getPreQuarters("prev", startYear, startMonth),
|
|
7329
|
+
...getQuarters("curr", startYear, startMonth, endMonth),
|
|
7330
|
+
...getNextQuarters("next", endYear, endMonth)
|
|
7331
|
+
];
|
|
7332
|
+
addPanelData(startYear, quarters, 0);
|
|
7333
|
+
} else {
|
|
7334
|
+
let scrollTop2 = panelData.length * YearQuarterPanelHeight;
|
|
7335
|
+
const startQuarters = [
|
|
7336
|
+
...getPreQuarters("prev", startYear, startMonth),
|
|
7337
|
+
...getQuarters("curr", startYear, startMonth)
|
|
7338
|
+
];
|
|
7339
|
+
addPanelData(startYear, startQuarters, scrollTop2);
|
|
7340
|
+
for (let i2 = startYear + 1; i2 < endYear; i2++) {
|
|
7341
|
+
scrollTop2 = panelData.length * YearQuarterPanelHeight;
|
|
7342
|
+
const midQuarters = [...getQuarters("curr", i2, 1)];
|
|
7343
|
+
addPanelData(i2, midQuarters, scrollTop2);
|
|
7344
|
+
}
|
|
7345
|
+
const lastQuarters = [
|
|
7346
|
+
...getQuarters("curr", endYear, 1, endMonth),
|
|
7347
|
+
...getNextQuarters("next", endYear, endMonth)
|
|
7348
|
+
];
|
|
7349
|
+
scrollTop2 = panelData.length * YearQuarterPanelHeight;
|
|
7350
|
+
addPanelData(endYear, lastQuarters, scrollTop2);
|
|
7351
|
+
}
|
|
7352
|
+
return panelData;
|
|
7353
|
+
};
|
|
7354
|
+
const initData = () => {
|
|
7355
|
+
const data = (
|
|
7356
|
+
// eslint-disable-next-line no-nested-ternary
|
|
7357
|
+
viewMode === "month" ? getMonthsData() : viewMode === "quarter" ? getQuartersData() : null
|
|
7358
|
+
);
|
|
7359
|
+
setPanelDate({ ...panelDate, [`${viewMode}s`]: data });
|
|
7360
|
+
};
|
|
7361
|
+
React.useEffect(() => {
|
|
7362
|
+
requestAniFrameFunc(viewMode);
|
|
7363
|
+
}, [panelDate]);
|
|
7364
|
+
React.useEffect(() => {
|
|
7365
|
+
initData();
|
|
7366
|
+
}, []);
|
|
7367
|
+
const monthsViewScroll = (e2) => {
|
|
7368
|
+
const scrollTop2 = e2.target.scrollTop;
|
|
7369
|
+
Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
|
|
7370
|
+
};
|
|
7371
|
+
const handleItemClick = (viewMode2, item) => {
|
|
7372
|
+
if (item.type !== "curr") return;
|
|
7373
|
+
const val = viewMode2 === "month" ? item.yearAndMonth : item.yearAndQuarter;
|
|
7374
|
+
setInnerValue(val);
|
|
7375
|
+
onItemClick == null ? void 0 : onItemClick(val);
|
|
7376
|
+
};
|
|
7377
|
+
const isDisable = (item) => {
|
|
7378
|
+
return item.type === "prev" || item.type === "next";
|
|
7379
|
+
};
|
|
7380
|
+
const isActive = (item) => {
|
|
7381
|
+
const val = viewMode === "month" ? item.yearAndMonth : item.yearAndQuarter;
|
|
7382
|
+
return val === innerValue;
|
|
7383
|
+
};
|
|
7384
|
+
const getClasses = (item) => {
|
|
7385
|
+
if (isDisable(item)) {
|
|
7386
|
+
return ["disabled"];
|
|
7387
|
+
}
|
|
7388
|
+
const res = [];
|
|
7389
|
+
if (item.type === "curr") {
|
|
7390
|
+
if (isActive(item)) {
|
|
7391
|
+
res.push("active");
|
|
7392
|
+
}
|
|
7393
|
+
}
|
|
7394
|
+
return res;
|
|
7395
|
+
};
|
|
7396
|
+
const classes = classNames(classPrefix2, className);
|
|
7397
|
+
const renderHeader = () => {
|
|
7398
|
+
return showTitle && /* @__PURE__ */ React.createElement(
|
|
7399
|
+
components.View,
|
|
7400
|
+
{
|
|
7401
|
+
className: classNames({
|
|
7402
|
+
[`${classPrefix2}-header`]: true
|
|
7403
|
+
})
|
|
7404
|
+
},
|
|
7405
|
+
/* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-title` }, title)
|
|
7406
|
+
);
|
|
7407
|
+
};
|
|
7408
|
+
const renderItem = (item, index) => {
|
|
7409
|
+
const units = {
|
|
7410
|
+
month: locale.calendaritem.month,
|
|
7411
|
+
quarter: locale.calendaritem.quarter
|
|
7412
|
+
};
|
|
7413
|
+
return /* @__PURE__ */ React.createElement(
|
|
7414
|
+
"div",
|
|
7415
|
+
{
|
|
7416
|
+
className: classNames(
|
|
7417
|
+
`${classPrefix2}-item`,
|
|
7418
|
+
item.type,
|
|
7419
|
+
getClasses(item)
|
|
7420
|
+
),
|
|
7421
|
+
onClick: () => handleItemClick(viewMode, item),
|
|
7422
|
+
key: index
|
|
7423
|
+
},
|
|
7424
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-item-${item.type}` }, renderDay ? renderDay(item) : `${item[viewMode]}${units[viewMode]}`)
|
|
7425
|
+
);
|
|
7426
|
+
};
|
|
7427
|
+
const renderPanel = () => {
|
|
7428
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, panelDate[`${viewMode}s`].map((item, key) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-panel`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-panel-title` }, item.year), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-content` }, item[`${viewMode}s`].map(
|
|
7429
|
+
(item2, i2) => renderItem(item2, i2)
|
|
7430
|
+
)))));
|
|
7431
|
+
};
|
|
7432
|
+
const renderContent = () => {
|
|
7433
|
+
return /* @__PURE__ */ React.createElement(
|
|
7434
|
+
components.ScrollView,
|
|
7435
|
+
{
|
|
7436
|
+
scrollTop,
|
|
7437
|
+
scrollY: true,
|
|
7438
|
+
className: `${classPrefix2}-content`,
|
|
7439
|
+
onScroll: monthsViewScroll,
|
|
7440
|
+
ref: monthsRef
|
|
7441
|
+
},
|
|
7442
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement("div", { ref: viewAreaRef }, renderPanel()))
|
|
7443
|
+
);
|
|
7444
|
+
};
|
|
7445
|
+
return /* @__PURE__ */ React.createElement("div", { className: classes, style }, renderHeader(), renderContent());
|
|
7446
|
+
});
|
|
7447
|
+
CalendarViewModeItem.displayName = "NutCalendarViewModeItem";
|
|
7001
7448
|
const defaultProps$12 = {
|
|
7002
7449
|
...ComponentDefaults,
|
|
7003
7450
|
type: "single",
|
|
7451
|
+
viewMode: "day",
|
|
7004
7452
|
autoBackfill: false,
|
|
7005
7453
|
popup: true,
|
|
7006
7454
|
visible: false,
|
|
7007
7455
|
title: "",
|
|
7456
|
+
value: "",
|
|
7008
7457
|
defaultValue: "",
|
|
7009
7458
|
startDate: getDateString(0),
|
|
7010
7459
|
endDate: getDateString(365),
|
|
@@ -7014,6 +7463,7 @@
|
|
|
7014
7463
|
confirmText: "",
|
|
7015
7464
|
showTitle: true,
|
|
7016
7465
|
showSubTitle: true,
|
|
7466
|
+
showMonthNumber: false,
|
|
7017
7467
|
scrollAnimation: true,
|
|
7018
7468
|
firstDayOfWeek: 0,
|
|
7019
7469
|
disableDate: (date2) => false,
|
|
@@ -7027,6 +7477,8 @@
|
|
|
7027
7477
|
},
|
|
7028
7478
|
onDayClick: (data) => {
|
|
7029
7479
|
},
|
|
7480
|
+
onItemClick: () => {
|
|
7481
|
+
},
|
|
7030
7482
|
onPageChange: (param) => {
|
|
7031
7483
|
}
|
|
7032
7484
|
};
|
|
@@ -7039,8 +7491,10 @@
|
|
|
7039
7491
|
popup,
|
|
7040
7492
|
visible,
|
|
7041
7493
|
type: type2,
|
|
7494
|
+
viewMode,
|
|
7042
7495
|
autoBackfill,
|
|
7043
7496
|
title,
|
|
7497
|
+
value,
|
|
7044
7498
|
defaultValue,
|
|
7045
7499
|
startDate,
|
|
7046
7500
|
endDate,
|
|
@@ -7050,6 +7504,7 @@
|
|
|
7050
7504
|
confirmText,
|
|
7051
7505
|
showTitle,
|
|
7052
7506
|
showSubTitle,
|
|
7507
|
+
showMonthNumber,
|
|
7053
7508
|
scrollAnimation,
|
|
7054
7509
|
firstDayOfWeek,
|
|
7055
7510
|
closeIcon,
|
|
@@ -7062,6 +7517,7 @@
|
|
|
7062
7517
|
onClose,
|
|
7063
7518
|
onConfirm,
|
|
7064
7519
|
onDayClick,
|
|
7520
|
+
onItemClick,
|
|
7065
7521
|
onPageChange
|
|
7066
7522
|
} = { ...defaultProps$12, ...props };
|
|
7067
7523
|
const calendarRef = React.useRef(null);
|
|
@@ -7075,9 +7531,6 @@
|
|
|
7075
7531
|
const closePopup = () => {
|
|
7076
7532
|
close2();
|
|
7077
7533
|
};
|
|
7078
|
-
const select = (param) => {
|
|
7079
|
-
onDayClick && onDayClick(param);
|
|
7080
|
-
};
|
|
7081
7534
|
const scrollToDate = (date2) => {
|
|
7082
7535
|
var _a;
|
|
7083
7536
|
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date2);
|
|
@@ -7089,7 +7542,25 @@
|
|
|
7089
7542
|
scrollToDate
|
|
7090
7543
|
}));
|
|
7091
7544
|
const renderItem = () => {
|
|
7092
|
-
return /* @__PURE__ */ React.createElement(
|
|
7545
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, viewMode !== "day" ? /* @__PURE__ */ React.createElement(
|
|
7546
|
+
CalendarViewModeItem,
|
|
7547
|
+
{
|
|
7548
|
+
ref: calendarRef,
|
|
7549
|
+
style,
|
|
7550
|
+
className,
|
|
7551
|
+
type: type2,
|
|
7552
|
+
viewMode,
|
|
7553
|
+
title: title || locale.calendaritem.title,
|
|
7554
|
+
value,
|
|
7555
|
+
defaultValue,
|
|
7556
|
+
startDate,
|
|
7557
|
+
endDate,
|
|
7558
|
+
showTitle,
|
|
7559
|
+
scrollAnimation,
|
|
7560
|
+
renderDay,
|
|
7561
|
+
onItemClick
|
|
7562
|
+
}
|
|
7563
|
+
) : /* @__PURE__ */ React.createElement(
|
|
7093
7564
|
CalendarItem,
|
|
7094
7565
|
{
|
|
7095
7566
|
ref: calendarRef,
|
|
@@ -7109,6 +7580,7 @@
|
|
|
7109
7580
|
confirmText: confirmText || locale.calendaritem.confirm,
|
|
7110
7581
|
showTitle,
|
|
7111
7582
|
showSubTitle,
|
|
7583
|
+
showMonthNumber,
|
|
7112
7584
|
scrollAnimation,
|
|
7113
7585
|
firstDayOfWeek,
|
|
7114
7586
|
disableDate,
|
|
@@ -7118,12 +7590,12 @@
|
|
|
7118
7590
|
renderDayTop,
|
|
7119
7591
|
renderDayBottom,
|
|
7120
7592
|
onConfirm: choose,
|
|
7121
|
-
onDayClick
|
|
7593
|
+
onDayClick,
|
|
7122
7594
|
onPageChange: yearMonthChange
|
|
7123
7595
|
}
|
|
7124
|
-
);
|
|
7596
|
+
));
|
|
7125
7597
|
};
|
|
7126
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, popup ? /* @__PURE__ */ React.createElement(
|
|
7598
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, popup && viewMode === "day" ? /* @__PURE__ */ React.createElement(
|
|
7127
7599
|
Popup,
|
|
7128
7600
|
{
|
|
7129
7601
|
className: "nut-calendar-popup",
|
|
@@ -7131,11 +7603,11 @@
|
|
|
7131
7603
|
position: "bottom",
|
|
7132
7604
|
round: true,
|
|
7133
7605
|
closeable: true,
|
|
7606
|
+
closeIcon,
|
|
7134
7607
|
destroyOnClose: true,
|
|
7135
7608
|
onOverlayClick: closePopup,
|
|
7136
7609
|
onCloseIconClick: closePopup,
|
|
7137
|
-
style: { height: "83%" }
|
|
7138
|
-
closeIcon
|
|
7610
|
+
style: { height: "83%" }
|
|
7139
7611
|
},
|
|
7140
7612
|
renderItem()
|
|
7141
7613
|
) : renderItem());
|
|
@@ -10882,7 +11354,7 @@
|
|
|
10882
11354
|
React.useEffect(() => {
|
|
10883
11355
|
getParentOffset();
|
|
10884
11356
|
}, [showPopup, getParentOffset]);
|
|
10885
|
-
const windowHeight = React.useMemo(() =>
|
|
11357
|
+
const windowHeight = React.useMemo(() => getWindowInfo().windowHeight, []);
|
|
10886
11358
|
const updateItemOffset = React.useCallback(() => {
|
|
10887
11359
|
if (!parent.lockScroll) return;
|
|
10888
11360
|
const p = parent.menuRef.current;
|
|
@@ -10932,7 +11404,7 @@
|
|
|
10932
11404
|
bottom: "0",
|
|
10933
11405
|
height: "initial"
|
|
10934
11406
|
} : {
|
|
10935
|
-
bottom: `${
|
|
11407
|
+
bottom: `${getWindowInfo().windowHeight - position.top}px`,
|
|
10936
11408
|
top: "0",
|
|
10937
11409
|
height: "initial"
|
|
10938
11410
|
};
|
|
@@ -10945,7 +11417,7 @@
|
|
|
10945
11417
|
};
|
|
10946
11418
|
}
|
|
10947
11419
|
return {
|
|
10948
|
-
height: `${
|
|
11420
|
+
height: `${getWindowInfo().windowHeight - position.top}px`,
|
|
10949
11421
|
top: "auto",
|
|
10950
11422
|
...isShow()
|
|
10951
11423
|
};
|
|
@@ -13573,7 +14045,7 @@
|
|
|
13573
14045
|
const stateRef = React.useRef(args);
|
|
13574
14046
|
const currentRef = React.useRef();
|
|
13575
14047
|
const previousRef = React.useRef();
|
|
13576
|
-
if (!
|
|
14048
|
+
if (!isEqual$1(currentRef.current, args)) {
|
|
13577
14049
|
previousRef.current = currentRef.current;
|
|
13578
14050
|
currentRef.current = args;
|
|
13579
14051
|
stateRef.current = args;
|
|
@@ -13810,7 +14282,7 @@
|
|
|
13810
14282
|
const el = myDrag.current;
|
|
13811
14283
|
if (el) {
|
|
13812
14284
|
const { top, left: left2, bottom, right: right2 } = boundary;
|
|
13813
|
-
const { screenWidth, windowHeight } =
|
|
14285
|
+
const { screenWidth, windowHeight } = getWindowInfo();
|
|
13814
14286
|
const {
|
|
13815
14287
|
width,
|
|
13816
14288
|
height,
|
|
@@ -15087,7 +15559,7 @@
|
|
|
15087
15559
|
setStatus("pulling");
|
|
15088
15560
|
}
|
|
15089
15561
|
};
|
|
15090
|
-
const isAndroidWeApp =
|
|
15562
|
+
const isAndroidWeApp = getDeviceInfo().platform === "android" && Taro.getEnv() === "WEAPP";
|
|
15091
15563
|
const springStyles = {
|
|
15092
15564
|
height: `${height}px`,
|
|
15093
15565
|
...!pullingRef.current || isAndroidWeApp ? { transition: "height .3s ease" } : {}
|
|
@@ -17999,18 +18471,6 @@
|
|
|
17999
18471
|
}
|
|
18000
18472
|
});
|
|
18001
18473
|
};
|
|
18002
|
-
const defaultConfigRef = {
|
|
18003
|
-
current: {
|
|
18004
|
-
locale: zhCN
|
|
18005
|
-
}
|
|
18006
|
-
};
|
|
18007
|
-
const getDefaultConfig = () => {
|
|
18008
|
-
return defaultConfigRef.current;
|
|
18009
|
-
};
|
|
18010
|
-
const ConfigContext = React.createContext(null);
|
|
18011
|
-
const useConfig = () => {
|
|
18012
|
-
return React.useContext(ConfigContext) ?? getDefaultConfig();
|
|
18013
|
-
};
|
|
18014
18474
|
const defaultProps$9 = {
|
|
18015
18475
|
...ComponentDefaults,
|
|
18016
18476
|
visible: false,
|
|
@@ -18291,7 +18751,7 @@
|
|
|
18291
18751
|
...props
|
|
18292
18752
|
};
|
|
18293
18753
|
const clientHeight = React.useMemo(
|
|
18294
|
-
() =>
|
|
18754
|
+
() => getWindowInfo().windowHeight - 5 || 667,
|
|
18295
18755
|
[]
|
|
18296
18756
|
);
|
|
18297
18757
|
const containerHeight = React.useMemo(
|
|
@@ -19065,7 +19525,7 @@
|
|
|
19065
19525
|
const [visible, setVisible] = React.useState(false);
|
|
19066
19526
|
const [moving, setMoving] = React.useState(false);
|
|
19067
19527
|
const [zooming, setZooming] = React.useState(false);
|
|
19068
|
-
const systemInfo =
|
|
19528
|
+
const systemInfo = getWindowInfo();
|
|
19069
19529
|
const showAlipayCanvas2D = React.useMemo(() => {
|
|
19070
19530
|
return Taro.getEnv() === "ALIPAY" && parseInt(Taro.SDKVersion.replace(/\./g, "")) >= 270;
|
|
19071
19531
|
}, []);
|