@nutui/nutui-react-taro 1.3.5-beta.1 → 1.3.6

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 (125) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/esm/Audio.js +4 -4
  3. package/dist/esm/Calendar.js +4 -4
  4. package/dist/esm/CalendarItem.js +3 -3
  5. package/dist/esm/DatePicker.js +4 -4
  6. package/dist/esm/Drag.js +3 -4
  7. package/dist/esm/Elevator.js +2 -4
  8. package/dist/esm/NoticeBar.js +3 -3
  9. package/dist/esm/Picker.js +3 -3
  10. package/dist/esm/Popover.js +3 -3
  11. package/dist/esm/Range.js +3 -3
  12. package/dist/esm/SearchBar.js +3 -2
  13. package/dist/esm/Signature.js +3 -2
  14. package/dist/esm/Swipe.js +3 -3
  15. package/dist/esm/actionsheet.taro-360d8d34.js +15 -25
  16. package/dist/esm/address.taro-f16cef31.js +151 -219
  17. package/dist/esm/animatingnumbers.taro-6f40a2e9.js +13 -41
  18. package/dist/esm/{audio.taro-29f5568f.js → audio.taro-57d4f0da.js} +33 -60
  19. package/dist/esm/avatar.taro-ec620cdd.js +25 -50
  20. package/dist/esm/avatargroup-5b2584d9.js +2 -9
  21. package/dist/esm/backtop.taro-aa8b2bc5.js +29 -55
  22. package/dist/esm/badge.taro-38684262.js +9 -20
  23. package/dist/esm/barrage.taro-d86c367a.js +8 -21
  24. package/dist/esm/button.taro-a9ebb937.js +22 -37
  25. package/dist/esm/{calendar.taro-438940bd.js → calendar.taro-533b3219.js} +13 -24
  26. package/dist/esm/{calendaritem.taro-11333579.js → calendaritem.taro-fe5dd4bd.js} +71 -183
  27. package/dist/esm/card.taro-1bc35ebe.js +14 -20
  28. package/dist/esm/cascader.taro-77100fb4.js +77 -197
  29. package/dist/esm/cell.taro-a4c3bb7b.js +20 -30
  30. package/dist/esm/cellgroup.taro-8c87bf08.js +6 -12
  31. package/dist/esm/checkbox.taro-104557c1.js +27 -48
  32. package/dist/esm/checkboxgroup.taro-3d380042.js +12 -30
  33. package/dist/esm/circleprogress.taro-3c89a157.js +14 -41
  34. package/dist/esm/col.taro-2a437387.js +11 -22
  35. package/dist/esm/collapse.taro-72e58ba2.js +11 -27
  36. package/dist/esm/collapseitem-75843a5e.js +33 -47
  37. package/dist/esm/configprovider-3e87d67a.js +2 -6
  38. package/dist/esm/configprovider.taro-6c7b3056.js +4 -14
  39. package/dist/esm/countdown.taro-f2d9ffed.js +37 -74
  40. package/dist/esm/{datepicker.taro-1acec61f.js → datepicker.taro-49a4cf0c.js} +43 -104
  41. package/dist/esm/dialog.taro-492e2b9a.js +27 -58
  42. package/dist/esm/divider.taro-5236fe6a.js +8 -15
  43. package/dist/esm/drag.taro-0717c783.js +153 -0
  44. package/dist/esm/{elevator.taro-8e385785.js → elevator.taro-443253ec.js} +99 -124
  45. package/dist/esm/empty.taro-ab9c4f03.js +11 -24
  46. package/dist/esm/fixednav.taro-582322a1.js +16 -27
  47. package/dist/esm/grid.taro-5d75c0ad.js +13 -28
  48. package/dist/esm/griditem.taro-866cd288.js +18 -34
  49. package/dist/esm/icon-8dc4de10.js +11 -21
  50. package/dist/esm/icon.taro-1d0d4fb7.js +11 -21
  51. package/dist/esm/imagepreview.taro-1199e977.js +36 -71
  52. package/dist/esm/indicator.taro-183ea169.js +9 -20
  53. package/dist/esm/infiniteloading.taro-b95e62bf.js +23 -49
  54. package/dist/esm/input.taro-2453d7c4.js +62 -106
  55. package/dist/esm/inputnumber.taro-0cf7c1b7.js +25 -52
  56. package/dist/esm/layout.taro-358f014f.js +0 -6
  57. package/dist/esm/menu.taro-9345dcfd.js +21 -41
  58. package/dist/esm/menuitem.taro-fc0961b7.js +29 -54
  59. package/dist/esm/navbar.taro-c931c078.js +18 -34
  60. package/dist/esm/{noticebar.taro-1fa04a96.js → noticebar.taro-332691f9.js} +55 -107
  61. package/dist/esm/notify.taro-d9c48fae.js +18 -34
  62. package/dist/esm/numberkeyboard.taro-53c350b8.js +21 -52
  63. package/dist/esm/nutui-react.es.js +16 -16
  64. package/dist/esm/offsetContext-0e3d04b3.js +0 -3
  65. package/dist/esm/overlay.taro-be45fed5.js +12 -23
  66. package/dist/esm/pagination.taro-62bbd23f.js +38 -71
  67. package/dist/esm/{picker.taro-6a4dad23.js → picker.taro-f003b725.js} +95 -186
  68. package/dist/esm/{popover.taro-eddd0bd2.js → popover.taro-7e5dff8c.js} +33 -76
  69. package/dist/esm/popup.taro-33d0bbc8.js +40 -72
  70. package/dist/esm/price.taro-97393d8f.js +7 -24
  71. package/dist/esm/progress.taro-623bc807.js +23 -31
  72. package/dist/esm/pulltorefresh.taro-e66c78ad.js +29 -92
  73. package/dist/esm/radio.taro-95d43860.js +24 -47
  74. package/dist/esm/radiogroup.taro-b5dad516.js +14 -24
  75. package/dist/esm/{range.taro-515d37a4.js → range.taro-fc7c0b6a.js} +50 -133
  76. package/dist/esm/rate.taro-69c85081.js +21 -39
  77. package/dist/esm/row.taro-cec13a7e.js +7 -16
  78. package/dist/esm/{searchbar.taro-f134fb96.js → searchbar.taro-0d3c0081.js} +55 -70
  79. package/dist/esm/shortpassword.taro-2e96ca22.js +29 -56
  80. package/dist/esm/sidenavbar.taro-87f056cd.js +9 -16
  81. package/dist/esm/sidenavbaritem.taro-77e077f4.js +4 -11
  82. package/dist/esm/signature.taro-59b3b3ab.js +146 -0
  83. package/dist/esm/skeleton.taro-b9ff84b9.js +13 -23
  84. package/dist/esm/step.taro-f1057500.js +12 -28
  85. package/dist/esm/steps.taro-943f4fbb.js +6 -14
  86. package/dist/esm/sticky.taro-30d4e453.js +0 -7
  87. package/dist/esm/subsidenavbar.taro-2c1fcf16.js +7 -22
  88. package/dist/esm/{swipe.taro-dfb9a049.js → swipe.taro-83bc248f.js} +98 -91
  89. package/dist/esm/swiper.taro-f314d67a.js +110 -196
  90. package/dist/esm/swiperitem-d00e7513.js +2 -12
  91. package/dist/esm/switch.taro-be5eb823.js +13 -27
  92. package/dist/esm/tabbar.taro-da72fa2c.js +13 -25
  93. package/dist/esm/tabbaritem.taro-94cd62c2.js +15 -23
  94. package/dist/esm/table.taro-7ac89a6c.js +19 -39
  95. package/dist/esm/tabpane.taro-95aa185b.js +4 -10
  96. package/dist/esm/tabs.taro-86186dff.js +28 -54
  97. package/dist/esm/tag.taro-95d7f5c2.js +19 -36
  98. package/dist/esm/textarea.taro-388d1f90.js +18 -35
  99. package/dist/esm/timedetail.taro-519808cf.js +15 -28
  100. package/dist/esm/timepannel.taro-9904f6e6.js +5 -12
  101. package/dist/esm/timeselect.taro-73796bfc.js +35 -59
  102. package/dist/esm/toast.taro-86862dff.js +26 -46
  103. package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
  104. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
  105. package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +2 -0
  106. package/dist/esm/types/src/packages/signature/signature.taro.d.ts +10 -2
  107. package/dist/esm/uploader.taro-6184abe7.js +52 -144
  108. package/dist/esm/{useClientRect-8b7cc406.js → useClientRect-bf69d7b3.js} +1 -40
  109. package/dist/esm/useTouch-a2ea68c6.js +27 -47
  110. package/dist/esm/video-c1090c92.js +8 -19
  111. package/dist/esm/virtuallist.taro-6858f690.js +84 -118
  112. package/dist/locales/base.js +1 -1
  113. package/dist/locales/en-US.js +1 -1
  114. package/dist/locales/id-ID.js +1 -1
  115. package/dist/locales/zh-CN.js +1 -1
  116. package/dist/locales/zh-TW.js +1 -1
  117. package/dist/nutui.react.es.js +10844 -11362
  118. package/dist/nutui.react.umd.js +10844 -11362
  119. package/dist/packages/searchbar/searchbar.scss +20 -3
  120. package/dist/style.css +1 -1
  121. package/dist/style.es.js +1 -1
  122. package/dist/types/index.d.ts +17 -8
  123. package/package.json +1 -1
  124. package/dist/esm/drag.taro-56e8c87a.js +0 -134
  125. package/dist/esm/signature.taro-a9286cd1.js +0 -178
