@nutui/nutui-react-taro 2.7.9 → 2.7.11
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 +23 -4
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Audio.js +1 -1
- package/dist/esm/AvatarCropper.js +1 -1
- package/dist/esm/BackTop.js +1 -1
- package/dist/esm/Badge.js +1 -1
- package/dist/esm/Calendar/style/index.js +3 -1
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +1 -1
- package/dist/esm/CalendarCard.js +1 -1
- package/dist/esm/CalendarItem.js +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/ConfigProvider.js +2 -2
- package/dist/esm/DatePicker.js +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/Ellipsis.js +1 -1
- package/dist/esm/FixedNav.js +1 -1
- package/dist/esm/InfiniteLoading.js +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/NumberKeyboard.js +1 -1
- package/dist/esm/Pagination.js +1 -1
- package/dist/esm/Picker.js +1 -1
- package/dist/esm/Popover.js +1 -1
- package/dist/esm/Progress.js +1 -1
- package/dist/esm/PullToRefresh.js +1 -1
- package/dist/esm/Range.js +1 -1
- package/dist/esm/SearchBar/style/style.css +1 -1
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword.js +1 -1
- package/dist/esm/Tabbar.js +1 -1
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/Table.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/TextArea.js +1 -1
- package/dist/esm/TimeSelect.js +1 -1
- package/dist/esm/Tour.js +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/WaterMark.js +1 -1
- package/dist/esm/{address.taro-Ck0ZmxRg.js → address.taro-BM2ZWeTm.js} +2 -2
- package/dist/esm/{audio.taro-DtIUjg89.js → audio.taro-C9DxpSXx.js} +2 -2
- package/dist/esm/{avatarcropper.taro-5JSFH7Q9.js → avatarcropper.taro-BsbRSHbo.js} +1 -1
- package/dist/esm/{backtop.taro-D3Lo3jFO.js → backtop.taro-Cj60ZYba.js} +1 -1
- package/dist/esm/{badge.taro-B42_7q8v.js → badge.taro-W8s89KAj.js} +1 -1
- package/dist/esm/calendar.taro-C-5Lmq9i.js +317 -0
- package/dist/esm/{calendarcard.taro-BiOnui_b.js → calendarcard.taro-Cp3yzc6h.js} +2 -2
- package/dist/esm/{calendaritem.taro-DveeC4_t.js → calendaritem.taro-B0QA0q4N.js} +208 -15
- package/dist/esm/{cascader.taro-DUJvcGw0.js → cascader.taro-Djw9IdKW.js} +2 -2
- package/dist/esm/{configprovider.taro-C3WyeHSO.js → configprovider.taro-DpK4IiCE.js} +4 -0
- package/dist/esm/date-C7eJqrqk.js +74 -0
- package/dist/esm/{datepicker.taro-Dwh8sKhJ.js → datepicker.taro-CPSTcVSz.js} +2 -2
- package/dist/esm/{dialog.taro-yjDaaRHA.js → dialog.taro-1Vukbvap.js} +1 -1
- package/dist/esm/{ellipsis.taro-K9VJCTL6.js → ellipsis.taro-rMWnB7Vp.js} +1 -1
- package/dist/esm/{fixednav.taro-BodErnYy.js → fixednav.taro-DlVXnggt.js} +1 -1
- package/dist/esm/{infiniteloading.taro-DzIrZvc0.js → infiniteloading.taro-6r-XMUlU.js} +1 -1
- package/dist/esm/{input.taro-CA9ZpM9a.js → input.taro-s1Zw62KR.js} +1 -1
- package/dist/esm/{noticebar.taro-B0qm66Cu.js → noticebar.taro-DjmvFSpp.js} +1 -1
- package/dist/esm/{numberkeyboard.taro-BvVO_MyJ.js → numberkeyboard.taro-blGUntGo.js} +1 -1
- package/dist/esm/nutui-react.es.js +35 -35
- package/dist/esm/{pagination.taro-BSwytb0-.js → pagination.taro-V57qqxwc.js} +1 -1
- package/dist/esm/{picker.taro-B7EE52qf.js → picker.taro-Ctc0Wt4S.js} +1 -1
- package/dist/esm/{popover.taro-C9qhPJCb.js → popover.taro-Da7xRN6D.js} +1 -1
- package/dist/esm/{progress.taro-CaIUT9Uo.js → progress.taro-cveY9Y_I.js} +1 -1
- package/dist/esm/{pulltorefresh.taro-DAFv7upo.js → pulltorefresh.taro-KKNiGe1Q.js} +1 -1
- package/dist/esm/{range.taro-Bbs4JcXp.js → range.taro-C5SuX_2b.js} +1 -1
- package/dist/esm/{searchbar.taro-LaO2Xr2t.js → searchbar.taro-B7UhNlBh.js} +23 -17
- package/dist/esm/{shortpassword.taro-CUnXqjab.js → shortpassword.taro--atvsdZp.js} +1 -1
- package/dist/esm/{tabbar.taro-BiQDgZQF.js → tabbar.taro-BQpwulp5.js} +1 -1
- package/dist/esm/{tabbaritem.taro-BiIVucQz.js → tabbaritem.taro-BPe2bsMQ.js} +1 -1
- package/dist/esm/{table.taro-1nFkDxbh.js → table.taro-H3kjB4kV.js} +1 -1
- package/dist/esm/{tabs.taro-sp_DNWis.js → tabs.taro-Cb7JS_Gz.js} +6 -16
- package/dist/esm/{textarea.taro-PsaohYay.js → textarea.taro-CGMI5QNw.js} +1 -1
- package/dist/esm/{timeselect.taro-FIl91wiO.js → timeselect.taro-3Sc_hERv.js} +1 -1
- package/dist/esm/{tour.taro-BidQx8Fg.js → tour.taro-xqFUxSBB.js} +1 -1
- package/dist/esm/{uploader.taro-BBJsHrew.js → uploader.taro-DAWwySrs.js} +2 -2
- package/dist/esm/{watermark.taro-CbO7mKFD.js → watermark.taro-DuJQHymA.js} +1 -1
- package/dist/locales/base.d.ts +4 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +5 -1
- package/dist/locales/id-ID.js +5 -1
- package/dist/locales/tr-TR.js +5 -1
- package/dist/locales/zh-CN.js +5 -1
- package/dist/locales/zh-TW.js +5 -1
- package/dist/locales/zh-UG.js +5 -1
- package/dist/nutui.react.es.js +611 -153
- package/dist/nutui.react.umd.js +611 -153
- package/dist/packages/calendar/calendar.scss +24 -0
- package/dist/packages/calendar/calendarviewmode.scss +181 -0
- package/dist/packages/searchbar/searchbar.scss +2 -0
- package/dist/style.css +1 -1
- package/dist/styles/variables-jmapp.scss +4 -0
- 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/packages/searchbar/searchbar.taro.d.ts +11 -5
- package/dist/types/utils/date.d.ts +0 -17
- package/package.json +1 -1
- package/dist/esm/calendar.taro-CUDVpJBa.js +0 -47
- package/dist/esm/date-BmUWlDuN.js +0 -147
package/dist/nutui.react.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.11 Fri Mar 28 2025 13:34:15 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(
|
|
@@ -4057,7 +4061,7 @@
|
|
|
4057
4061
|
}
|
|
4058
4062
|
return Promise.resolve(makeRect(0, 0));
|
|
4059
4063
|
};
|
|
4060
|
-
const defaultProps$
|
|
4064
|
+
const defaultProps$1l = {
|
|
4061
4065
|
...ComponentDefaults,
|
|
4062
4066
|
position: "top",
|
|
4063
4067
|
zIndex: 900
|
|
@@ -4074,7 +4078,7 @@
|
|
|
4074
4078
|
className,
|
|
4075
4079
|
onChange,
|
|
4076
4080
|
...rest
|
|
4077
|
-
} = { ...defaultProps$
|
|
4081
|
+
} = { ...defaultProps$1l, ...props };
|
|
4078
4082
|
const stickyRef = React.useRef(null);
|
|
4079
4083
|
const rootRef = React.useRef(null);
|
|
4080
4084
|
const [rootRect, setRootRect] = React.useState({});
|
|
@@ -4198,7 +4202,7 @@
|
|
|
4198
4202
|
);
|
|
4199
4203
|
};
|
|
4200
4204
|
SafeArea.displayName = "NutSafeArea";
|
|
4201
|
-
const defaultProps$
|
|
4205
|
+
const defaultProps$1k = {
|
|
4202
4206
|
...ComponentDefaults,
|
|
4203
4207
|
threshold: 200,
|
|
4204
4208
|
zIndex: 900,
|
|
@@ -4207,7 +4211,7 @@
|
|
|
4207
4211
|
const BackTop = (props) => {
|
|
4208
4212
|
const rtl = useRtl();
|
|
4209
4213
|
const { children, threshold, zIndex, className, duration, style, onClick } = {
|
|
4210
|
-
...defaultProps$
|
|
4214
|
+
...defaultProps$1k,
|
|
4211
4215
|
...props
|
|
4212
4216
|
};
|
|
4213
4217
|
const classPrefix2 = "nut-backtop";
|
|
@@ -4255,7 +4259,7 @@
|
|
|
4255
4259
|
return idRef.current;
|
|
4256
4260
|
}
|
|
4257
4261
|
const elevatorContext = React.createContext({});
|
|
4258
|
-
const defaultProps$
|
|
4262
|
+
const defaultProps$1j = {
|
|
4259
4263
|
...ComponentDefaults,
|
|
4260
4264
|
height: "200px",
|
|
4261
4265
|
floorKey: "title",
|
|
@@ -4282,7 +4286,7 @@
|
|
|
4282
4286
|
children,
|
|
4283
4287
|
...rest
|
|
4284
4288
|
} = {
|
|
4285
|
-
...defaultProps$
|
|
4289
|
+
...defaultProps$1j,
|
|
4286
4290
|
...props
|
|
4287
4291
|
};
|
|
4288
4292
|
const uuid = useUuid();
|
|
@@ -4508,7 +4512,7 @@
|
|
|
4508
4512
|
};
|
|
4509
4513
|
Elevator.displayName = "NutElevator";
|
|
4510
4514
|
Elevator.Context = elevatorContext;
|
|
4511
|
-
const defaultProps$
|
|
4515
|
+
const defaultProps$1i = {
|
|
4512
4516
|
...ComponentDefaults,
|
|
4513
4517
|
activeText: "",
|
|
4514
4518
|
inactiveText: "",
|
|
@@ -4536,7 +4540,7 @@
|
|
|
4536
4540
|
content,
|
|
4537
4541
|
...rest
|
|
4538
4542
|
} = {
|
|
4539
|
-
...defaultProps$
|
|
4543
|
+
...defaultProps$1i,
|
|
4540
4544
|
...props
|
|
4541
4545
|
};
|
|
4542
4546
|
const classPrefix2 = "nut-fixednav";
|
|
@@ -4589,7 +4593,7 @@
|
|
|
4589
4593
|
);
|
|
4590
4594
|
};
|
|
4591
4595
|
FixedNav.displayName = "NutFixedNav";
|
|
4592
|
-
const defaultProps$
|
|
4596
|
+
const defaultProps$1h = {
|
|
4593
4597
|
...ComponentDefaults,
|
|
4594
4598
|
left: "",
|
|
4595
4599
|
right: "",
|
|
@@ -4614,7 +4618,7 @@
|
|
|
4614
4618
|
zIndex,
|
|
4615
4619
|
onBackClick
|
|
4616
4620
|
} = {
|
|
4617
|
-
...defaultProps$
|
|
4621
|
+
...defaultProps$1h,
|
|
4618
4622
|
...props
|
|
4619
4623
|
};
|
|
4620
4624
|
const classPrefix2 = "nut-navbar";
|
|
@@ -4692,7 +4696,7 @@
|
|
|
4692
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());
|
|
4693
4697
|
};
|
|
4694
4698
|
NavBar.displayName = "NutNavBar";
|
|
4695
|
-
const defaultProps$
|
|
4699
|
+
const defaultProps$1g = {
|
|
4696
4700
|
...ComponentDefaults,
|
|
4697
4701
|
position: "center",
|
|
4698
4702
|
transition: "",
|
|
@@ -4745,7 +4749,7 @@
|
|
|
4745
4749
|
afterShow,
|
|
4746
4750
|
afterClose,
|
|
4747
4751
|
onClick
|
|
4748
|
-
} = { ...defaultProps$
|
|
4752
|
+
} = { ...defaultProps$1g, ...props };
|
|
4749
4753
|
let innerIndex = zIndex || _zIndex;
|
|
4750
4754
|
const [index, setIndex] = React.useState(innerIndex);
|
|
4751
4755
|
const [innerVisible, setInnerVisible] = React.useState(visible);
|
|
@@ -4888,7 +4892,7 @@
|
|
|
4888
4892
|
};
|
|
4889
4893
|
Popup.displayName = "NutPopup";
|
|
4890
4894
|
const OffsetContext = React.createContext(20);
|
|
4891
|
-
const defaultProps$
|
|
4895
|
+
const defaultProps$1f = {
|
|
4892
4896
|
...ComponentDefaults,
|
|
4893
4897
|
position: "left",
|
|
4894
4898
|
width: "80%"
|
|
@@ -4906,7 +4910,7 @@
|
|
|
4906
4910
|
indent,
|
|
4907
4911
|
...rest
|
|
4908
4912
|
} = {
|
|
4909
|
-
...defaultProps$
|
|
4913
|
+
...defaultProps$1f,
|
|
4910
4914
|
...props
|
|
4911
4915
|
};
|
|
4912
4916
|
const innerIndent = indent ? Number(indent) : 20;
|
|
@@ -4964,13 +4968,13 @@
|
|
|
4964
4968
|
title
|
|
4965
4969
|
);
|
|
4966
4970
|
};
|
|
4967
|
-
const defaultProps$
|
|
4971
|
+
const defaultProps$1e = {
|
|
4968
4972
|
open: true
|
|
4969
4973
|
};
|
|
4970
4974
|
const SubSideNavBar = (props) => {
|
|
4971
4975
|
const classPrefix2 = "nut-subsidenavbar";
|
|
4972
4976
|
const { title, value, children, onClick, open: open2, ...rest } = {
|
|
4973
|
-
...defaultProps$
|
|
4977
|
+
...defaultProps$1e,
|
|
4974
4978
|
...props
|
|
4975
4979
|
};
|
|
4976
4980
|
const [subShow, setSubShow] = React.useState(open2);
|
|
@@ -5048,7 +5052,7 @@
|
|
|
5048
5052
|
);
|
|
5049
5053
|
return [stateRef.current, setState];
|
|
5050
5054
|
}
|
|
5051
|
-
const defaultProps$
|
|
5055
|
+
const defaultProps$1d = {
|
|
5052
5056
|
...ComponentDefaults,
|
|
5053
5057
|
value: "",
|
|
5054
5058
|
dot: false,
|
|
@@ -5073,7 +5077,7 @@
|
|
|
5073
5077
|
color,
|
|
5074
5078
|
fill
|
|
5075
5079
|
} = {
|
|
5076
|
-
...defaultProps$
|
|
5080
|
+
...defaultProps$1d,
|
|
5077
5081
|
...props
|
|
5078
5082
|
};
|
|
5079
5083
|
const classPrefix2 = "nut-badge";
|
|
@@ -5127,7 +5131,7 @@
|
|
|
5127
5131
|
};
|
|
5128
5132
|
Badge.displayName = "NutBadge";
|
|
5129
5133
|
const TabbarContext = React.createContext(null);
|
|
5130
|
-
const defaultProps$
|
|
5134
|
+
const defaultProps$1c = {
|
|
5131
5135
|
...ComponentDefaults,
|
|
5132
5136
|
title: "",
|
|
5133
5137
|
icon: null,
|
|
@@ -5153,7 +5157,7 @@
|
|
|
5153
5157
|
index,
|
|
5154
5158
|
...rest
|
|
5155
5159
|
} = {
|
|
5156
|
-
...defaultProps$
|
|
5160
|
+
...defaultProps$1c,
|
|
5157
5161
|
...props
|
|
5158
5162
|
};
|
|
5159
5163
|
const active = index === (ctx == null ? void 0 : ctx.selectIndex);
|
|
@@ -5191,7 +5195,7 @@
|
|
|
5191
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))
|
|
5192
5196
|
);
|
|
5193
5197
|
};
|
|
5194
|
-
const defaultProps$
|
|
5198
|
+
const defaultProps$1b = {
|
|
5195
5199
|
...ComponentDefaults,
|
|
5196
5200
|
defaultValue: 0,
|
|
5197
5201
|
fixed: false,
|
|
@@ -5214,7 +5218,7 @@
|
|
|
5214
5218
|
style,
|
|
5215
5219
|
onSwitch
|
|
5216
5220
|
} = {
|
|
5217
|
-
...defaultProps$
|
|
5221
|
+
...defaultProps$1b,
|
|
5218
5222
|
...props
|
|
5219
5223
|
};
|
|
5220
5224
|
const classPrefix2 = "nut-tabbar";
|
|
@@ -5256,14 +5260,14 @@
|
|
|
5256
5260
|
};
|
|
5257
5261
|
Tabbar.displayName = "NutTabbar";
|
|
5258
5262
|
Tabbar.Item = TabbarItem;
|
|
5259
|
-
const defaultProps$
|
|
5263
|
+
const defaultProps$1a = {
|
|
5260
5264
|
title: "",
|
|
5261
5265
|
value: "",
|
|
5262
5266
|
disabled: false
|
|
5263
5267
|
};
|
|
5264
5268
|
const TabPane = (props) => {
|
|
5265
5269
|
const { children, autoHeightClassName, className, disabled } = {
|
|
5266
|
-
...defaultProps$
|
|
5270
|
+
...defaultProps$1a,
|
|
5267
5271
|
...props
|
|
5268
5272
|
};
|
|
5269
5273
|
const classPrefix2 = "nut-tabpane";
|
|
@@ -5290,7 +5294,7 @@
|
|
|
5290
5294
|
};
|
|
5291
5295
|
}
|
|
5292
5296
|
const requestAniFrame$1 = requestAniFrame();
|
|
5293
|
-
const defaultProps$
|
|
5297
|
+
const defaultProps$19 = {
|
|
5294
5298
|
...ComponentDefaults,
|
|
5295
5299
|
tabStyle: {},
|
|
5296
5300
|
activeColor: "",
|
|
@@ -5319,7 +5323,7 @@
|
|
|
5319
5323
|
value: outerValue,
|
|
5320
5324
|
defaultValue: outerDefaultValue,
|
|
5321
5325
|
...rest
|
|
5322
|
-
} = { ...defaultProps$
|
|
5326
|
+
} = { ...defaultProps$19, ...props };
|
|
5323
5327
|
const uuid = useUuid();
|
|
5324
5328
|
const [value, setValue] = usePropsValue({
|
|
5325
5329
|
value: outerValue,
|
|
@@ -5386,14 +5390,8 @@
|
|
|
5386
5390
|
const [scrollLeft, setScrollLeft] = React.useState(0);
|
|
5387
5391
|
const [scrollTop, setScrollTop] = React.useState(0);
|
|
5388
5392
|
const scrollDirection = (to, direction2) => {
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
function animate() {
|
|
5392
|
-
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5393
|
-
else setScrollTop(to);
|
|
5394
|
-
if (++count < frames) requestAniFrame$1(animate);
|
|
5395
|
-
}
|
|
5396
|
-
animate();
|
|
5393
|
+
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5394
|
+
else setScrollTop(to);
|
|
5397
5395
|
};
|
|
5398
5396
|
const scrollIntoView = (index) => {
|
|
5399
5397
|
requestAniFrame$1(() => {
|
|
@@ -5410,13 +5408,11 @@
|
|
|
5410
5408
|
} else {
|
|
5411
5409
|
const left2 = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
|
|
5412
5410
|
to = left2 - (navRect.width - titleRect.width) / 2;
|
|
5413
|
-
if (to < 0) return;
|
|
5414
|
-
to = rtl ? -to : to;
|
|
5415
5411
|
}
|
|
5412
|
+
scrollDirection(to, direction);
|
|
5416
5413
|
Taro.nextTick(() => {
|
|
5417
5414
|
scrollWithAnimation.current = true;
|
|
5418
5415
|
});
|
|
5419
|
-
scrollDirection(to, direction);
|
|
5420
5416
|
});
|
|
5421
5417
|
});
|
|
5422
5418
|
};
|
|
@@ -5509,7 +5505,7 @@
|
|
|
5509
5505
|
};
|
|
5510
5506
|
Tabs.displayName = "NutTabs";
|
|
5511
5507
|
Tabs.TabPane = TabPane;
|
|
5512
|
-
const defaultProps$
|
|
5508
|
+
const defaultProps$18 = {
|
|
5513
5509
|
type: "custom",
|
|
5514
5510
|
existList: [],
|
|
5515
5511
|
defaultIcon: null,
|
|
@@ -5528,7 +5524,7 @@
|
|
|
5528
5524
|
onSelect,
|
|
5529
5525
|
onSwitch,
|
|
5530
5526
|
...rest
|
|
5531
|
-
} = { ...defaultProps$
|
|
5527
|
+
} = { ...defaultProps$18, ...props };
|
|
5532
5528
|
const classPrefix2 = "nut-address";
|
|
5533
5529
|
const selectedExist = (item) => {
|
|
5534
5530
|
existList.forEach((list, index) => {
|
|
@@ -5690,7 +5686,7 @@
|
|
|
5690
5686
|
return pathNodes;
|
|
5691
5687
|
}
|
|
5692
5688
|
}
|
|
5693
|
-
const defaultProps$
|
|
5689
|
+
const defaultProps$17 = {
|
|
5694
5690
|
...ComponentDefaults,
|
|
5695
5691
|
activeColor: "",
|
|
5696
5692
|
activeIcon: "checklist",
|
|
@@ -5736,7 +5732,7 @@
|
|
|
5736
5732
|
onClose,
|
|
5737
5733
|
onChange,
|
|
5738
5734
|
onPathChange
|
|
5739
|
-
} = { ...defaultProps$
|
|
5735
|
+
} = { ...defaultProps$17, ...props };
|
|
5740
5736
|
const [tabvalue, setTabvalue] = React.useState("c1");
|
|
5741
5737
|
const [optionsData, setOptionsData] = React.useState([]);
|
|
5742
5738
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
@@ -6047,7 +6043,7 @@
|
|
|
6047
6043
|
};
|
|
6048
6044
|
const Cascader = React.forwardRef(InternalCascader);
|
|
6049
6045
|
Cascader.displayName = "NutCascader";
|
|
6050
|
-
const defaultProps$
|
|
6046
|
+
const defaultProps$16 = {
|
|
6051
6047
|
...ComponentDefaults,
|
|
6052
6048
|
visible: false,
|
|
6053
6049
|
type: "custom",
|
|
@@ -6074,7 +6070,7 @@
|
|
|
6074
6070
|
onPathChange,
|
|
6075
6071
|
...rest
|
|
6076
6072
|
} = {
|
|
6077
|
-
...defaultProps$
|
|
6073
|
+
...defaultProps$16,
|
|
6078
6074
|
...props
|
|
6079
6075
|
};
|
|
6080
6076
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, type2 === "custom" && /* @__PURE__ */ React.createElement(
|
|
@@ -6099,7 +6095,7 @@
|
|
|
6099
6095
|
}
|
|
6100
6096
|
));
|
|
6101
6097
|
};
|
|
6102
|
-
const defaultProps$
|
|
6098
|
+
const defaultProps$15 = {
|
|
6103
6099
|
...ComponentDefaults,
|
|
6104
6100
|
defaultValue: [],
|
|
6105
6101
|
type: "custom",
|
|
@@ -6141,7 +6137,7 @@
|
|
|
6141
6137
|
onSwitch,
|
|
6142
6138
|
...rest
|
|
6143
6139
|
} = {
|
|
6144
|
-
...defaultProps$
|
|
6140
|
+
...defaultProps$15,
|
|
6145
6141
|
...props
|
|
6146
6142
|
};
|
|
6147
6143
|
const classPrefix2 = "nut-address";
|
|
@@ -6298,33 +6294,6 @@
|
|
|
6298
6294
|
const endTime = new Date(date2.replace(/-/g, "/")).getTime();
|
|
6299
6295
|
return startTime === endTime;
|
|
6300
6296
|
};
|
|
6301
|
-
const getWeekDate = (year, month, date2, firstDayOfWeek = 0) => {
|
|
6302
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
|
|
6303
|
-
const nowTime = dateNow.getTime();
|
|
6304
|
-
let day = dateNow.getDay();
|
|
6305
|
-
if (firstDayOfWeek === 0) {
|
|
6306
|
-
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
6307
|
-
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
6308
|
-
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
6309
|
-
const sunday2 = date2Str(new Date(SundayTime2));
|
|
6310
|
-
const saturday = date2Str(new Date(SaturdayTime));
|
|
6311
|
-
return [sunday2, saturday];
|
|
6312
|
-
}
|
|
6313
|
-
day = day === 0 ? 7 : day;
|
|
6314
|
-
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
6315
|
-
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
6316
|
-
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
6317
|
-
const monday = date2Str(new Date(MondayTime));
|
|
6318
|
-
const sunday = date2Str(new Date(SundayTime));
|
|
6319
|
-
return [monday, sunday];
|
|
6320
|
-
};
|
|
6321
|
-
const formatResultDate = (date2) => {
|
|
6322
|
-
const [year, month, day] = [...date2.split("-")];
|
|
6323
|
-
const formatterDay = getNumTwoBit(Number(day));
|
|
6324
|
-
const formatterDate = `${year}-${month}-${day}`;
|
|
6325
|
-
const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
|
|
6326
|
-
return [year, month, formatterDay, formatterDate, dayOfWeek];
|
|
6327
|
-
};
|
|
6328
6297
|
const getCurrMonthData = (type2, year, month) => {
|
|
6329
6298
|
{
|
|
6330
6299
|
month === 12 && (year += 1);
|
|
@@ -6366,6 +6335,74 @@
|
|
|
6366
6335
|
});
|
|
6367
6336
|
return months.slice(preDates - days);
|
|
6368
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
|
+
};
|
|
6369
6406
|
const splitDate = (date2) => {
|
|
6370
6407
|
const split = date2.indexOf("-") !== -1 ? "-" : "/";
|
|
6371
6408
|
return date2.split(split);
|
|
@@ -6394,7 +6431,89 @@
|
|
|
6394
6431
|
const isStartAndEnd = (days) => {
|
|
6395
6432
|
return days.length >= 2 && isEqual(days[0], days[1]);
|
|
6396
6433
|
};
|
|
6397
|
-
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 = {
|
|
6398
6517
|
...ComponentDefaults,
|
|
6399
6518
|
type: "single",
|
|
6400
6519
|
autoBackfill: false,
|
|
@@ -6408,6 +6527,7 @@
|
|
|
6408
6527
|
confirmText: "",
|
|
6409
6528
|
showTitle: true,
|
|
6410
6529
|
showSubTitle: true,
|
|
6530
|
+
showMonthNumber: false,
|
|
6411
6531
|
scrollAnimation: true,
|
|
6412
6532
|
firstDayOfWeek: 0,
|
|
6413
6533
|
disableDate: (date2) => false,
|
|
@@ -6444,19 +6564,20 @@
|
|
|
6444
6564
|
confirmText,
|
|
6445
6565
|
showTitle,
|
|
6446
6566
|
showSubTitle,
|
|
6567
|
+
showMonthNumber,
|
|
6447
6568
|
scrollAnimation,
|
|
6448
6569
|
firstDayOfWeek,
|
|
6449
6570
|
disableDate,
|
|
6450
6571
|
renderHeaderButtons,
|
|
6572
|
+
renderBottomButton,
|
|
6451
6573
|
renderDay,
|
|
6452
6574
|
renderDayTop,
|
|
6453
6575
|
renderDayBottom,
|
|
6454
|
-
renderBottomButton,
|
|
6455
6576
|
onConfirm,
|
|
6456
6577
|
onUpdate,
|
|
6457
6578
|
onDayClick,
|
|
6458
6579
|
onPageChange
|
|
6459
|
-
} = { ...defaultProps$
|
|
6580
|
+
} = { ...defaultProps$14, ...props };
|
|
6460
6581
|
const classPrefix2 = "nut-calendar";
|
|
6461
6582
|
const dayPrefix = "nut-calendar-day";
|
|
6462
6583
|
const weekdays = locale.calendaritem.weekdays;
|
|
@@ -6483,7 +6604,7 @@
|
|
|
6483
6604
|
if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
6484
6605
|
return type2 !== "single" ? [...defaultValue] : defaultValue;
|
|
6485
6606
|
}
|
|
6486
|
-
return
|
|
6607
|
+
return type2 === "single" ? "" : [];
|
|
6487
6608
|
};
|
|
6488
6609
|
const [currentDate, setCurrentDate] = usePropsValue({
|
|
6489
6610
|
value,
|
|
@@ -6518,6 +6639,7 @@
|
|
|
6518
6639
|
const monthInfo = {
|
|
6519
6640
|
curData: date2,
|
|
6520
6641
|
title: monthTitle(y2, m2),
|
|
6642
|
+
weekNo: getWeekNosOfYear(y2, m2, firstDayOfWeek),
|
|
6521
6643
|
monthData: days,
|
|
6522
6644
|
cssHeight,
|
|
6523
6645
|
scrollTop: scrollTop2
|
|
@@ -6539,7 +6661,7 @@
|
|
|
6539
6661
|
const currentMonthsData = monthsData[current];
|
|
6540
6662
|
if (currentMonthsData.title === yearMonthTitle) return;
|
|
6541
6663
|
const [year, month] = currentMonthsData.curData;
|
|
6542
|
-
onPageChange
|
|
6664
|
+
onPageChange == null ? void 0 : onPageChange([year, month, `${year}-${month}`]);
|
|
6543
6665
|
setYearMonthTitle(currentMonthsData.title);
|
|
6544
6666
|
};
|
|
6545
6667
|
const setDefaultRange = (monthNum, current) => {
|
|
@@ -6741,7 +6863,7 @@
|
|
|
6741
6863
|
initData();
|
|
6742
6864
|
};
|
|
6743
6865
|
React.useEffect(() => {
|
|
6744
|
-
setCurrentDate(resetDefaultValue()
|
|
6866
|
+
setCurrentDate(resetDefaultValue());
|
|
6745
6867
|
}, [defaultValue]);
|
|
6746
6868
|
React.useEffect(() => {
|
|
6747
6869
|
popup && resetRender();
|
|
@@ -6902,7 +7024,7 @@
|
|
|
6902
7024
|
}
|
|
6903
7025
|
}
|
|
6904
7026
|
if (!isFirst) {
|
|
6905
|
-
onDayClick
|
|
7027
|
+
onDayClick == null ? void 0 : onDayClick(state.currDateArray);
|
|
6906
7028
|
if (autoBackfill || !popup) {
|
|
6907
7029
|
confirm();
|
|
6908
7030
|
}
|
|
@@ -6912,9 +7034,9 @@
|
|
|
6912
7034
|
const confirm = () => {
|
|
6913
7035
|
if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
|
|
6914
7036
|
const chooseData = state.currDateArray.slice(0);
|
|
6915
|
-
onConfirm
|
|
7037
|
+
onConfirm == null ? void 0 : onConfirm(chooseData);
|
|
6916
7038
|
if (popup) {
|
|
6917
|
-
onUpdate
|
|
7039
|
+
onUpdate == null ? void 0 : onUpdate();
|
|
6918
7040
|
}
|
|
6919
7041
|
}
|
|
6920
7042
|
};
|
|
@@ -6937,7 +7059,14 @@
|
|
|
6937
7059
|
return currentDate.length >= 2 && (type2 === "range" || type2 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
|
|
6938
7060
|
};
|
|
6939
7061
|
const renderHeader = () => {
|
|
6940
|
-
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
|
+
));
|
|
6941
7070
|
};
|
|
6942
7071
|
const renderItem = (month, day, index) => {
|
|
6943
7072
|
const startTip = isStartTip(day, month);
|
|
@@ -6953,7 +7082,7 @@
|
|
|
6953
7082
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
|
|
6954
7083
|
!startTip && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
|
|
6955
7084
|
noStartNorEnd && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
|
|
6956
|
-
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),
|
|
6957
7086
|
startTip && /* @__PURE__ */ React.createElement(
|
|
6958
7087
|
"div",
|
|
6959
7088
|
{
|
|
@@ -6969,9 +7098,9 @@
|
|
|
6969
7098
|
);
|
|
6970
7099
|
};
|
|
6971
7100
|
const renderPanel = (month, key) => {
|
|
6972
|
-
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(
|
|
6973
7102
|
(day, i2) => renderItem(month, day, i2)
|
|
6974
|
-
)));
|
|
7103
|
+
))));
|
|
6975
7104
|
};
|
|
6976
7105
|
const renderContent = () => {
|
|
6977
7106
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -6988,7 +7117,6 @@
|
|
|
6988
7117
|
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
|
|
6989
7118
|
"div",
|
|
6990
7119
|
{
|
|
6991
|
-
className: "viewArea",
|
|
6992
7120
|
ref: viewAreaRef,
|
|
6993
7121
|
style: { transform: `translateY(${translateY}px)` }
|
|
6994
7122
|
},
|
|
@@ -7004,13 +7132,328 @@
|
|
|
7004
7132
|
return /* @__PURE__ */ React.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
7005
7133
|
});
|
|
7006
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";
|
|
7007
7448
|
const defaultProps$12 = {
|
|
7008
7449
|
...ComponentDefaults,
|
|
7009
7450
|
type: "single",
|
|
7451
|
+
viewMode: "day",
|
|
7010
7452
|
autoBackfill: false,
|
|
7011
7453
|
popup: true,
|
|
7012
7454
|
visible: false,
|
|
7013
7455
|
title: "",
|
|
7456
|
+
value: "",
|
|
7014
7457
|
defaultValue: "",
|
|
7015
7458
|
startDate: getDateString(0),
|
|
7016
7459
|
endDate: getDateString(365),
|
|
@@ -7020,6 +7463,7 @@
|
|
|
7020
7463
|
confirmText: "",
|
|
7021
7464
|
showTitle: true,
|
|
7022
7465
|
showSubTitle: true,
|
|
7466
|
+
showMonthNumber: false,
|
|
7023
7467
|
scrollAnimation: true,
|
|
7024
7468
|
firstDayOfWeek: 0,
|
|
7025
7469
|
disableDate: (date2) => false,
|
|
@@ -7033,6 +7477,8 @@
|
|
|
7033
7477
|
},
|
|
7034
7478
|
onDayClick: (data) => {
|
|
7035
7479
|
},
|
|
7480
|
+
onItemClick: () => {
|
|
7481
|
+
},
|
|
7036
7482
|
onPageChange: (param) => {
|
|
7037
7483
|
}
|
|
7038
7484
|
};
|
|
@@ -7045,8 +7491,10 @@
|
|
|
7045
7491
|
popup,
|
|
7046
7492
|
visible,
|
|
7047
7493
|
type: type2,
|
|
7494
|
+
viewMode,
|
|
7048
7495
|
autoBackfill,
|
|
7049
7496
|
title,
|
|
7497
|
+
value,
|
|
7050
7498
|
defaultValue,
|
|
7051
7499
|
startDate,
|
|
7052
7500
|
endDate,
|
|
@@ -7056,6 +7504,7 @@
|
|
|
7056
7504
|
confirmText,
|
|
7057
7505
|
showTitle,
|
|
7058
7506
|
showSubTitle,
|
|
7507
|
+
showMonthNumber,
|
|
7059
7508
|
scrollAnimation,
|
|
7060
7509
|
firstDayOfWeek,
|
|
7061
7510
|
closeIcon,
|
|
@@ -7068,6 +7517,7 @@
|
|
|
7068
7517
|
onClose,
|
|
7069
7518
|
onConfirm,
|
|
7070
7519
|
onDayClick,
|
|
7520
|
+
onItemClick,
|
|
7071
7521
|
onPageChange
|
|
7072
7522
|
} = { ...defaultProps$12, ...props };
|
|
7073
7523
|
const calendarRef = React.useRef(null);
|
|
@@ -7081,9 +7531,6 @@
|
|
|
7081
7531
|
const closePopup = () => {
|
|
7082
7532
|
close2();
|
|
7083
7533
|
};
|
|
7084
|
-
const select = (param) => {
|
|
7085
|
-
onDayClick && onDayClick(param);
|
|
7086
|
-
};
|
|
7087
7534
|
const scrollToDate = (date2) => {
|
|
7088
7535
|
var _a;
|
|
7089
7536
|
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date2);
|
|
@@ -7095,7 +7542,25 @@
|
|
|
7095
7542
|
scrollToDate
|
|
7096
7543
|
}));
|
|
7097
7544
|
const renderItem = () => {
|
|
7098
|
-
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(
|
|
7099
7564
|
CalendarItem,
|
|
7100
7565
|
{
|
|
7101
7566
|
ref: calendarRef,
|
|
@@ -7115,6 +7580,7 @@
|
|
|
7115
7580
|
confirmText: confirmText || locale.calendaritem.confirm,
|
|
7116
7581
|
showTitle,
|
|
7117
7582
|
showSubTitle,
|
|
7583
|
+
showMonthNumber,
|
|
7118
7584
|
scrollAnimation,
|
|
7119
7585
|
firstDayOfWeek,
|
|
7120
7586
|
disableDate,
|
|
@@ -7124,12 +7590,12 @@
|
|
|
7124
7590
|
renderDayTop,
|
|
7125
7591
|
renderDayBottom,
|
|
7126
7592
|
onConfirm: choose,
|
|
7127
|
-
onDayClick
|
|
7593
|
+
onDayClick,
|
|
7128
7594
|
onPageChange: yearMonthChange
|
|
7129
7595
|
}
|
|
7130
|
-
);
|
|
7596
|
+
));
|
|
7131
7597
|
};
|
|
7132
|
-
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(
|
|
7133
7599
|
Popup,
|
|
7134
7600
|
{
|
|
7135
7601
|
className: "nut-calendar-popup",
|
|
@@ -7137,11 +7603,11 @@
|
|
|
7137
7603
|
position: "bottom",
|
|
7138
7604
|
round: true,
|
|
7139
7605
|
closeable: true,
|
|
7606
|
+
closeIcon,
|
|
7140
7607
|
destroyOnClose: true,
|
|
7141
7608
|
onOverlayClick: closePopup,
|
|
7142
7609
|
onCloseIconClick: closePopup,
|
|
7143
|
-
style: { height: "83%" }
|
|
7144
|
-
closeIcon
|
|
7610
|
+
style: { height: "83%" }
|
|
7145
7611
|
},
|
|
7146
7612
|
renderItem()
|
|
7147
7613
|
) : renderItem());
|
|
@@ -12106,41 +12572,45 @@
|
|
|
12106
12572
|
searchSelf && searchSelf.focus();
|
|
12107
12573
|
};
|
|
12108
12574
|
const change = (event) => {
|
|
12109
|
-
if (value === event.
|
|
12110
|
-
onChange && (onChange == null ? void 0 : onChange(event.
|
|
12111
|
-
setValue(event.
|
|
12112
|
-
event.
|
|
12575
|
+
if (value === event.detail.value) return;
|
|
12576
|
+
onChange && (onChange == null ? void 0 : onChange(event.detail.value, event));
|
|
12577
|
+
setValue(event.detail.value);
|
|
12578
|
+
event.detail.value === "" && forceFocus();
|
|
12113
12579
|
};
|
|
12114
12580
|
const focus = (event) => {
|
|
12115
|
-
const { value: value2 } = event.
|
|
12581
|
+
const { value: value2 } = event.detail;
|
|
12116
12582
|
onFocus && (onFocus == null ? void 0 : onFocus(value2, event));
|
|
12117
12583
|
};
|
|
12118
12584
|
const blur = (event) => {
|
|
12119
12585
|
const searchSelf = searchRef.current;
|
|
12120
12586
|
searchSelf && searchSelf.blur();
|
|
12121
|
-
const { value: value2 } = event.
|
|
12587
|
+
const { value: value2 } = event.detail;
|
|
12122
12588
|
onBlur && (onBlur == null ? void 0 : onBlur(value2, event));
|
|
12123
12589
|
};
|
|
12124
12590
|
React.useEffect(() => {
|
|
12125
12591
|
setValue(outerValue || "");
|
|
12126
12592
|
}, [outerValue]);
|
|
12127
12593
|
React.useEffect(() => {
|
|
12128
|
-
|
|
12594
|
+
if (Taro.getEnv() === "WEB") {
|
|
12595
|
+
autoFocus && forceFocus();
|
|
12596
|
+
}
|
|
12129
12597
|
}, [autoFocus]);
|
|
12130
12598
|
const renderField = () => {
|
|
12131
12599
|
return /* @__PURE__ */ React.createElement(
|
|
12132
|
-
|
|
12600
|
+
components.Input,
|
|
12133
12601
|
{
|
|
12134
12602
|
className: `${classPrefix2}-input ${clearable ? `${classPrefix2}-input-clear` : ""}`,
|
|
12135
12603
|
ref: searchRef,
|
|
12136
12604
|
style,
|
|
12137
|
-
value: value || "",
|
|
12605
|
+
value: (value || "").toString(),
|
|
12138
12606
|
placeholder: placeholder || locale.placeholder,
|
|
12139
|
-
disabled,
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12607
|
+
disabled: disabled || readOnly,
|
|
12608
|
+
maxlength: maxLength,
|
|
12609
|
+
nativeProps: {
|
|
12610
|
+
onKeyPress: onKeypress
|
|
12611
|
+
},
|
|
12612
|
+
autoFocus,
|
|
12613
|
+
onInput: (e2) => change(e2),
|
|
12144
12614
|
onFocus: (e2) => focus(e2),
|
|
12145
12615
|
onBlur: (e2) => blur(e2),
|
|
12146
12616
|
onClick: (e2) => clickInput(e2)
|
|
@@ -12152,23 +12622,23 @@
|
|
|
12152
12622
|
};
|
|
12153
12623
|
const renderLeftIn = () => {
|
|
12154
12624
|
if (!leftIn) return null;
|
|
12155
|
-
return /* @__PURE__ */ React.createElement(
|
|
12625
|
+
return /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-leftin ${classPrefix2}-icon` }, leftIn);
|
|
12156
12626
|
};
|
|
12157
12627
|
const renderLeft = () => {
|
|
12158
12628
|
if (!backable && !left2) return null;
|
|
12159
|
-
return /* @__PURE__ */ React.createElement(
|
|
12629
|
+
return /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-left` }, backable ? /* @__PURE__ */ React.createElement(j$1, { size: "16" }) : left2);
|
|
12160
12630
|
};
|
|
12161
12631
|
const renderRightIn = () => {
|
|
12162
12632
|
if (!rightIn) return null;
|
|
12163
|
-
return /* @__PURE__ */ React.createElement(
|
|
12633
|
+
return /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-rightin ${classPrefix2}-icon` }, rightIn);
|
|
12164
12634
|
};
|
|
12165
12635
|
const renderRight = () => {
|
|
12166
12636
|
if (!right2) return null;
|
|
12167
|
-
return /* @__PURE__ */ React.createElement(
|
|
12637
|
+
return /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix2}-right` }, right2);
|
|
12168
12638
|
};
|
|
12169
12639
|
const handleClear = () => {
|
|
12170
12640
|
return /* @__PURE__ */ React.createElement(
|
|
12171
|
-
|
|
12641
|
+
components.View,
|
|
12172
12642
|
{
|
|
12173
12643
|
className: `${classPrefix2}-clear ${classPrefix2}-icon`,
|
|
12174
12644
|
onClick: (e2) => clearaVal(e2)
|
|
@@ -12194,19 +12664,19 @@
|
|
|
12194
12664
|
}
|
|
12195
12665
|
};
|
|
12196
12666
|
return /* @__PURE__ */ React.createElement(
|
|
12197
|
-
|
|
12667
|
+
components.View,
|
|
12198
12668
|
{
|
|
12199
12669
|
className: `${classPrefix2} ${disabled ? `${classPrefix2}-disabled` : ""} ${className || ""}`,
|
|
12200
12670
|
style
|
|
12201
12671
|
},
|
|
12202
12672
|
renderLeft(),
|
|
12203
12673
|
/* @__PURE__ */ React.createElement(
|
|
12204
|
-
|
|
12674
|
+
components.View,
|
|
12205
12675
|
{
|
|
12206
12676
|
className: `${classPrefix2}-content ${shape === "round" ? `${classPrefix2}-round` : ""}`
|
|
12207
12677
|
},
|
|
12208
12678
|
renderLeftIn(),
|
|
12209
|
-
/* @__PURE__ */ React.createElement(
|
|
12679
|
+
/* @__PURE__ */ React.createElement(components.View, { className: "nut-searchbar-input-box" }, renderField()),
|
|
12210
12680
|
clearable && !value && renderRightIn(),
|
|
12211
12681
|
clearable && value && handleClear()
|
|
12212
12682
|
),
|
|
@@ -13579,7 +14049,7 @@
|
|
|
13579
14049
|
const stateRef = React.useRef(args);
|
|
13580
14050
|
const currentRef = React.useRef();
|
|
13581
14051
|
const previousRef = React.useRef();
|
|
13582
|
-
if (!
|
|
14052
|
+
if (!isEqual$1(currentRef.current, args)) {
|
|
13583
14053
|
previousRef.current = currentRef.current;
|
|
13584
14054
|
currentRef.current = args;
|
|
13585
14055
|
stateRef.current = args;
|
|
@@ -18005,18 +18475,6 @@
|
|
|
18005
18475
|
}
|
|
18006
18476
|
});
|
|
18007
18477
|
};
|
|
18008
|
-
const defaultConfigRef = {
|
|
18009
|
-
current: {
|
|
18010
|
-
locale: zhCN
|
|
18011
|
-
}
|
|
18012
|
-
};
|
|
18013
|
-
const getDefaultConfig = () => {
|
|
18014
|
-
return defaultConfigRef.current;
|
|
18015
|
-
};
|
|
18016
|
-
const ConfigContext = React.createContext(null);
|
|
18017
|
-
const useConfig = () => {
|
|
18018
|
-
return React.useContext(ConfigContext) ?? getDefaultConfig();
|
|
18019
|
-
};
|
|
18020
18478
|
const defaultProps$9 = {
|
|
18021
18479
|
...ComponentDefaults,
|
|
18022
18480
|
visible: false,
|