@nutui/nutui-react 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.
Files changed (41) hide show
  1. package/CHANGELOG.md +22 -6
  2. package/dist/esm/Calendar/style/index.js +3 -1
  3. package/dist/esm/Calendar/style/style.css +1 -1
  4. package/dist/esm/Calendar.js +267 -10
  5. package/dist/esm/CalendarCard.js +1 -1
  6. package/dist/esm/CalendarItem.js +119 -42
  7. package/dist/esm/ImagePreview/style/style.css +1 -1
  8. package/dist/esm/Swiper/style/style.css +1 -1
  9. package/dist/esm/Swiper.js +5 -6
  10. package/dist/esm/configprovider2.js +4 -0
  11. package/dist/esm/date.js +7 -80
  12. package/dist/esm/utils.js +125 -0
  13. package/dist/locales/base.d.ts +4 -0
  14. package/dist/locales/base.js +1 -1
  15. package/dist/locales/en-US.js +5 -1
  16. package/dist/locales/id-ID.js +5 -1
  17. package/dist/locales/tr-TR.js +5 -1
  18. package/dist/locales/zh-CN.js +5 -1
  19. package/dist/locales/zh-TW.js +5 -1
  20. package/dist/locales/zh-UG.js +5 -1
  21. package/dist/nutui.react.es.js +562 -120
  22. package/dist/nutui.react.umd.js +562 -120
  23. package/dist/packages/calendar/calendar.scss +24 -0
  24. package/dist/packages/calendar/calendarviewmode.scss +181 -0
  25. package/dist/packages/swiper/swiper.scss +11 -0
  26. package/dist/style.css +1 -1
  27. package/dist/styles/variables.scss +4 -0
  28. package/dist/types/locales/base.d.ts +4 -0
  29. package/dist/types/packages/calendar/calendar.d.ts +4 -0
  30. package/dist/types/packages/calendar/calendar.taro.d.ts +4 -0
  31. package/dist/types/packages/calendar/calendarviewmodeitem.d.ts +20 -0
  32. package/dist/types/packages/calendar/calendarviewmodeitem.taro.d.ts +20 -0
  33. package/dist/types/packages/calendar/types.d.ts +27 -0
  34. package/dist/types/packages/calendar/utils.d.ts +40 -0
  35. package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -0
  36. package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -0
  37. package/dist/types/packages/calendaritem/utils.d.ts +17 -0
  38. package/dist/types/packages/configprovider/types.d.ts +1 -1
  39. package/dist/types/utils/date.d.ts +0 -17
  40. package/dist/types/utils/get-system-info.d.ts +19 -0
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.7.8 Fri Feb 14 2025 16:19:28 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.10 Fri Mar 14 2025 14:49:17 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -594,7 +594,7 @@ const ComponentDefaults = {
594
594
  style: {}
595
595
  };
596
596
  const prefixCls$2 = "nut-button";