@@ -3,140 +3,110 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
-
7
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
-
9
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
-
11
8
  import React__default, { useState, useRef, useEffect } from 'react';
12
9
  import classNames from 'classnames';
13
10
  import { c as cn } from './bem-893ad28d.js';
14
11
  import { u as useConfig } from './configprovider.taro-6c7b3056.js';
15
- import { g as getRectByTaro } from './useClientRect-8b7cc406.js';
12
+ import { g as getRectByTaro } from './useClientRect-bf69d7b3.js';
16
13
  var Utils = {
17
14
  /**
18
15
  * 是否为闫年
19
16
  * @return {Boolse} true|false
20
- */
21
- isLeapYear: function isLeapYear(y) {
17
+ */isLeapYear: function isLeapYear(y) {
22
18
  return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
23
19
  },
24
-
25
20
  /**
26
21
  * 返回星期数
27
22
  * @return {String}
28
- */
29
- getWhatDay: function getWhatDay(year, month, day) {
23
+ */getWhatDay: function getWhatDay(year, month, day) {
30
24
  var date = new Date("".concat(year, "/").concat(month, "/").concat(day));
31
25
  var index = date.getDay();
32
26
  var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
33
27
  return dayNames[index];
34
28
  },
35
-
36
29
  /**
37
30
  * 返回星期数
38
31
  * @return {Number}
39
- */
40
- getMonthPreDay: function getMonthPreDay(year, month) {
32
+ */getMonthPreDay: function getMonthPreDay(year, month) {
41
33
  var date = new Date("".concat(year, "/").concat(month, "/01"));
42
34
  var day = date.getDay();
43
-
44
35
  if (day == 0) {
45
36
  day = 7;
46
37
  }
47
-
48
38
  return day;
49
39
  },
50
-
51
40
  /**
52
41
  * 返回月份天数
53
42
  * @return {Number}
54
- */
55
- getMonthDays: function getMonthDays(year, month) {
43
+ */getMonthDays: function getMonthDays(year, month) {
56
44
  if (/^0/.test(month)) {
57
45
  month = month.split('')[1];
58
46
  }
59
-
60
47
  return [0, 31, this.isLeapYear(Number(year)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
61
48
  },
62
-
63
49
  /**
64
50
  * 补齐数字位数
65
51
  * @return {string}
66
- */
67
- getNumTwoBit: function getNumTwoBit(n) {
52
+ */getNumTwoBit: function getNumTwoBit(n) {
68
53
  n = Number(n);
69
54
  return (n > 9 ? '' : '0') + n;
70
55
  },
71
-
72
56
  /**
73
57
  * 日期对象转成字符串
74
58
  * @return {string}
75
- */
76
- date2Str: function date2Str(date, split) {
59
+ */date2Str: function date2Str(date, split) {
77
60
  split = split || '-';
78
61
  var y = date.getFullYear();
79
62
  var m = this.getNumTwoBit(date.getMonth() + 1);
80
63
  var d = this.getNumTwoBit(date.getDate());
81
64
  return [y, m, d].join(split);
82
65
  },
83
-
84
66
  /**
85
67
  * 返回日期格式字符串
86
68
  * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
87
69
  * @return {string} '2014-12-31'
88
- */
89
- getDay: function getDay(i) {
70
+ */getDay: function getDay(i) {
90
71
  i = i || 0;
91
72
  var date = new Date();
92
73
  var diff = i * (1000 * 60 * 60 * 24);
93
74
  date = new Date(date.getTime() + diff);
94
75
  return this.date2Str(date);
95
76
  },
96
-
97
77
  /**
98
78
  * 时间比较
99
79
  * @return {Boolean}
100
- */
101
- compareDate: function compareDate(date1, date2) {
80
+ */compareDate: function compareDate(date1, date2) {
102
81
  var startTime = new Date(date1.replace('-', '/').replace('-', '/'));
103
82
  var endTime = new Date(date2.replace('-', '/').replace('-', '/'));
104
-
105
83
  if (startTime >= endTime) {
106
84
  return false;
107
85
  }
108
-
109
86
  return true;
110
87
  },
111
-
112
88
  /**
113
89
  * 时间是否相等
114
90
  * @return {Boolean}
115
- */
116
- isEqual: function isEqual(date1, date2) {
91
+ */isEqual: function isEqual(date1, date2) {
117
92
  var startTime = new Date(date1).getTime();
118
93
  var endTime = new Date(date2).getTime();
119
-
120
94
  if (startTime == endTime) {
121
95
  return true;
122
96
  }
123
-
124
97
  return false;
125
98
  }
126
99
  };
127
-
128
100
  function requestAniFrame() {
129
101
  if (typeof window !== 'undefined') {
130
102
  return window.requestAnimationFrame || function (callback) {
131
103
  window.setTimeout(callback, 1000 / 60);
132
104
  };
133
105
  }
134
-
135
106
  return function (callback) {
136
107
  setTimeout(callback, 1000 / 60);
137
108
  };
138
109
  }
139
-
140
110
  var requestAniFrame$1 = requestAniFrame();
141
111
  var defaultProps = {
142
112
  type: 'one',
@@ -151,67 +121,58 @@ var defaultProps = {
151
121
  onUpdate: function onUpdate() {},
152
122
  onClose: function onClose() {}
153
123
  };
154
-
155
124
  var CalendarItem = function CalendarItem(props) {
156
125
  var _classNames, _classNames2;
157
-
158
126
  var _useConfig = useConfig(),
159
- locale = _useConfig.locale;
160
-
127
+ locale = _useConfig.locale;
161
128
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
162
- type = _defaultProps$props.type,
163
- isAutoBackFill = _defaultProps$props.isAutoBackFill,
164
- poppable = _defaultProps$props.poppable,
165
- title = _defaultProps$props.title,
166
- defaultValue = _defaultProps$props.defaultValue,
167
- startDate = _defaultProps$props.startDate,
168
- endDate = _defaultProps$props.endDate,
169
- onChoose = _defaultProps$props.onChoose,
170
- onUpdate = _defaultProps$props.onUpdate,
171
- onClose = _defaultProps$props.onClose;
172
-
129
+ type = _defaultProps$props.type,
130
+ isAutoBackFill = _defaultProps$props.isAutoBackFill,
131
+ poppable = _defaultProps$props.poppable,
132
+ title = _defaultProps$props.title,
133
+ defaultValue = _defaultProps$props.defaultValue,
134
+ startDate = _defaultProps$props.startDate,
135
+ endDate = _defaultProps$props.endDate,
136
+ onChoose = _defaultProps$props.onChoose,
137
+ onUpdate = _defaultProps$props.onUpdate,
138
+ onClose = _defaultProps$props.onClose;
173
139
  var weeks = locale.calendaritem.weekdays;
174
-
175
140
  var _useState = useState(''),
176
- _useState2 = _slicedToArray(_useState, 2),
177
- yearMonthTitle = _useState2[0],
178
- setYearMonthTitle = _useState2[1];
179
-
141
+ _useState2 = _slicedToArray(_useState, 2),
142
+ yearMonthTitle = _useState2[0],
143
+ setYearMonthTitle = _useState2[1];
180
144
  var _useState3 = useState(false),
181
- _useState4 = _slicedToArray(_useState3, 2),
182
- unLoadPrev = _useState4[0],
183
- setUnLoadPrev = _useState4[1];
184
-
145
+ _useState4 = _slicedToArray(_useState3, 2),
146
+ unLoadPrev = _useState4[0],
147
+ setUnLoadPrev = _useState4[1];
185
148
  var _useState5 = useState([]),
186
- _useState6 = _slicedToArray(_useState5, 2),
187
- monthsData = _useState6[0],
188
- setMonthsData = _useState6[1];
189
-
149
+ _useState6 = _slicedToArray(_useState5, 2),
150
+ monthsData = _useState6[0],
151
+ setMonthsData = _useState6[1];
190
152
  var _useState7 = useState({
191
- currDate: '',
192
- touchParams: {
193
- startY: 0,
194
- endY: 0,
195
- startTime: 0,
196
- endTime: 0,
197
- lastY: 0,
198
- lastTime: 0
199
- },
200
- transformY: 0,
201
- translateY: 0,
202
- scrollDistance: 0,
203
- defaultData: [],
204
- chooseData: [],
205
- monthsData: [],
206
- dayPrefix: 'calendar-month-day',
207
- startData: '',
208
- endData: '',
209
- isRange: type === 'range',
210
- timer: 0
211
- }),
212
- _useState8 = _slicedToArray(_useState7, 1),
213
- state = _useState8[0];
214
-
153
+ currDate: '',
154
+ touchParams: {
155
+ startY: 0,
156
+ endY: 0,
157
+ startTime: 0,
158
+ endTime: 0,
159
+ lastY: 0,
160
+ lastTime: 0
161
+ },
162
+ transformY: 0,
163
+ translateY: 0,
164
+ scrollDistance: 0,
165
+ defaultData: [],
166
+ chooseData: [],
167
+ monthsData: [],
168
+ dayPrefix: 'calendar-month-day',
169
+ startData: '',
170
+ endData: '',
171
+ isRange: type === 'range',
172
+ timer: 0
173
+ }),
174
+ _useState8 = _slicedToArray(_useState7, 1),
175
+ state = _useState8[0];
215
176
  var weeksPanel = useRef(null);
216
177
  var months = useRef(null);
217
178
  var monthsPanel = useRef(null);
@@ -221,73 +182,56 @@ var CalendarItem = function CalendarItem(props) {
221
182
  var monthitemclasses = classNames(_defineProperty({
222
183
  'calendar-month-item': true
223
184
  }, "".concat(type === 'range' ? 'month-item-range' : ''), true));
224
-
225
185
  var splitDate = function splitDate(date) {
226
186
  return date.split('-');
227
187
  };
228
-
229
188
  var isStart = function isStart(currDate) {
230
189
  return Utils.isEqual(state.currDate[0], currDate);
231
190
  };
232
-
233
191
  var isEnd = function isEnd(currDate) {
234
192
  return Utils.isEqual(state.currDate[1], currDate);
235
193
  };
236
-
237
194
  var getCurrDate = function getCurrDate(day, month, isRange) {
238
195
  return isRange ? "".concat(month.curData[3], "-").concat(month.curData[4], "-").concat(Utils.getNumTwoBit(+day.day)) : "".concat(month.curData[0], "-").concat(month.curData[1], "-").concat(Utils.getNumTwoBit(+day.day));
239
196
  };
240
-
241
197
  var getClass = function getClass(day, month, isRange) {
242
198
  var currDate = getCurrDate(day, month, isRange);
243
-
244
199
  if (day.type === 'curr') {
245
200
  if (!state.isRange && Utils.isEqual(state.currDate, currDate) || state.isRange && (isStart(currDate) || isEnd(currDate))) {
246
201
  return "".concat(state.dayPrefix, "-active");
247
202
  }
248
-
249
203
  if (startDate && Utils.compareDate(currDate, startDate) || endDate && Utils.compareDate(endDate, currDate)) {
250
204
  return "".concat(state.dayPrefix, "-disabled");
251
205
  }
252
-
253
206
  if (state.isRange && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
254
207
  return "".concat(state.dayPrefix, "-choose");
255
208
  }
256
-
257
209
  return null;
258
210
  }
259
-
260
211
  return "".concat(state.dayPrefix, "-disabled");
261
212
  };
262
-
263
213
  var isActive = function isActive(day, month) {
264
214
  return state.isRange && day.type === 'curr' && getClass(day, month) === 'calendar-month-day-active';
265
215
  };
266
-
267
216
  var isCurrDay = function isCurrDay(month, day) {
268
217
  var date = "".concat(month.curData[0], "-").concat(month.curData[1], "-").concat(day);
269
218
  return Utils.isEqual(date, Utils.date2Str(new Date()));
270
219
  };
271
-
272
220
  var confirm = function confirm() {
273
221
  if (state.isRange && state.chooseData.length === 2 || !state.isRange) {
274
222
  onChoose && onChoose(state.chooseData);
275
-
276
223
  if (poppable) {
277
224
  onUpdate && onUpdate();
278
225
  }
279
226
  }
280
227
  };
281
-
282
228
  var chooseDay = function chooseDay(day, month, isFirst, isRange) {
283
229
  if (getClass(day, month, isRange) !== "".concat(state.dayPrefix, "-disabled")) {
284
230
  var days = _toConsumableArray(month.curData);
285
-
286
231
  days = isRange ? days.splice(3) : days.splice(0, 3);
287
232
  days[2] = typeof day.day === 'number' ? Utils.getNumTwoBit(day.day) : day.day;
288
233
  days[3] = "".concat(days[0], "-").concat(days[1], "-").concat(days[2]);
289
234
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
290
-
291
235
  if (!state.isRange) {
292
236
  state.currDate = days[3];
293
237
  state.chooseData = _toConsumableArray(days);
@@ -299,7 +243,6 @@ var CalendarItem = function CalendarItem(props) {
299
243
  } else {
300
244
  Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
301
245
  }
302
-
303
246
  if (state.chooseData.length === 2 || !state.chooseData.length) {
304
247
  state.chooseData = _toConsumableArray(days);
305
248
  } else if (Utils.compareDate(state.chooseData[3], days[3])) {
@@ -308,69 +251,56 @@ var CalendarItem = function CalendarItem(props) {
308
251
  state.chooseData = [_toConsumableArray(days), _toConsumableArray(state.chooseData)];
309
252
  }
310
253
  }
311
-
312
254
  if (isAutoBackFill && !isFirst) {
313
255
  confirm();
314
256
  }
315
-
316
257
  setMonthsData(state.monthsData.slice());
317
258
  }
318
259
  };
319
-
320
260
  var isStartTip = function isStartTip(day, month) {
321
261
  if (isActive(day, month)) {
322
262
  return isStart(getCurrDate(day, month));
323
263
  }
324
-
325
264
  return false;
326
- }; // 是否有结束提示
327
-
328
-
265
+ };
266
+ // 是否有结束提示
329
267
  var isEndTip = function isEndTip(day, month) {
330
268
  if (isStartTip(day, month)) {
331
269
  return false;
332
270
  }
333
-
334
271
  return isActive(day, month);
335
- }; // 获取当前月数据
336
-
337
-
272
+ };
273
+ // 获取当前月数据
338
274
  var getCurrData = function getCurrData(type) {
339
275
  var monthData = type === 'prev' ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
340
276
  var year = parseInt(monthData.curData[0]);
341
277
  var month = parseInt(monthData.curData[1].toString().replace(/^0/, ''));
342
-
343
278
  switch (type) {
344
279
  case 'prev':
345
280
  month === 1 && (year -= 1);
346
281
  month = month === 1 ? 12 : --month;
347
282
  break;
348
-
349
283
  case 'next':
350
284
  month === 12 && (year += 1);
351
285
  month = month === 12 ? 1 : ++month;
352
286
  break;
353
287
  }
354
-
355
288
  return [year, Utils.getNumTwoBit(month), Utils.getMonthDays(String(year), String(month))];
356
- }; // 获取日期状态
357
-
358
-
289
+ };
290
+ // 获取日期状态
359
291
  var getDaysStatus = function getDaysStatus(days, type) {
360
292
  // 修复:当某个月的1号是周日时,月份下方会空出来一行
361
293
  if (type === 'prev' && days >= 7) {
362
294
  days -= 7;
363
295
  }
364
-
365
296
  return Array.from(Array(days), function (v, k) {
366
297
  return {
367
298
  day: k + 1,
368
299
  type: type
369
300
  };
370
301
  });
371
- }; // 获取月数据
372
-
373
-
302
+ };
303
+ // 获取月数据
374
304
  var getMonth = function getMonth(curData, type) {
375
305
  var preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
376
306
  var currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
@@ -383,7 +313,6 @@ var CalendarItem = function CalendarItem(props) {
383
313
  title: locale.calendaritem.monthTitle(title.year, title.month),
384
314
  monthData: [].concat(_toConsumableArray(getDaysStatus(preMonthDays, 'prev')), _toConsumableArray(getDaysStatus(currMonthDays, 'curr')))
385
315
  };
386
-
387
316
  if (type === 'next') {
388
317
  if (!state.endData || !Utils.compareDate("".concat(state.endData[0], "-").concat(state.endData[1], "-").concat(Utils.getMonthDays(state.endData[0], state.endData[1])), "".concat(curData[0], "-").concat(curData[1], "-").concat(curData[2]))) {
389
318
  state.monthsData.push(monthInfo);
@@ -393,16 +322,13 @@ var CalendarItem = function CalendarItem(props) {
393
322
  } else {
394
323
  setUnLoadPrev(true);
395
324
  }
396
-
397
325
  setMonthsData(state.monthsData);
398
- }; // 监听月份滚动,改变月份标题
399
-
400
-
326
+ };
327
+ // 监听月份滚动,改变月份标题
401
328
  var loadScroll = function loadScroll() {
402
329
  if (!props.poppable) {
403
330
  return false;
404
331
  }
405
-
406
332
  requestAniFrame$1( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
407
333
  var weeksPanelRes, monthsDoms, i;
408
334
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -413,17 +339,13 @@ var CalendarItem = function CalendarItem(props) {
413
339
  _context.next = 7;
414
340
  break;
415
341
  }
416
-
417
342
  _context.next = 3;
418
343
  return getRectByTaro(weeksPanel === null || weeksPanel === void 0 ? void 0 : weeksPanel.current);
419
-
420
344
  case 3:
421
345
  weeksPanelRes = _context.sent;
422
346
  weeksPanelRes === null || weeksPanelRes === void 0 ? void 0 : weeksPanelRes.bottom;
423
347
  monthsDoms = monthsPanel.current.getElementsByClassName('calendar-month');
424
-
425
348
  for (i = 0; i < monthsDoms.length; i++) {}
426
-
427
349
  case 7:
428
350
  case "end":
429
351
  return _context.stop();
@@ -431,14 +353,12 @@ var CalendarItem = function CalendarItem(props) {
431
353
  }
432
354
  }, _callee);
433
355
  })));
434
- }; // 设置月份滚动距离和速度
435
-
436
-
356
+ };
357
+ // 设置月份滚动距离和速度
437
358
  var setTransform = function setTransform() {
438
359
  var translateY = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
439
360
  var type = arguments.length > 1 ? arguments[1] : undefined;
440
361
  var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
441
-
442
362
  if (monthsPanel !== null && monthsPanel !== void 0 && monthsPanel.current) {
443
363
  if (type === 'end') {
444
364
  monthsPanel.current.style.webkitTransition = "transform ".concat(time, "ms cubic-bezier(0.19, 1, 0.22, 1)");
@@ -450,52 +370,41 @@ var CalendarItem = function CalendarItem(props) {
450
370
  monthsPanel.current.style.webkitTransition = '';
451
371
  loadScroll();
452
372
  }
453
-
454
373
  monthsPanel.current.style.webkitTransform = "translateY(".concat(translateY, "px)");
455
374
  state.scrollDistance = translateY;
456
375
  }
457
- }; // 计算滚动方向和距离
458
-
459
-
376
+ };
377
+ // 计算滚动方向和距离
460
378
  var setMove = function setMove(move, type, time) {
461
379
  var _months$current, _monthsPanel$current;
462
-
463
380
  var updateMove = move + state.transformY;
464
381
  var h = ((_months$current = months.current) === null || _months$current === void 0 ? void 0 : _months$current.offsetHeight) || 0;
465
382
  var offsetHeight = ((_monthsPanel$current = monthsPanel.current) === null || _monthsPanel$current === void 0 ? void 0 : _monthsPanel$current.offsetHeight) || 0;
466
-
467
383
  if (type === 'end') {
468
384
  // 限定滚动距离
469
385
  if (updateMove > 0) {
470
386
  updateMove = 0;
471
387
  }
472
-
473
388
  if (updateMove < 0 && updateMove < -offsetHeight + h) {
474
389
  updateMove = -offsetHeight + h;
475
390
  }
476
-
477
391
  if (offsetHeight <= h && state.monthsData.length === 1) {
478
392
  updateMove = 0;
479
393
  }
480
-
481
394
  setTransform(updateMove, type, time);
482
395
  } else {
483
396
  if (updateMove > 0 && updateMove > 100) {
484
397
  updateMove = 100;
485
398
  }
486
-
487
399
  if (updateMove < -offsetHeight + h - 100 && state.monthsData.length > 1) {
488
400
  updateMove = -offsetHeight + h - 100;
489
401
  }
490
-
491
402
  if (updateMove < 0 && updateMove < -100 && state.monthsData.length === 1) {
492
403
  updateMove = -100;
493
404
  }
494
-
495
405
  setTransform(updateMove);
496
406
  }
497
407
  };
498
-
499
408
  var onTouchStart = function onTouchStart(event) {
500
409
  event.stopPropagation();
501
410
  var changedTouches = event.changedTouches[0];
@@ -503,50 +412,39 @@ var CalendarItem = function CalendarItem(props) {
503
412
  state.touchParams.startTime = event.timeStamp || Date.now();
504
413
  state.transformY = state.scrollDistance;
505
414
  };
506
-
507
415
  var onTouchMove = function onTouchMove(event) {
508
416
  event.stopPropagation();
509
417
  var changedTouches = event.changedTouches[0];
510
418
  state.touchParams.lastY = changedTouches.pageY;
511
419
  state.touchParams.lastTime = event.timeStamp || Date.now();
512
420
  var move = state.touchParams.lastY - state.touchParams.startY;
513
-
514
421
  if (Math.abs(move) < 5) {
515
422
  return false;
516
423
  }
517
-
518
424
  setMove(move);
519
425
  };
520
-
521
426
  var onTouchEnd = function onTouchEnd(event) {
522
427
  var _months$current2, _monthsPanel$current2;
523
-
524
428
  event.stopPropagation();
525
429
  var changedTouches = event.changedTouches[0];
526
430
  state.touchParams.lastY = changedTouches.pageY;
527
431
  state.touchParams.lastTime = event.timeStamp || Date.now();
528
432
  var move = state.touchParams.lastY - state.touchParams.startY;
529
-
530
433
  if (Math.abs(move) < 5) {
531
434
  return false;
532
435
  }
533
-
534
436
  var updateMove = move + state.transformY;
535
437
  var h = ((_months$current2 = months.current) === null || _months$current2 === void 0 ? void 0 : _months$current2.offsetHeight) || 0;
536
438
  var offsetHeight = ((_monthsPanel$current2 = monthsPanel.current) === null || _monthsPanel$current2 === void 0 ? void 0 : _monthsPanel$current2.offsetHeight) || 0;
537
-
538
439
  if (updateMove > 0) {
539
440
  getMonth(getCurrData('prev'), 'prev');
540
441
  } else if (updateMove < 0 && updateMove < -offsetHeight + (Math.abs(move) > h ? Math.abs(move) : h) * 5) {
541
442
  getMonth(getCurrData('next'), 'next');
542
-
543
443
  if (Math.abs(move) >= 300) {
544
444
  getMonth(getCurrData('next'), 'next');
545
445
  }
546
446
  }
547
-
548
447
  var moveTime = state.touchParams.lastTime - state.touchParams.startTime;
549
-
550
448
  if (moveTime <= 300) {
551
449
  move *= 2;
552
450
  moveTime += 1000;
@@ -555,28 +453,24 @@ var CalendarItem = function CalendarItem(props) {
555
453
  setMove(move, 'end');
556
454
  }
557
455
  };
558
-
559
456
  var initData = function initData() {
560
457
  // 初始化开始结束数据
561
458
  state.startData = startDate ? splitDate(startDate) : '';
562
- state.endData = endDate ? splitDate(endDate) : ''; // 初始化当前日期
563
-
459
+ state.endData = endDate ? splitDate(endDate) : '';
460
+ // 初始化当前日期
564
461
  if (!defaultValue) {
565
462
  state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
566
463
  } else {
567
464
  state.currDate = state.isRange ? _toConsumableArray(defaultValue) : defaultValue;
568
- } // 日期转化为数组
569
-
570
-
465
+ }
466
+ // 日期转化为数组
571
467
  if (state.isRange && Array.isArray(state.currDate)) {
572
468
  if (startDate && Utils.compareDate(state.currDate[0], startDate)) {
573
469
  state.currDate.splice(0, 1, startDate);
574
470
  }
575
-
576
471
  if (endDate && Utils.compareDate(endDate, state.currDate[1])) {
577
472
  state.currDate.splice(1, 1, endDate);
578
473
  }
579
-
580
474
  state.defaultData = [].concat(_toConsumableArray(splitDate(state.currDate[0])), _toConsumableArray(splitDate(state.currDate[1])));
581
475
  } else {
582
476
  if (startDate && Utils.compareDate(state.currDate, startDate)) {
@@ -584,18 +478,14 @@ var CalendarItem = function CalendarItem(props) {
584
478
  } else if (endDate && !Utils.compareDate(state.currDate, endDate)) {
585
479
  state.currDate = endDate;
586
480
  }
587
-
588
481
  state.defaultData = _toConsumableArray(splitDate(state.currDate));
589
482
  }
590
-
591
483
  getMonth(state.defaultData, 'next');
592
484
  setYearMonthTitle(state.monthsData[0].title);
593
485
  var i = 1;
594
-
595
486
  do {
596
487
  getMonth(getCurrData('next'), 'next');
597
488
  } while (i++ < 4);
598
-
599
489
  if (state.isRange) {
600
490
  chooseDay({
601
491
  day: state.defaultData[2],
@@ -612,7 +502,6 @@ var CalendarItem = function CalendarItem(props) {
612
502
  }, state.monthsData[0], true);
613
503
  }
614
504
  };
615
-
616
505
  useEffect(function () {
617
506
  initData();
618
507
  }, []);
@@ -677,7 +566,6 @@ var CalendarItem = function CalendarItem(props) {
677
566
  onClick: confirm
678
567
  }, locale.confirm)) : ''));
679
568
  };
680
-
681
569
  CalendarItem.defaultProps = defaultProps;
682
570
  CalendarItem.displayName = 'NutCalendarItem';
683
571
  export { CalendarItem as C, Utils as U };