597
- const defaultProps$1t = {
597
+ const defaultProps$1u = {
598
598
  ...ComponentDefaults,
599
599
  color: "",
600
600
  type: "default",
@@ -630,7 +630,7 @@ const Button = React__default.forwardRef(
630
630
  onClick,
631
631
  ...rest
632
632
  } = {
633
- ...defaultProps$1t,
633
+ ...defaultProps$1u,
634
634
  ...props
635
635
  };
636
636
  const getStyle = useCallback(() => {
@@ -689,7 +689,7 @@ const Button = React__default.forwardRef(
689
689
  );
690
690
  Button.displayName = "NutButton";
691
691
  const CellGroupContext = createContext(null);
692
- const defaultProps$1s = {
692
+ const defaultProps$1t = {
693
693
  ...ComponentDefaults,
694
694
  title: "",
695
695
  description: "",
@@ -698,7 +698,7 @@ const defaultProps$1s = {
698
698
  const classPrefix$r = "nut-cell-group";
699
699
  const CellGroup = (props) => {
700
700
  const { children, className, title, description, divider, ...rest } = {
701
- ...defaultProps$1s,
701
+ ...defaultProps$1t,
702
702
  ...props
703
703
  };
704
704
  return /* @__PURE__ */ React__default.createElement("div", { className: classNames(classPrefix$r, className), ...rest }, title ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$r}-title` }, title) : null, description ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix$r}-description` }, description) : null, /* @__PURE__ */ React__default.createElement(
@@ -710,7 +710,7 @@ const CellGroup = (props) => {
710
710
  ));
711
711
  };
712
712
  CellGroup.displayName = "NutCellGroup";
713
- const defaultProps$1r = {
713
+ const defaultProps$1s = {
714
714
  ...ComponentDefaults,
715
715
  title: null,
716
716
  description: null,
@@ -737,7 +737,7 @@ const Cell = (props) => {
737
737
  style,
738
738
  ...rest
739
739
  } = {
740
- ...defaultProps$1r,
740
+ ...defaultProps$1s,
741
741
  ...props
742
742
  };
743
743
  const handleClick2 = (event) => {
@@ -1750,6 +1750,10 @@ const zhCN = {
1750
1750
  start: "开始",
1751
1751
  confirm: "确认",
1752
1752
  title: "日历选择",
1753
+ week: "周",
1754
+ month: "月",
1755
+ year: "年",
1756
+ quarter: "季度",
1753
1757
  monthTitle: (year, month) => `${year}年${Number(month) < 10 ? `0${Number(month)}` : month}月`,
1754
1758
  today: "今天",
1755
1759
  loadPreviousMonth: "加载上一个月",
@@ -1940,7 +1944,7 @@ ConfigProvider.displayName = "NutConfigProvider";
1940
1944
  const pxCheck = (value) => {
1941
1945
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
1942
1946
  };
1943
- const defaultProps$1q = {
1947
+ const defaultProps$1r = {
1944
1948
  ...ComponentDefaults,
1945
1949
  fit: "fill",
1946
1950
  position: "center",
@@ -1970,7 +1974,7 @@ const Image$1 = (props) => {
1970
1974
  onClick,
1971
1975
  onLoad,
1972
1976
  onError
1973
- } = { ...defaultProps$1q, ...props };
1977
+ } = { ...defaultProps$1r, ...props };
1974
1978
  const [innerLoading, setInnerLoading] = useState(false);
1975
1979
  const [isError, setIsError] = useState(false);
1976
1980
  const [complete, setComplete] = useState(false);
@@ -2833,7 +2837,7 @@ const Overlay = (props) => {
2833
2837
  };
2834
2838
  Overlay.displayName = "NutOverlay";
2835
2839
  const DataContext$1 = createContext({});
2836
- const defaultProps$1p = {
2840
+ const defaultProps$1q = {
2837
2841
  ...ComponentDefaults,
2838
2842
  span: "24",
2839
2843
  offset: "0",
@@ -2841,7 +2845,7 @@ const defaultProps$1p = {
2841
2845
  };
2842
2846
  const Col = (props) => {
2843
2847
  const { className, style, span, offset, children, onClick } = {
2844
- ...defaultProps$1p,
2848
+ ...defaultProps$1q,
2845
2849
  ...props
2846
2850
  };
2847
2851
  const [colName, setColName] = useState("");
@@ -2874,7 +2878,7 @@ const Col = (props) => {
2874
2878
  );
2875
2879
  };
2876
2880
  Col.displayName = "NutCol";
2877
- const defaultProps$1o = {
2881
+ const defaultProps$1p = {
2878
2882
  ...ComponentDefaults,
2879
2883
  contentPosition: "center",
2880
2884
  direction: "horizontal"
@@ -2882,7 +2886,7 @@ const defaultProps$1o = {
2882
2886
  const classPrefix$n = `nut-divider`;
2883
2887
  const Divider = (props) => {
2884
2888
  const { children, contentPosition, style, className, direction, ...rest } = {
2885
- ...defaultProps$1o,
2889
+ ...defaultProps$1p,
2886
2890
  ...props
2887
2891
  };
2888
2892
  const classes = direction === "horizontal" ? classNames({
@@ -2903,7 +2907,7 @@ const gridContext = {
2903
2907
  }
2904
2908
  };
2905
2909
  const GridContext = React__default.createContext(gridContext);
2906
- const defaultProps$1n = {
2910
+ const defaultProps$1o = {
2907
2911
  text: "",
2908
2912
  columns: 4,
2909
2913
  gap: 0,
@@ -2928,7 +2932,7 @@ const GridItem = (props) => {
2928
2932
  onClick,
2929
2933
  ...rest
2930
2934
  } = {
2931
- ...defaultProps$1n,
2935
+ ...defaultProps$1o,
2932
2936
  ...props
2933
2937
  };
2934
2938
  const classPrefix2 = "nut-grid-item";
@@ -2987,7 +2991,7 @@ const GridItem = (props) => {
2987
2991
  );
2988
2992
  };
2989
2993
  GridItem.displayName = "NutGridItem";
2990
- const defaultProps$1m = {
2994
+ const defaultProps$1n = {
2991
2995
  columns: 4,
2992
2996
  gap: 0,
2993
2997
  center: true,
@@ -3008,7 +3012,7 @@ const Grid = (props) => {
3008
3012
  className,
3009
3013
  onClick,
3010
3014
  ...rest
3011
- } = { ...defaultProps$1m, ...props };
3015
+ } = { ...defaultProps$1n, ...props };
3012
3016
  const childrenDom = React__default.Children.toArray(children);
3013
3017
  const classPrefix2 = "nut-grid";
3014
3018
  const rootClass = () => {
@@ -3049,7 +3053,7 @@ const Layout = () => {
3049
3053
  };
3050
3054
  Layout.displayName = "NutLayout";
3051
3055
  const classPrefix$m = "nut-row";
3052
- const defaultProps$1l = {
3056
+ const defaultProps$1m = {
3053
3057
  ...ComponentDefaults,
3054
3058
  type: "",
3055
3059
  justify: "start",
@@ -3069,7 +3073,7 @@ const Row = (props) => {
3069
3073
  gutter,
3070
3074
  onClick
3071
3075
  } = {
3072
- ...defaultProps$1l,
3076
+ ...defaultProps$1m,
3073
3077
  ...props
3074
3078
  };
3075
3079
  const getClass = (prefix2, type22) => {
@@ -3103,12 +3107,12 @@ const Row = (props) => {
3103
3107
  };
3104
3108
  Row.displayName = "NutRow";
3105
3109
  const prefixCls$1 = "nut-space";
3106
- const defaultProps$1k = {
3110
+ const defaultProps$1l = {
3107
3111
  direction: "horizontal"
3108
3112
  };
3109
3113
  const Space = (props) => {
3110
3114
  const { className, style, children, wrap, align, direction, justify } = {
3111
- ...defaultProps$1k,
3115
+ ...defaultProps$1l,
3112
3116
  ...props
3113
3117
  };
3114
3118
  const cls = classNames(
@@ -3176,7 +3180,7 @@ function useWatch$1(dep, callback, config2 = { immediate: false }) {
3176
3180
  stop2.current = true;
3177
3181
  };
3178
3182
  }
3179
- const defaultProps$1j = {
3183
+ const defaultProps$1k = {
3180
3184
  ...ComponentDefaults,
3181
3185
  position: "top",
3182
3186
  threshold: 0,
@@ -3194,7 +3198,7 @@ const Sticky = (props) => {
3194
3198
  threshold,
3195
3199
  onChange,
3196
3200
  ...rest
3197
- } = { ...defaultProps$1j, ...props };
3201
+ } = { ...defaultProps$1k, ...props };
3198
3202
  const stickyRef = useRef(null);
3199
3203
  const rootRef = useRef(null);
3200
3204
  const [isFixed, setIsFixed] = useState(false);
@@ -3318,7 +3322,7 @@ const SafeArea = (props) => {
3318
3322
  );
3319
3323
  };
3320
3324
  SafeArea.displayName = "NutSafeArea";
3321
- const defaultProps$1i = {
3325
+ const defaultProps$1j = {
3322
3326
  ...ComponentDefaults,
3323
3327
  target: "",
3324
3328
  threshold: 200,
@@ -3337,7 +3341,7 @@ const BackTop = (props) => {
3337
3341
  style,
3338
3342
  onClick
3339
3343
  } = {
3340
- ...defaultProps$1i,
3344
+ ...defaultProps$1j,
3341
3345
  ...props
3342
3346
  };
3343
3347
  const classPrefix2 = "nut-backtop";
@@ -8230,7 +8234,7 @@ const host = createHost(primitives, {
8230
8234
  });
8231
8235
  const animated = host.animated;
8232
8236
  const elevatorContext = createContext({});
8233
- const defaultProps$1h = {
8237
+ const defaultProps$1i = {
8234
8238
  ...ComponentDefaults,
8235
8239
  height: "200px",
8236
8240
  floorKey: "title",
@@ -8256,7 +8260,7 @@ const Elevator = (props) => {
8256
8260
  children,
8257
8261
  ...rest
8258
8262
  } = {
8259
- ...defaultProps$1h,
8263
+ ...defaultProps$1i,
8260
8264
  ...props
8261
8265
  };
8262
8266
  const classPrefix2 = "nut-elevator";
@@ -8434,7 +8438,7 @@ const Elevator = (props) => {
8434
8438
  };
8435
8439
  Elevator.displayName = "NutElevator";
8436
8440
  Elevator.Context = elevatorContext;
8437
- const defaultProps$1g = {
8441
+ const defaultProps$1h = {
8438
8442
  ...ComponentDefaults,
8439
8443
  activeText: "",
8440
8444
  inactiveText: "",
@@ -8462,7 +8466,7 @@ const FixedNav = (props) => {
8462
8466
  content,
8463
8467
  ...rest
8464
8468
  } = {
8465
- ...defaultProps$1g,
8469
+ ...defaultProps$1h,
8466
8470
  ...props
8467
8471
  };
8468
8472
  const classPrefix2 = "nut-fixednav";
@@ -8515,7 +8519,7 @@ const FixedNav = (props) => {
8515
8519
  );
8516
8520
  };
8517
8521
  FixedNav.displayName = "NutFixedNav";
8518
- const defaultProps$1f = {
8522
+ const defaultProps$1g = {
8519
8523
  ...ComponentDefaults,
8520
8524
  left: "",
8521
8525
  right: "",
@@ -8540,7 +8544,7 @@ const NavBar = (props) => {
8540
8544
  zIndex,
8541
8545
  onBackClick
8542
8546
  } = {
8543
- ...defaultProps$1f,
8547
+ ...defaultProps$1g,
8544
8548
  ...props
8545
8549
  };
8546
8550
  const classPrefix2 = "nut-navbar";
@@ -8616,7 +8620,7 @@ const NavBar = (props) => {
8616
8620
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React__default.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
8617
8621
  };
8618
8622
  NavBar.displayName = "NutNavBar";
8619
- const defaultProps$1e = {
8623
+ const defaultProps$1f = {
8620
8624
  ...ComponentDefaults,
8621
8625
  position: "center",
8622
8626
  transition: "",
@@ -8669,7 +8673,7 @@ const Popup = (props) => {
8669
8673
  afterShow,
8670
8674
  afterClose,
8671
8675
  onClick
8672
- } = { ...defaultProps$1e, ...props };
8676
+ } = { ...defaultProps$1f, ...props };
8673
8677
  const nodeRef = React__default.useRef(null);
8674
8678
  let innerIndex = zIndex || _zIndex;
8675
8679
  const [index, setIndex] = useState(innerIndex);
@@ -8826,7 +8830,7 @@ const handleClick = (e) => {
8826
8830
  }
8827
8831
  };
8828
8832
  const OffsetContext = createContext(20);
8829
- const defaultProps$1d = {
8833
+ const defaultProps$1e = {
8830
8834
  ...ComponentDefaults,
8831
8835
  position: "left",
8832
8836
  width: "80%"
@@ -8844,7 +8848,7 @@ const SideNavBar = (props) => {
8844
8848
  indent,
8845
8849
  ...rest
8846
8850
  } = {
8847
- ...defaultProps$1d,
8851
+ ...defaultProps$1e,
8848
8852
  ...props
8849
8853
  };
8850
8854
  const innerIndent = indent ? Number(indent) : 20;
@@ -8894,13 +8898,13 @@ const SideNavBarItem = (props) => {
8894
8898
  title
8895
8899
  );
8896
8900
  };
8897
- const defaultProps$1c = {
8901
+ const defaultProps$1d = {
8898
8902
  open: true
8899
8903
  };
8900
8904
  const SubSideNavBar = (props) => {
8901
8905
  const classPrefix2 = "nut-subsidenavbar";
8902
8906
  const { title, value, children, onClick, open, ...rest } = {
8903
- ...defaultProps$1c,
8907
+ ...defaultProps$1d,
8904
8908
  ...props
8905
8909
  };
8906
8910
  const offset = useContext(OffsetContext);
@@ -8977,7 +8981,7 @@ function usePropsValue({
8977
8981
  );
8978
8982
  return [stateRef.current, setState];
8979
8983
  }
8980
- const defaultProps$1b = {
8984
+ const defaultProps$1c = {
8981
8985
  ...ComponentDefaults,
8982
8986
  value: "",
8983
8987
  dot: false,
@@ -9002,7 +9006,7 @@ const Badge = (props) => {
9002
9006
  color,
9003
9007
  fill
9004
9008
  } = {
9005
- ...defaultProps$1b,
9009
+ ...defaultProps$1c,
9006
9010
  ...props
9007
9011
  };
9008
9012
  const classPrefix2 = "nut-badge";
@@ -9056,7 +9060,7 @@ const Badge = (props) => {
9056
9060
  };
9057
9061
  Badge.displayName = "NutBadge";
9058
9062
  const TabbarContext = React__default.createContext(null);
9059
- const defaultProps$1a = {
9063
+ const defaultProps$1b = {
9060
9064
  ...ComponentDefaults,
9061
9065
  title: "",
9062
9066
  icon: null,
@@ -9082,7 +9086,7 @@ const TabbarItem = (props) => {
9082
9086
  index,
9083
9087
  ...rest
9084
9088
  } = {
9085
- ...defaultProps$1a,
9089
+ ...defaultProps$1b,
9086
9090
  ...props
9087
9091
  };
9088
9092
  const active = index === (ctx2 == null ? void 0 : ctx2.selectIndex);
@@ -9120,7 +9124,7 @@ const TabbarItem = (props) => {
9120
9124
  icon ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React__default.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React__default.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React__default.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React__default.createElement("div", { className: titleClass }, title))
9121
9125
  );
9122
9126
  };
9123
- const defaultProps$19 = {
9127
+ const defaultProps$1a = {
9124
9128
  ...ComponentDefaults,
9125
9129
  defaultValue: 0,
9126
9130
  fixed: false,
@@ -9143,7 +9147,7 @@ const Tabbar = (props) => {
9143
9147
  style,
9144
9148
  onSwitch
9145
9149
  } = {
9146
- ...defaultProps$19,
9150
+ ...defaultProps$1a,
9147
9151
  ...props
9148
9152
  };
9149
9153
  const classPrefix2 = "nut-tabbar";
@@ -9185,14 +9189,14 @@ const Tabbar = (props) => {
9185
9189
  };
9186
9190
  Tabbar.displayName = "NutTabbar";
9187
9191
  Tabbar.Item = TabbarItem;
9188
- const defaultProps$18 = {
9192
+ const defaultProps$19 = {
9189
9193
  title: "",
9190
9194
  value: "",
9191
9195
  disabled: false
9192
9196
  };
9193
9197
  const TabPane = (props) => {
9194
9198
  const { children, autoHeightClassName, className, disabled } = {
9195
- ...defaultProps$18,
9199
+ ...defaultProps$19,
9196
9200
  ...props
9197
9201
  };
9198
9202
  const classPrefix2 = "nut-tabpane";
@@ -9206,7 +9210,7 @@ const TabPane = (props) => {
9206
9210
  );
9207
9211
  return children && /* @__PURE__ */ React__default.createElement("div", { className: classes }, !disabled && children);
9208
9212
  };
9209
- const defaultProps$17 = {
9213
+ const defaultProps$18 = {
9210
9214
  ...ComponentDefaults,
9211
9215
  tabStyle: {},
9212
9216
  activeColor: "",
@@ -9234,7 +9238,7 @@ const Tabs = (props) => {
9234
9238
  value: outerValue,
9235
9239
  defaultValue: outerDefaultValue,
9236
9240
  ...rest
9237
- } = { ...defaultProps$17, ...props };
9241
+ } = { ...defaultProps$18, ...props };
9238
9242
  const [value, setValue] = usePropsValue({
9239
9243
  value: outerValue,
9240
9244
  defaultValue: outerDefaultValue,
@@ -9515,7 +9519,7 @@ class Tree {
9515
9519
  return pathNodes;
9516
9520
  }
9517
9521
  }
9518
- const defaultProps$16 = {
9522
+ const defaultProps$17 = {
9519
9523
  ...ComponentDefaults,
9520
9524
  activeColor: "",
9521
9525
  activeIcon: "checklist",
@@ -9561,7 +9565,7 @@ const InternalCascader = (props, ref) => {
9561
9565
  onClose,
9562
9566
  onChange,
9563
9567
  onPathChange
9564
- } = { ...defaultProps$16, ...props };
9568
+ } = { ...defaultProps$17, ...props };
9565
9569
  const [tabvalue, setTabvalue] = useState("c1");
9566
9570
  const [optionsData, setOptionsData] = useState([]);
9567
9571
  const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
@@ -9871,7 +9875,7 @@ const InternalCascader = (props, ref) => {
9871
9875
  };
9872
9876
  const Cascader = React__default.forwardRef(InternalCascader);
9873
9877
  Cascader.displayName = "NutCascader";
9874
- const defaultProps$15 = {
9878
+ const defaultProps$16 = {
9875
9879
  ...ComponentDefaults,
9876
9880
  visible: false,
9877
9881
  type: "custom",
@@ -9898,7 +9902,7 @@ const CustomRender = (props) => {
9898
9902
  onPathChange,
9899
9903
  ...rest
9900
9904
  } = {
9901
- ...defaultProps$15,
9905
+ ...defaultProps$16,
9902
9906
  ...props
9903
9907
  };
9904
9908
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, type4 === "custom" && /* @__PURE__ */ React__default.createElement(
@@ -9923,7 +9927,7 @@ const CustomRender = (props) => {
9923
9927
  }
9924
9928
  ));
9925
9929
  };
9926
- const defaultProps$14 = {
9930
+ const defaultProps$15 = {
9927
9931
  type: "custom",
9928
9932
  existList: [],
9929
9933
  defaultIcon: null,
@@ -9942,7 +9946,7 @@ const ExistRender = (props) => {
9942
9946
  onSelect,
9943
9947
  onSwitch,
9944
9948
  ...rest
9945
- } = { ...defaultProps$14, ...props };
9949
+ } = { ...defaultProps$15, ...props };
9946
9950
  const classPrefix2 = "nut-address";
9947
9951
  const selectedExist = (item) => {
9948
9952
  existList.forEach((list, index) => {
@@ -9971,7 +9975,7 @@ const ExistRender = (props) => {
9971
9975
  );
9972
9976
  })), (custom || custom && locale.address.chooseAnotherAddress) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer`, onClick }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-footer-btn` }, custom)));
9973
9977
  };
9974
- const defaultProps$13 = {
9978
+ const defaultProps$14 = {
9975
9979
  ...ComponentDefaults,
9976
9980
  defaultValue: [],
9977
9981
  type: "custom",
@@ -10013,7 +10017,7 @@ const InternalAddress = (props, ref) => {
10013
10017
  onSwitch,
10014
10018
  ...rest
10015
10019
  } = {
10016
- ...defaultProps$13,
10020
+ ...defaultProps$14,
10017
10021
  ...props
10018
10022
  };
10019
10023
  const classPrefix2 = "nut-address";
@@ -10170,33 +10174,6 @@ const isEqual = (date1, date22) => {
10170
10174
  const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10171
10175
  return startTime === endTime;
10172
10176
  };
10173
- const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
10174
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
10175
- const nowTime = dateNow.getTime();
10176
- let day = dateNow.getDay();
10177
- if (firstDayOfWeek === 0) {
10178
- const oneDayTime2 = 24 * 60 * 60 * 1e3;
10179
- const SundayTime2 = nowTime - day * oneDayTime2;
10180
- const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10181
- const sunday2 = date2Str(new Date(SundayTime2));
10182
- const saturday = date2Str(new Date(SaturdayTime));
10183
- return [sunday2, saturday];
10184
- }
10185
- day = day === 0 ? 7 : day;
10186
- const oneDayTime = 24 * 60 * 60 * 1e3;
10187
- const MondayTime = nowTime - (day - 1) * oneDayTime;
10188
- const SundayTime = nowTime + (7 - day) * oneDayTime;
10189
- const monday = date2Str(new Date(MondayTime));
10190
- const sunday = date2Str(new Date(SundayTime));
10191
- return [monday, sunday];
10192
- };
10193
- const formatResultDate = (date4) => {
10194
- const [year, month, day] = [...date4.split("-")];
10195
- const formatterDay = getNumTwoBit(Number(day));
10196
- const formatterDate = `${year}-${month}-${day}`;
10197
- const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
10198
- return [year, month, formatterDay, formatterDate, dayOfWeek];
10199
- };
10200
10177
  const getCurrMonthData = (type4, year, month) => {
10201
10178
  {
10202
10179
  month === 12 && (year += 1);
@@ -10238,6 +10215,74 @@ const getPreMonthDates = (type4, year, month, firstDayOfWeek) => {
10238
10215
  });
10239
10216
  return months.slice(preDates - days);
10240
10217
  };
10218
+ const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
10219
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
10220
+ const nowTime = dateNow.getTime();
10221
+ let day = dateNow.getDay();
10222
+ if (firstDayOfWeek === 0) {
10223
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
10224
+ const SundayTime2 = nowTime - day * oneDayTime2;
10225
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10226
+ const sunday2 = date2Str(new Date(SundayTime2));
10227
+ const saturday = date2Str(new Date(SaturdayTime));
10228
+ return [sunday2, saturday];
10229
+ }
10230
+ day = day === 0 ? 7 : day;
10231
+ const oneDayTime = 24 * 60 * 60 * 1e3;
10232
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
10233
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
10234
+ const monday = date2Str(new Date(MondayTime));
10235
+ const sunday = date2Str(new Date(SundayTime));
10236
+ return [monday, sunday];
10237
+ };
10238
+ const formatResultDate = (date4) => {
10239
+ const [year, month, day] = [...date4.split("-")];
10240
+ const formatterDay = getNumTwoBit(Number(day));
10241
+ const formatterDate = `${year}-${month}-${day}`;
10242
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
10243
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
10244
+ };
10245
+ const getWeekOfYearByYMD = (year, month, date4, firstDayOfWeek = 0) => {
10246
+ const MILLISECONDS_PER_DAY = 864e5;
10247
+ const dateNow = new Date(year, month - 1, date4);
10248
+ const dateFirst = new Date(year, 0, 1);
10249
+ const dayOfYear = Math.round(
10250
+ (dateNow.valueOf() - dateFirst.valueOf()) / MILLISECONDS_PER_DAY
10251
+ );
10252
+ const DAYS_OF_FIRST_WEEK = 3;
10253
+ let dayOfWeek = dateNow.getDay();
10254
+ let remainder = 6 - dayOfWeek - DAYS_OF_FIRST_WEEK;
10255
+ if (firstDayOfWeek !== 0) {
10256
+ dayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
10257
+ remainder = 7 - dayOfWeek - DAYS_OF_FIRST_WEEK;
10258
+ }
10259
+ let weekNo = Math.ceil((dayOfYear + remainder + 1) / 7);
10260
+ if (weekNo === 0) {
10261
+ weekNo = getWeekOfYearByYMD(year - 1, 12, 31, firstDayOfWeek);
10262
+ } else if (weekNo === 53) {
10263
+ const remainder2 = 7 - dayOfWeek - DAYS_OF_FIRST_WEEK;
10264
+ weekNo = remainder2 > 0 ? 1 : weekNo;
10265
+ }
10266
+ return weekNo;
10267
+ };
10268
+ const getWeekNosOfYear = (year, month, firstDayOfWeek) => {
10269
+ const startWeekNo = getWeekOfYearByYMD(year, month, 1, firstDayOfWeek);
10270
+ const endWeekNo = getWeekOfYearByYMD(
10271
+ year,
10272
+ month,
10273
+ getMonthDays(`${year}`, `${month}`),
10274
+ firstDayOfWeek
10275
+ );
10276
+ return Array.from(
10277
+ {
10278
+ length: (endWeekNo === 1 ? 53 : endWeekNo) - (startWeekNo === 53 || startWeekNo === 52 ? 0 : startWeekNo) + 1
10279
+ },
10280
+ (_, i2) => {
10281
+ const lastIndex = (endWeekNo === 1 ? 53 : endWeekNo) - startWeekNo;
10282
+ return `${endWeekNo === 1 && i2 === lastIndex ? 1 : ((startWeekNo === 53 || startWeekNo === 52) && i2 !== 0 ? 0 : startWeekNo) + i2}`;
10283
+ }
10284
+ );
10285
+ };
10241
10286
  const splitDate = (date4) => {
10242
10287
  const split = date4.indexOf("-") !== -1 ? "-" : "/";
10243
10288
  return date4.split(split);
@@ -10266,7 +10311,89 @@ const isEnd = (day, days) => {
10266
10311
  const isStartAndEnd = (days) => {
10267
10312
  return days.length >= 2 && isEqual(days[0], days[1]);
10268
10313
  };
10269
- const defaultProps$12 = {
10314
+ const getPreMonths = (type4, year, month) => {
10315
+ const preMonth = +month - 1;
10316
+ const months = Array.from(Array(preMonth), (v, k) => {
10317
+ return {
10318
+ year,
10319
+ month: k + 1,
10320
+ yearAndMonth: formatMonth(year, k + 1),
10321
+ type: type4
10322
+ };
10323
+ });
10324
+ return months;
10325
+ };
10326
+ const getMonths = (type4, year, month, endMonth = 12) => {
10327
+ const nextMonth = endMonth - month + 1;
10328
+ const months = Array.from(Array(nextMonth), (v, k) => {
10329
+ return {
10330
+ year,
10331
+ month: k + month,
10332
+ yearAndMonth: formatMonth(year, k + month),
10333
+ type: type4
10334
+ };
10335
+ });
10336
+ return months;
10337
+ };
10338
+ const formatMonth = (year, month) => {
10339
+ return `${year}-${String(month).padStart(2, "0")}`;
10340
+ };
10341
+ const formatQuarter = (year, quarter) => {
10342
+ return `${year}-Q${quarter}`;
10343
+ };
10344
+ const getQuarter = (month) => {
10345
+ if (month < 1 || month > 12) {
10346
+ throw new Error("月份必须在 1 到 12 之间");
10347
+ }
10348
+ const quarter = Math.floor((month - 1) / 3) + 1;
10349
+ return quarter;
10350
+ };
10351
+ const getQuarters = (type4, year, month, endMonth = 12) => {
10352
+ const quarters = [];
10353
+ const startIndex = month;
10354
+ const endIndex = endMonth;
10355
+ for (let index = startIndex; index <= endIndex; index += 3) {
10356
+ const quarter = getQuarter(index);
10357
+ quarters.push({
10358
+ year,
10359
+ quarter,
10360
+ yearAndQuarter: formatQuarter(year, quarter),
10361
+ type: type4
10362
+ });
10363
+ }
10364
+ return quarters;
10365
+ };
10366
+ const getPreQuarters = (type4, year, month) => {
10367
+ const quarters = [];
10368
+ const startIndex = 1;
10369
+ const endIndex = month - 3;
10370
+ for (let index = startIndex; index <= endIndex; index += 3) {
10371
+ const quarter = getQuarter(index);
10372
+ quarters.push({
10373
+ year,
10374
+ quarter,
10375
+ yearAndQuarter: formatQuarter(year, quarter),
10376
+ type: type4
10377
+ });
10378
+ }
10379
+ return quarters;
10380
+ };
10381
+ const getNextQuarters = (type4, year, month, endMonth = 12) => {
10382
+ const quarters = [];
10383
+ const startIndex = month + 3;
10384
+ const endIndex = endMonth;
10385
+ for (let index = startIndex; index <= endIndex; index += 3) {
10386
+ const quarter = getQuarter(index);
10387
+ quarters.push({
10388
+ year,
10389
+ quarter,
10390
+ yearAndQuarter: formatQuarter(year, quarter),
10391
+ type: type4
10392
+ });
10393
+ }
10394
+ return quarters;
10395
+ };
10396
+ const defaultProps$13 = {
10270
10397
  ...ComponentDefaults,
10271
10398
  type: "single",
10272
10399
  autoBackfill: false,
@@ -10280,6 +10407,7 @@ const defaultProps$12 = {
10280
10407
  confirmText: "",
10281
10408
  showTitle: true,
10282
10409
  showSubTitle: true,
10410
+ showMonthNumber: false,
10283
10411
  scrollAnimation: true,
10284
10412
  firstDayOfWeek: 0,
10285
10413
  disableDate: (date4) => false,
@@ -10306,6 +10434,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10306
10434
  type: type4,
10307
10435
  autoBackfill,
10308
10436
  title,
10437
+ value,
10309
10438
  defaultValue,
10310
10439
  startDate,
10311
10440
  endDate,
@@ -10315,6 +10444,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10315
10444
  confirmText,
10316
10445
  showTitle,
10317
10446
  showSubTitle,
10447
+ showMonthNumber,
10318
10448
  scrollAnimation,
10319
10449
  firstDayOfWeek,
10320
10450
  disableDate,
@@ -10323,12 +10453,11 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10323
10453
  renderDay,
10324
10454
  renderDayTop,
10325
10455
  renderDayBottom,
10326
- value,
10327
10456
  onConfirm,
10328
10457
  onUpdate,
10329
10458
  onDayClick,
10330
10459
  onPageChange
10331
- } = { ...defaultProps$12, ...props };
10460
+ } = { ...defaultProps$13, ...props };
10332
10461
  const classPrefix2 = "nut-calendar";
10333
10462
  const dayPrefix = "nut-calendar-day";
10334
10463
  const weekdays = locale.calendaritem.weekdays;
@@ -10353,7 +10482,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10353
10482
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
10354
10483
  return type4 !== "single" ? [...defaultValue] : defaultValue;
10355
10484
  }
10356
- return void 0;
10485
+ return type4 === "single" ? "" : [];
10357
10486
  };
10358
10487
  const [currentDate, setCurrentDate] = usePropsValue({
10359
10488
  value,
@@ -10379,15 +10508,16 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10379
10508
  ...getPreMonthDates("prev", y, m2, firstDayOfWeek),
10380
10509
  ...getDaysStatus("active", y, m2)
10381
10510
  ];
10382
- const cssHeight = 39 + (days.length > 35 ? 384 : 320);
10383
10511
  let scrollTop = 0;
10384
10512
  if (monthData.length > 0) {
10385
10513
  const monthEle = monthData[monthData.length - 1];
10386
10514
  scrollTop = monthEle.scrollTop + monthEle.cssHeight;
10387
10515
  }
10516
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
10388
10517
  const monthInfo = {
10389
10518
  curData: date4,
10390
10519
  title: monthTitle(y, m2),
10520
+ weekNo: getWeekNosOfYear(y, m2, firstDayOfWeek),
10391
10521
  monthData: days,
10392
10522
  cssHeight,
10393
10523
  scrollTop
@@ -10409,7 +10539,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10409
10539
  const currentMonthsData = monthsData[current];
10410
10540
  if (currentMonthsData.title === yearMonthTitle) return;
10411
10541
  const [year, month] = currentMonthsData.curData;
10412
- onPageChange && onPageChange([year, month, `${year}-${month}`]);
10542
+ onPageChange == null ? void 0 : onPageChange([year, month, `${year}-${month}`]);
10413
10543
  setYearMonthTitle(currentMonthsData.title);
10414
10544
  };
10415
10545
  const setDefaultRange = (monthNum, current) => {
@@ -10513,9 +10643,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10513
10643
  const index = monthsData.findIndex((item) => {
10514
10644
  return +item.curData[0] === year && +item.curData[1] === month;
10515
10645
  });
10516
- if (index > -1) {
10517
- current = index;
10518
- }
10646
+ if (index > -1) current = index;
10519
10647
  }
10520
10648
  return {
10521
10649
  current,
@@ -10570,12 +10698,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10570
10698
  const getMonthNum = () => {
10571
10699
  let monthNum = Number(endDates[1]) - Number(startDates[1]);
10572
10700
  const yearNum = Number(endDates[0]) - Number(startDates[0]);
10573
- if (yearNum > 0) {
10574
- monthNum += 12 * yearNum;
10575
- }
10576
- if (monthNum <= 0) {
10577
- monthNum = 1;
10578
- }
10701
+ if (yearNum > 0) monthNum += 12 * yearNum;
10702
+ if (monthNum <= 0) monthNum = 1;
10579
10703
  setMonthsNum(monthNum);
10580
10704
  return monthNum;
10581
10705
  };
@@ -10598,7 +10722,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10598
10722
  initData();
10599
10723
  };
10600
10724
  useEffect(() => {
10601
- setCurrentDate(resetDefaultValue() || []);
10725
+ setCurrentDate(resetDefaultValue());
10602
10726
  }, [defaultValue]);
10603
10727
  useEffect(() => {
10604
10728
  popup && resetRender();
@@ -10751,7 +10875,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10751
10875
  state.currDateArray = [...days];
10752
10876
  }
10753
10877
  if (!isFirst) {
10754
- onDayClick && onDayClick(state.currDateArray);
10878
+ onDayClick == null ? void 0 : onDayClick(state.currDateArray);
10755
10879
  if (autoBackfill || !popup) {
10756
10880
  confirm2();
10757
10881
  }
@@ -10761,9 +10885,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10761
10885
  const confirm2 = () => {
10762
10886
  if (type4 === "range" && state.currDateArray.length === 2 || type4 !== "range") {
10763
10887
  const chooseData = state.currDateArray.slice(0);
10764
- onConfirm && onConfirm(chooseData);
10888
+ onConfirm == null ? void 0 : onConfirm(chooseData);
10765
10889
  if (popup) {
10766
- onUpdate && onUpdate();
10890
+ onUpdate == null ? void 0 : onUpdate();
10767
10891
  }
10768
10892
  }
10769
10893
  };
@@ -10786,7 +10910,14 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10786
10910
  return currentDate.length >= 2 && (type4 === "range" || type4 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
10787
10911
  };
10788
10912
  const renderHeader = () => {
10789
- return /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
10913
+ return /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement(
10914
+ "div",
10915
+ {
10916
+ className: `${classPrefix2}-weeks ${showMonthNumber ? `${classPrefix2}-weeks-shrink` : ""}`,
10917
+ ref: weeksPanel
10918
+ },
10919
+ weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))
10920
+ ));
10790
10921
  };
10791
10922
  const renderItem = (month, day, index) => {
10792
10923
  const startTip = isStartTip(day, month);
@@ -10795,7 +10926,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10795
10926
  return /* @__PURE__ */ React__default.createElement(
10796
10927
  "div",
10797
10928
  {
10798
- className: [`${classPrefix2}-day`, getClasses(day, month)].join(" "),
10929
+ className: classNames("nut-calendar-day", getClasses(day, month)),
10799
10930
  onClick: () => handleDayClick(day, month, false),
10800
10931
  key: index
10801
10932
  },
@@ -10806,7 +10937,11 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10806
10937
  startTip && /* @__PURE__ */ React__default.createElement(
10807
10938
  "div",
10808
10939
  {
10809
- className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10940
+ className: classNames("nut-calendar-day-info", {
10941
+ "nut-calendar-day-info-top": isStartAndEnd(
10942
+ currentDate
10943
+ )
10944
+ })
10810
10945
  },
10811
10946
  startText || locale.calendaritem.start
10812
10947
  ),
@@ -10814,9 +10949,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10814
10949
  );
10815
10950
  };
10816
10951
  const renderPanel = (month, key) => {
10817
- return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
10952
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${showMonthNumber ? "shrink" : ""}` }, showMonthNumber && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeknumber` }, month.weekNo.map((item, index) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeknumber-index`, key: index }, item))), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
10818
10953
  (day, i2) => renderItem(month, day, i2)
10819
- )));
10954
+ ))));
10820
10955
  };
10821
10956
  const renderContent = () => {
10822
10957
  return /* @__PURE__ */ React__default.createElement(
@@ -10829,7 +10964,6 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10829
10964
  /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement(
10830
10965
  "div",
10831
10966
  {
10832
- className: "viewArea",
10833
10967
  ref: viewAreaRef,
10834
10968
  style: { transform: `translateY(${translateY}px)` }
10835
10969
  },
@@ -10845,13 +10979,295 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10845
10979
  return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
10846
10980
  });
10847
10981
  CalendarItem.displayName = "NutCalendarItem";
10982
+ const YearMonthPanelHeight = 231;
10983
+ const YearQuarterPanelHeight = 103;
10984
+ const defaultProps$12 = {
10985
+ ...ComponentDefaults,
10986
+ type: "single",
10987
+ viewMode: "month",
10988
+ title: "",
10989
+ startDate: getDateString(0),
10990
+ endDate: getDateString(365),
10991
+ showToday: true,
10992
+ showTitle: true,
10993
+ scrollAnimation: true,
10994
+ renderDay: void 0,
10995
+ onItemClick: () => {
10996
+ }
10997
+ };
10998
+ const CalendarViewModeItem = React__default.forwardRef((props) => {
10999
+ const { locale } = useConfig();
11000
+ const {
11001
+ style,
11002
+ className,
11003
+ viewMode,
11004
+ title,
11005
+ value,
11006
+ defaultValue,
11007
+ startDate,
11008
+ endDate,
11009
+ showTitle,
11010
+ renderDay,
11011
+ onItemClick
11012
+ } = { ...defaultProps$12, ...props };
11013
+ const classPrefix2 = "nut-calendar-viewmode";
11014
+ const [panelDate, setPanelDate] = useState({
11015
+ months: [
11016
+ {
11017
+ year: (/* @__PURE__ */ new Date()).getFullYear(),
11018
+ months: [],
11019
+ cssHeight: 0,
11020
+ scrollTop: 0,
11021
+ currYear: false
11022
+ }
11023
+ ],
11024
+ quarters: [
11025
+ {
11026
+ year: (/* @__PURE__ */ new Date()).getFullYear(),
11027
+ quarters: [],
11028
+ cssHeight: 0,
11029
+ scrollTop: 0,
11030
+ currYear: false
11031
+ }
11032
+ ]
11033
+ });
11034
+ const propStartDate = startDate || getDateString(0);
11035
+ const propEndDate = endDate || getDateString(365);
11036
+ const startDates = splitDate(propStartDate);
11037
+ const endDates = splitDate(propEndDate);
11038
+ const [innerValue, setInnerValue] = usePropsValue({
11039
+ value,
11040
+ defaultValue,
11041
+ finalValue: [],
11042
+ onChange: (val) => {
11043
+ }
11044
+ });
11045
+ const monthsRef = useRef(null);
11046
+ const monthsPanel = useRef(null);
11047
+ const viewAreaRef = useRef(null);
11048
+ const getMonthsPanel = () => {
11049
+ return monthsPanel.current;
11050
+ };
11051
+ const getMonthsRef = () => {
11052
+ return monthsRef.current;
11053
+ };
11054
+ const requestAniFrameFunc = (viewMode2) => {
11055
+ switch (viewMode2) {
11056
+ case "month":
11057
+ {
11058
+ const lastItem = panelDate.months[panelDate.months.length - 1];
11059
+ const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
11060
+ const currentIndex = panelDate.months.findIndex(
11061
+ (item) => item.currYear === true
11062
+ );
11063
+ requestAniFrame$1(() => {
11064
+ if (monthsRef && monthsPanel && viewAreaRef) {
11065
+ getMonthsRef().clientHeight;
11066
+ getMonthsPanel().style.height = `${containerHeight}px`;
11067
+ getMonthsRef().scrollTop = panelDate.months[currentIndex].scrollTop;
11068
+ }
11069
+ });
11070
+ }
11071
+ break;
11072
+ case "quarter":
11073
+ {
11074
+ const lastItem = panelDate.quarters[panelDate.quarters.length - 1];
11075
+ const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
11076
+ const currentIndex = panelDate.quarters.findIndex(
11077
+ (item) => item.currYear === true
11078
+ );
11079
+ requestAniFrame$1(() => {
11080
+ if (monthsRef && monthsPanel && viewAreaRef) {
11081
+ getMonthsRef().clientHeight;
11082
+ getMonthsPanel().style.height = `${containerHeight}px`;
11083
+ getMonthsRef().scrollTop = panelDate.quarters[currentIndex].scrollTop;
11084
+ }
11085
+ });
11086
+ }
11087
+ break;
11088
+ }
11089
+ };
11090
+ const isCurrYear = (year) => {
11091
+ return innerValue.split("-")[0] === `${year}`;
11092
+ };
11093
+ const getMonthsData = () => {
11094
+ const startYear = Number(startDates[0]);
11095
+ const startMonth = Number(startDates[1]);
11096
+ const endYear = Number(endDates[0]);
11097
+ const endMonth = Number(endDates[1]);
11098
+ const panelData = [];
11099
+ const addPanelData = (year, months, scrollTop) => {
11100
+ panelData.push({
11101
+ year,
11102
+ months,
11103
+ scrollTop,
11104
+ cssHeight: YearMonthPanelHeight,
11105
+ currYear: isCurrYear(year)
11106
+ });
11107
+ };
11108
+ if (startYear === endYear) {
11109
+ addPanelData(
11110
+ startYear,
11111
+ [
11112
+ ...getPreMonths("prev", startYear, startMonth),
11113
+ ...getMonths("curr", startYear, startMonth, endMonth),
11114
+ ...getMonths("next", endYear, endMonth + 1)
11115
+ ],
11116
+ 0
11117
+ );
11118
+ } else {
11119
+ let scrollTop = panelData.length * YearMonthPanelHeight;
11120
+ const startMonths = [
11121
+ ...getPreMonths("prev", startYear, startMonth),
11122
+ ...getMonths("curr", startYear, startMonth)
11123
+ ];
11124
+ addPanelData(startYear, startMonths, scrollTop);
11125
+ for (let i2 = startYear + 1; i2 < endYear; i2++) {
11126
+ scrollTop = panelData.length * YearMonthPanelHeight;
11127
+ const midMonths = [...getMonths("curr", i2, 1)];
11128
+ addPanelData(i2, midMonths, scrollTop);
11129
+ }
11130
+ const lastMonths = [
11131
+ ...getPreMonths("curr", endYear, endMonth + 1),
11132
+ ...getMonths("next", endYear, endMonth + 1)
11133
+ ];
11134
+ scrollTop = panelData.length * YearMonthPanelHeight;
11135
+ addPanelData(endYear, lastMonths, scrollTop);
11136
+ }
11137
+ return panelData;
11138
+ };
11139
+ const getQuartersData = () => {
11140
+ const startYear = Number(startDates[0]);
11141
+ const startMonth = Number(startDates[1]);
11142
+ const endYear = Number(endDates[0]);
11143
+ const endMonth = Number(endDates[1]);
11144
+ const panelData = [];
11145
+ const addPanelData = (year, quarters, scrollTop) => {
11146
+ panelData.push({
11147
+ year,
11148
+ quarters,
11149
+ scrollTop,
11150
+ cssHeight: YearQuarterPanelHeight,
11151
+ currYear: isCurrYear(year)
11152
+ });
11153
+ };
11154
+ if (startYear === endYear) {
11155
+ const quarters = [
11156
+ ...getPreQuarters("prev", startYear, startMonth),
11157
+ ...getQuarters("curr", startYear, startMonth, endMonth),
11158
+ ...getNextQuarters("next", endYear, endMonth)
11159
+ ];
11160
+ addPanelData(startYear, quarters, 0);
11161
+ } else {
11162
+ let scrollTop = panelData.length * YearQuarterPanelHeight;
11163
+ const startQuarters = [
11164
+ ...getPreQuarters("prev", startYear, startMonth),
11165
+ ...getQuarters("curr", startYear, startMonth)
11166
+ ];
11167
+ addPanelData(startYear, startQuarters, scrollTop);
11168
+ for (let i2 = startYear + 1; i2 < endYear; i2++) {
11169
+ scrollTop = panelData.length * YearQuarterPanelHeight;
11170
+ const midQuarters = [...getQuarters("curr", i2, 1)];
11171
+ addPanelData(i2, midQuarters, scrollTop);
11172
+ }
11173
+ const lastQuarters = [
11174
+ ...getQuarters("curr", endYear, 1, endMonth),
11175
+ ...getNextQuarters("next", endYear, endMonth)
11176
+ ];
11177
+ scrollTop = panelData.length * YearQuarterPanelHeight;
11178
+ addPanelData(endYear, lastQuarters, scrollTop);
11179
+ }
11180
+ return panelData;
11181
+ };
11182
+ const initData = () => {
11183
+ const data = (
11184
+ // eslint-disable-next-line no-nested-ternary
11185
+ viewMode === "month" ? getMonthsData() : viewMode === "quarter" ? getQuartersData() : null
11186
+ );
11187
+ setPanelDate({ ...panelDate, [`${viewMode}s`]: data });
11188
+ };
11189
+ useEffect(() => {
11190
+ requestAniFrameFunc(viewMode);
11191
+ }, [panelDate]);
11192
+ useEffect(() => {
11193
+ initData();
11194
+ }, []);
11195
+ const handleItemClick = (item) => {
11196
+ if (item.type !== "curr") return;
11197
+ const val = viewMode === "month" ? item.yearAndMonth : item.yearAndQuarter;
11198
+ setInnerValue(val);
11199
+ onItemClick == null ? void 0 : onItemClick(val);
11200
+ };
11201
+ const isDisable = (item) => {
11202
+ return item.type === "prev" || item.type === "next";
11203
+ };
11204
+ const isActive = (item) => {
11205
+ const val = viewMode === "month" ? item.yearAndMonth : item.yearAndQuarter;
11206
+ return val === innerValue;
11207
+ };
11208
+ const getClasses = (item) => {
11209
+ if (isDisable(item)) {
11210
+ return ["disabled"];
11211
+ }
11212
+ const res = [];
11213
+ if (item.type === "curr") {
11214
+ if (isActive(item)) {
11215
+ res.push("active");
11216
+ }
11217
+ }
11218
+ return res;
11219
+ };
11220
+ const classes = classNames(classPrefix2, className);
11221
+ const renderHeader = () => {
11222
+ return showTitle && /* @__PURE__ */ React__default.createElement(
11223
+ "div",
11224
+ {
11225
+ className: classNames({
11226
+ [`${classPrefix2}-header`]: true
11227
+ })
11228
+ },
11229
+ /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title)
11230
+ );
11231
+ };
11232
+ const renderItem = (item, index) => {
11233
+ const units = {
11234
+ month: locale.calendaritem.month,
11235
+ quarter: locale.calendaritem.quarter
11236
+ };
11237
+ return /* @__PURE__ */ React__default.createElement(
11238
+ "div",
11239
+ {
11240
+ className: classNames(
11241
+ `${classPrefix2}-item`,
11242
+ item.type,
11243
+ getClasses(item)
11244
+ ),
11245
+ onClick: () => handleItemClick(item),
11246
+ key: index
11247
+ },
11248
+ /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-item-${item.type}` }, renderDay ? renderDay(item) : `${item[viewMode]}${units[viewMode]}`)
11249
+ );
11250
+ };
11251
+ const renderPanel = () => {
11252
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, panelDate[`${viewMode}s`].map((item, key) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-panel`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-panel-title` }, item.year), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-content` }, item[`${viewMode}s`].map(
11253
+ (item2, i2) => renderItem(item2, i2)
11254
+ )))));
11255
+ };
11256
+ const renderContent = () => {
11257
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-content`, ref: monthsRef }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement("div", { ref: viewAreaRef }, renderPanel())));
11258
+ };
11259
+ return /* @__PURE__ */ React__default.createElement("div", { className: classes, style }, renderHeader(), renderContent());
11260
+ });
11261
+ CalendarViewModeItem.displayName = "NutCalendarViewModeItem";
10848
11262
  const defaultProps$11 = {
10849
11263
  ...ComponentDefaults,
10850
11264
  type: "single",
11265
+ viewMode: "day",
10851
11266
  autoBackfill: false,
10852
11267
  popup: true,
10853
11268
  visible: false,
10854
11269
  title: "",
11270
+ value: "",
10855
11271
  defaultValue: "",
10856
11272
  startDate: getDateString(0),
10857
11273
  endDate: getDateString(365),
@@ -10861,6 +11277,7 @@ const defaultProps$11 = {
10861
11277
  confirmText: "",
10862
11278
  showTitle: true,
10863
11279
  showSubTitle: true,
11280
+ showMonthNumber: false,
10864
11281
  scrollAnimation: true,
10865
11282
  firstDayOfWeek: 0,
10866
11283
  disableDate: (date4) => false,
@@ -10874,6 +11291,8 @@ const defaultProps$11 = {
10874
11291
  },
10875
11292
  onDayClick: (data) => {
10876
11293
  },
11294
+ onItemClick: () => {
11295
+ },
10877
11296
  onPageChange: (param) => {
10878
11297
  }
10879
11298
  };
@@ -10886,8 +11305,10 @@ const Calendar = React__default.forwardRef((props, ref) => {
10886
11305
  popup,
10887
11306
  visible,
10888
11307
  type: type4,
11308
+ viewMode,
10889
11309
  autoBackfill,
10890
11310
  title,
11311
+ value,
10891
11312
  defaultValue,
10892
11313
  startDate,
10893
11314
  endDate,
@@ -10897,6 +11318,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
10897
11318
  confirmText,
10898
11319
  showTitle,
10899
11320
  showSubTitle,
11321
+ showMonthNumber,
10900
11322
  scrollAnimation,
10901
11323
  firstDayOfWeek,
10902
11324
  closeIcon,
@@ -10909,6 +11331,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
10909
11331
  onClose,
10910
11332
  onConfirm,
10911
11333
  onDayClick,
11334
+ onItemClick,
10912
11335
  onPageChange
10913
11336
  } = { ...defaultProps$11, ...props };
10914
11337
  const calendarRef = useRef(null);
@@ -10922,9 +11345,6 @@ const Calendar = React__default.forwardRef((props, ref) => {
10922
11345
  const closePopup = () => {
10923
11346
  close();
10924
11347
  };
10925
- const select = (param) => {
10926
- onDayClick && onDayClick(param);
10927
- };
10928
11348
  const scrollToDate = (date4) => {
10929
11349
  var _a;
10930
11350
  (_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date4);
@@ -10936,7 +11356,25 @@ const Calendar = React__default.forwardRef((props, ref) => {
10936
11356
  scrollToDate
10937
11357
  }));
10938
11358
  const renderItem = () => {
10939
- return /* @__PURE__ */ React__default.createElement(
11359
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, viewMode !== "day" ? /* @__PURE__ */ React__default.createElement(
11360
+ CalendarViewModeItem,
11361
+ {
11362
+ ref: calendarRef,
11363
+ style,
11364
+ className,
11365
+ type: type4,
11366
+ viewMode,
11367
+ title: title || locale.calendaritem.title,
11368
+ value,
11369
+ defaultValue,
11370
+ startDate,
11371
+ endDate,
11372
+ showTitle,
11373
+ scrollAnimation,
11374
+ renderDay,
11375
+ onItemClick
11376
+ }
11377
+ ) : /* @__PURE__ */ React__default.createElement(
10940
11378
  CalendarItem,
10941
11379
  {
10942
11380
  ref: calendarRef,
@@ -10957,6 +11395,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
10957
11395
  confirmText: confirmText || locale.calendaritem.confirm,
10958
11396
  showTitle,
10959
11397
  showSubTitle,
11398
+ showMonthNumber,
10960
11399
  scrollAnimation,
10961
11400
  firstDayOfWeek,
10962
11401
  disableDate,
@@ -10965,12 +11404,12 @@ const Calendar = React__default.forwardRef((props, ref) => {
10965
11404
  renderDayTop,
10966
11405
  renderDayBottom,
10967
11406
  onConfirm: choose,
10968
- onDayClick: select,
11407
+ onDayClick: (param) => onDayClick && onDayClick(param),
10969
11408
  onPageChange: yearMonthChange
10970
11409
  }
10971
- );
11410
+ ));
10972
11411
  };
10973
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, popup ? /* @__PURE__ */ React__default.createElement(
11412
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, popup && viewMode === "day" ? /* @__PURE__ */ React__default.createElement(
10974
11413
  Popup,
10975
11414
  {
10976
11415
  className: "nut-calendar-popup",
@@ -20997,18 +21436,17 @@ const Swiper = React__default.forwardRef(
20997
21436
  const y = springs.y.get() / 100 * slideSize;
20998
21437
  return [-x, -y];
20999
21438
  },
21000
- triggerAllEvents: true,
21001
21439
  bounds: () => {
21002
21440
  if (loop2) return {};
21003
21441
  const slideSize = getSlideSize();
21004
- getSwiperSize();
21005
21442
  if (isVertical) {
21006
21443
  return { top: 0, bottom: (count - 1) * slideSize };
21007
21444
  }
21008
21445
  return { left: 0, right: (count - 1) * slideSize };
21009
21446
  },
21010
- preventDefault: true,
21011
21447
  rubberband: true,
21448
+ triggerAllEvents: true,
21449
+ preventScroll: isVertical,
21012
21450
  axis: isVertical ? "y" : "x",
21013
21451
  pointer: {
21014
21452
  touch: true
@@ -21067,8 +21505,8 @@ const Swiper = React__default.forwardRef(
21067
21505
  {
21068
21506
  ref: stageRef,
21069
21507
  className: classNames("nut-swiper-inner", {
21070
- "nut-swiper-inner-vertical": isVertical,
21071
- "nut-swiper-inner-horizontal": !isVertical
21508
+ [`${classPrefix2}-inner-vertical`]: isVertical,
21509
+ [`${classPrefix2}-inner-horizontal`]: !isVertical
21072
21510
  }),
21073
21511
  style: {
21074
21512
  ...props.slideSize ? { [isVertical ? "height" : "width"]: `${props.slideSize}px` } : {}
@@ -21080,7 +21518,11 @@ const Swiper = React__default.forwardRef(
21080
21518
  return /* @__PURE__ */ React__default.createElement(
21081
21519
  "div",
21082
21520
  {
21083
- className: classNames("nut-swiper", className),
21521
+ className: classNames(
21522
+ classPrefix2,
21523
+ `${classPrefix2}-canmove-${direction}`,
21524
+ className
21525
+ ),
21084
21526
  style,
21085
21527
  ref: swiperRef,
21086
21528
  ...bind()