shineout 1.7.1 → 1.8.0-beta.2

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 (381) hide show
  1. package/css/DatePicker/utils.js +1 -1
  2. package/css/Form/Field.js +8 -4
  3. package/css/Form/Form.js +3 -0
  4. package/css/Form/Item.js +1 -1
  5. package/css/Form/index.d.ts +1 -0
  6. package/css/Form/inputable.js +1 -1
  7. package/css/Pagination/Jumper.js +3 -0
  8. package/css/index.d.ts +1 -1
  9. package/css/index.js +1 -1
  10. package/dist/shineout.js +24 -14
  11. package/dist/shineout.js.map +1 -1
  12. package/dist/shineout.min.js +1 -1
  13. package/es/Alert/index.js +127 -107
  14. package/es/Alert/styles/index.js +3 -4
  15. package/es/AnimationList/AbsoluteList.js +257 -193
  16. package/es/AnimationList/LazyList.js +120 -92
  17. package/es/AnimationList/List.js +43 -23
  18. package/es/AnimationList/index.js +19 -14
  19. package/es/AnimationList/styles/index.js +3 -4
  20. package/es/Breadcrumb/index.js +77 -69
  21. package/es/Breadcrumb/styles/index.js +3 -4
  22. package/es/Button/Button.js +91 -74
  23. package/es/Button/Group.js +42 -28
  24. package/es/Button/Once.js +39 -23
  25. package/es/Button/index.js +7 -10
  26. package/es/Button/styles/index.js +3 -4
  27. package/es/Card/Accordion.js +58 -45
  28. package/es/Card/Body.js +55 -42
  29. package/es/Card/Card.js +85 -79
  30. package/es/Card/Footer.js +38 -15
  31. package/es/Card/Header.js +52 -34
  32. package/es/Card/Submit.js +51 -33
  33. package/es/Card/context.js +22 -16
  34. package/es/Card/index.js +16 -19
  35. package/es/Card/styles/index.js +3 -4
  36. package/es/CardGroup/CardGroup.js +93 -69
  37. package/es/CardGroup/Item.js +61 -43
  38. package/es/CardGroup/context.js +12 -10
  39. package/es/CardGroup/index.js +7 -10
  40. package/es/CardGroup/styles/index.js +3 -4
  41. package/es/Carousel/Item.js +31 -17
  42. package/es/Carousel/index.js +156 -123
  43. package/es/Carousel/styles/index.js +3 -4
  44. package/es/Cascader/Cascader.js +397 -346
  45. package/es/Cascader/FilterList.js +185 -142
  46. package/es/Cascader/Input.js +102 -79
  47. package/es/Cascader/List.js +66 -41
  48. package/es/Cascader/Node.js +153 -110
  49. package/es/Cascader/Result.js +289 -232
  50. package/es/Cascader/filter.js +92 -61
  51. package/es/Cascader/index.js +13 -18
  52. package/es/Cascader/styles/index.js +3 -4
  53. package/es/Checkbox/CheckItem.js +168 -154
  54. package/es/Checkbox/Checkbox.js +2 -3
  55. package/es/Checkbox/Group.js +106 -85
  56. package/es/Checkbox/context.js +12 -10
  57. package/es/Checkbox/index.js +14 -21
  58. package/es/Checkbox/styles/index.js +3 -4
  59. package/es/DataList/BaseItem.js +39 -21
  60. package/es/DataList/Extra.js +33 -17
  61. package/es/DataList/List.js +166 -140
  62. package/es/DataList/Meta.js +109 -74
  63. package/es/DataList/Pagination.js +9 -10
  64. package/es/DataList/index.js +13 -19
  65. package/es/DataList/styles/index.js +3 -4
  66. package/es/DatePicker/Container.js +468 -449
  67. package/es/DatePicker/Day.js +265 -258
  68. package/es/DatePicker/Icon.js +34 -20
  69. package/es/DatePicker/Month.js +101 -79
  70. package/es/DatePicker/Picker.js +110 -83
  71. package/es/DatePicker/Quick.js +52 -39
  72. package/es/DatePicker/Range.js +241 -192
  73. package/es/DatePicker/Text.js +103 -91
  74. package/es/DatePicker/Time.js +165 -147
  75. package/es/DatePicker/TimeScroll.js +148 -116
  76. package/es/DatePicker/Year.js +74 -53
  77. package/es/DatePicker/index.js +16 -18
  78. package/es/DatePicker/paramUtils.js +92 -58
  79. package/es/DatePicker/styles/index.js +3 -4
  80. package/es/DatePicker/utils.js +189 -198
  81. package/es/DatePicker/value.js +139 -98
  82. package/es/Datum/Form.js +333 -282
  83. package/es/Datum/List.js +319 -201
  84. package/es/Datum/Tree.js +298 -239
  85. package/es/Datum/hoc.js +104 -69
  86. package/es/Datum/index.js +7 -8
  87. package/es/Datum/types.js +20 -25
  88. package/es/Divider/index.js +50 -32
  89. package/es/Divider/styles/index.js +3 -4
  90. package/es/Drawer/index.js +14 -9
  91. package/es/Dropdown/Item.js +56 -43
  92. package/es/Dropdown/index.js +273 -259
  93. package/es/Dropdown/styles/index.js +3 -4
  94. package/es/EditableArea/EditableArea.js +157 -136
  95. package/es/EditableArea/index.js +8 -15
  96. package/es/EditableArea/styles/index.js +3 -4
  97. package/es/Form/Block.js +83 -57
  98. package/es/Form/BlockField.js +32 -17
  99. package/es/Form/Field.js +59 -35
  100. package/es/Form/FieldError.js +27 -21
  101. package/es/Form/FieldSet.js +214 -156
  102. package/es/Form/Flow.js +51 -32
  103. package/es/Form/Form.js +181 -144
  104. package/es/Form/Item.js +181 -166
  105. package/es/Form/Loop.js +202 -146
  106. package/es/Form/formButton.js +58 -42
  107. package/es/Form/formContext.js +104 -95
  108. package/es/Form/index.d.ts +1 -0
  109. package/es/Form/index.js +40 -45
  110. package/es/Form/inputable.js +368 -292
  111. package/es/Form/mode.js +15 -9
  112. package/es/Form/styles/index.js +4 -5
  113. package/es/Gap/index.js +71 -47
  114. package/es/Gap/styles/index.js +3 -4
  115. package/es/Gap/support.js +11 -14
  116. package/es/Grid/index.js +88 -58
  117. package/es/Grid/utils.js +57 -58
  118. package/es/Icon/Icon.js +43 -42
  119. package/es/Icon/index.js +39 -22
  120. package/es/Icon/styles/index.js +3 -4
  121. package/es/Image/Gallery.js +128 -113
  122. package/es/Image/Group.js +60 -36
  123. package/es/Image/Image.js +227 -153
  124. package/es/Image/Magnify.js +123 -94
  125. package/es/Image/events.js +29 -26
  126. package/es/Image/index.js +6 -9
  127. package/es/Image/styles/index.js +3 -4
  128. package/es/Input/Group.js +17 -11
  129. package/es/Input/Input.js +158 -134
  130. package/es/Input/Number.js +199 -175
  131. package/es/Input/Password.js +54 -31
  132. package/es/Input/clear.js +41 -25
  133. package/es/Input/index.js +23 -35
  134. package/es/Input/styles/index.js +3 -4
  135. package/es/Lazyload/index.js +63 -42
  136. package/es/Lazyload/styles/index.js +3 -4
  137. package/es/Menu/Item.js +275 -236
  138. package/es/Menu/List.js +75 -67
  139. package/es/Menu/Root.js +372 -334
  140. package/es/Menu/context.js +18 -12
  141. package/es/Menu/index.js +3 -5
  142. package/es/Menu/styles/index.js +3 -4
  143. package/es/Message/Container.js +155 -119
  144. package/es/Message/index.js +42 -30
  145. package/es/Message/messager.js +29 -33
  146. package/es/Message/styles/index.js +3 -4
  147. package/es/Modal/Modal.js +80 -60
  148. package/es/Modal/Panel.js +258 -234
  149. package/es/Modal/context.js +15 -15
  150. package/es/Modal/events.js +213 -182
  151. package/es/Modal/index.js +12 -14
  152. package/es/Modal/styles/index.js +3 -4
  153. package/es/Pagination/Item.js +46 -32
  154. package/es/Pagination/Jumper.js +79 -66
  155. package/es/Pagination/Links.js +110 -82
  156. package/es/Pagination/Next.js +52 -31
  157. package/es/Pagination/PageSizeList.js +57 -40
  158. package/es/Pagination/Pagination.js +78 -54
  159. package/es/Pagination/Prev.js +49 -30
  160. package/es/Pagination/Simple.js +32 -18
  161. package/es/Pagination/index.js +68 -41
  162. package/es/Pagination/styles/index.js +3 -4
  163. package/es/Popover/Confirm.js +107 -64
  164. package/es/Popover/Panel.js +284 -231
  165. package/es/Popover/context.js +15 -12
  166. package/es/Popover/events.js +80 -86
  167. package/es/Popover/index.js +12 -14
  168. package/es/Popover/styles/index.js +3 -4
  169. package/es/Progress/Circle.js +70 -59
  170. package/es/Progress/Line.js +51 -39
  171. package/es/Progress/Popup.js +42 -24
  172. package/es/Progress/analyzeColor.js +18 -9
  173. package/es/Progress/index.js +13 -15
  174. package/es/Progress/styles/index.js +3 -4
  175. package/es/Radio/Group.js +105 -94
  176. package/es/Radio/Radio.js +2 -3
  177. package/es/Radio/index.js +15 -17
  178. package/es/Radio/styles/index.js +1 -1
  179. package/es/Rate/Rate.js +216 -167
  180. package/es/Rate/index.js +17 -10
  181. package/es/Rate/styles/index.js +3 -4
  182. package/es/Rule/convert.js +48 -57
  183. package/es/Rule/index.js +63 -40
  184. package/es/Rule/length.js +53 -38
  185. package/es/Rule/regExp.js +23 -14
  186. package/es/Rule/required.js +26 -18
  187. package/es/Rule/styles/index.js +1 -1
  188. package/es/Rule/type.js +26 -18
  189. package/es/Scroll/Bar.js +145 -117
  190. package/es/Scroll/Scroll.js +277 -217
  191. package/es/Scroll/context.js +20 -13
  192. package/es/Scroll/fixedLength.js +33 -24
  193. package/es/Scroll/index.js +89 -55
  194. package/es/Scroll/styles/index.js +3 -4
  195. package/es/Select/BoxList.js +218 -189
  196. package/es/Select/BoxOption.js +64 -38
  197. package/es/Select/FlexBox.js +107 -75
  198. package/es/Select/FlexResult.js +65 -49
  199. package/es/Select/Input.js +137 -113
  200. package/es/Select/More.js +124 -121
  201. package/es/Select/Option.js +73 -52
  202. package/es/Select/OptionList.js +236 -200
  203. package/es/Select/OptionTree.js +111 -96
  204. package/es/Select/Result.js +297 -271
  205. package/es/Select/Select.js +517 -491
  206. package/es/Select/filter.js +221 -148
  207. package/es/Select/group.js +74 -45
  208. package/es/Select/index.js +32 -31
  209. package/es/Select/styles/index.js +3 -4
  210. package/es/Slider/Container.js +145 -132
  211. package/es/Slider/Indicator.js +28 -13
  212. package/es/Slider/Slider.js +132 -103
  213. package/es/Slider/index.js +5 -8
  214. package/es/Slider/styles/index.js +3 -4
  215. package/es/Slider/utils.js +26 -30
  216. package/es/Spin/Multiple.js +153 -109
  217. package/es/Spin/Simple.js +33 -22
  218. package/es/Spin/Spin.js +29 -29
  219. package/es/Spin/index.js +66 -84
  220. package/es/Spin/styles/index.js +27 -30
  221. package/es/Sticky/context.js +12 -10
  222. package/es/Sticky/index.js +255 -194
  223. package/es/Sticky/styles/index.js +1 -1
  224. package/es/Switch/Switch.js +2 -3
  225. package/es/Switch/index.js +8 -14
  226. package/es/Table/Checkbox.js +68 -39
  227. package/es/Table/CheckboxAll.js +121 -64
  228. package/es/Table/Colgroup.js +72 -47
  229. package/es/Table/Expand.js +63 -43
  230. package/es/Table/SeperateTable.js +594 -444
  231. package/es/Table/SimpleTable.js +215 -136
  232. package/es/Table/Sorter.js +83 -62
  233. package/es/Table/Table.js +157 -157
  234. package/es/Table/Tbody.js +240 -176
  235. package/es/Table/Td.js +169 -130
  236. package/es/Table/Thead.js +206 -177
  237. package/es/Table/Tr.js +249 -205
  238. package/es/Table/TreeExpand.js +151 -116
  239. package/es/Table/context.js +15 -15
  240. package/es/Table/fixedAuto.js +82 -59
  241. package/es/Table/index.js +309 -228
  242. package/es/Table/resizable.js +89 -56
  243. package/es/Table/select.js +238 -215
  244. package/es/Table/styles/index.js +3 -4
  245. package/es/Tabs/Header.js +203 -160
  246. package/es/Tabs/Link.js +46 -28
  247. package/es/Tabs/Panel.js +49 -33
  248. package/es/Tabs/Tab.js +97 -79
  249. package/es/Tabs/Tabs.js +211 -177
  250. package/es/Tabs/Wrapper.js +37 -17
  251. package/es/Tabs/index.js +7 -10
  252. package/es/Tabs/styles/index.js +3 -4
  253. package/es/Tag/Input.js +70 -54
  254. package/es/Tag/Tag.js +198 -156
  255. package/es/Tag/index.js +5 -8
  256. package/es/Tag/styles/index.js +3 -4
  257. package/es/Textarea/Textarea.js +139 -118
  258. package/es/Textarea/index.js +10 -19
  259. package/es/Tooltip/Container.js +140 -127
  260. package/es/Tooltip/events.js +49 -55
  261. package/es/Tooltip/index.js +5 -8
  262. package/es/Tooltip/styles/index.js +3 -4
  263. package/es/Transfer/Card.js +212 -177
  264. package/es/Transfer/Transfer.js +160 -153
  265. package/es/Transfer/btns.js +97 -80
  266. package/es/Transfer/context.js +2 -3
  267. package/es/Transfer/filter.js +65 -35
  268. package/es/Transfer/index.js +9 -13
  269. package/es/Transfer/item.js +66 -41
  270. package/es/Transfer/select.js +15 -16
  271. package/es/Transfer/styles/index.js +3 -4
  272. package/es/Tree/Checkbox.js +72 -50
  273. package/es/Tree/Content.js +136 -95
  274. package/es/Tree/List.js +82 -53
  275. package/es/Tree/Node.js +237 -202
  276. package/es/Tree/Root.js +23 -19
  277. package/es/Tree/Tree.js +262 -197
  278. package/es/Tree/index.js +6 -9
  279. package/es/Tree/styles/index.js +3 -4
  280. package/es/Tree/toggle.js +89 -51
  281. package/es/TreeSelect/Input.js +73 -60
  282. package/es/TreeSelect/Result.js +213 -181
  283. package/es/TreeSelect/TreeSelect.js +327 -312
  284. package/es/TreeSelect/datum.js +56 -44
  285. package/es/TreeSelect/filter.js +134 -96
  286. package/es/TreeSelect/index.js +15 -23
  287. package/es/TreeSelect/styles/index.js +3 -4
  288. package/es/TreeSelect/tiled.js +143 -106
  289. package/es/Upload/Dragger.js +63 -39
  290. package/es/Upload/Drop.js +79 -57
  291. package/es/Upload/File.js +61 -48
  292. package/es/Upload/FileInput.js +53 -40
  293. package/es/Upload/Image.js +158 -115
  294. package/es/Upload/ImageFile.js +63 -43
  295. package/es/Upload/ImageResult.js +139 -114
  296. package/es/Upload/Progress.js +117 -105
  297. package/es/Upload/RemoveConfirm.js +58 -42
  298. package/es/Upload/Result.js +73 -58
  299. package/es/Upload/Upload.js +649 -490
  300. package/es/Upload/accept.js +33 -13
  301. package/es/Upload/context.js +12 -10
  302. package/es/Upload/index.js +16 -20
  303. package/es/Upload/request.js +48 -46
  304. package/es/Upload/styles/index.js +3 -4
  305. package/es/component.js +45 -24
  306. package/es/config.js +27 -19
  307. package/es/context/implementation.js +132 -94
  308. package/es/context/index.js +3 -4
  309. package/es/hoc/coin.js +118 -81
  310. package/es/hoc/config.js +31 -17
  311. package/es/hoc/delay.js +99 -55
  312. package/es/hoc/draggable.js +90 -80
  313. package/es/hoc/fetch.js +56 -33
  314. package/es/hoc/hidable.js +119 -98
  315. package/es/hoc/inputBorder.js +158 -158
  316. package/es/hoc/moveable.js +124 -96
  317. package/es/hoc/pagable.js +74 -55
  318. package/es/hoc/resizable.js +132 -100
  319. package/es/hoc/styles/index.js +7 -8
  320. package/es/hoc/trim.js +54 -32
  321. package/es/icons/Caret.js +14 -15
  322. package/es/icons/index.js +31 -85
  323. package/es/index.d.ts +1 -1
  324. package/es/index.js +58 -57
  325. package/es/locale/en_US.js +9 -30
  326. package/es/locale/index.js +13 -14
  327. package/es/locale/zh-CN.js +9 -17
  328. package/es/styles/expose.js +3 -4
  329. package/es/styles/index.js +1 -1
  330. package/es/utils/accept.js +15 -12
  331. package/es/utils/classname.js +23 -12
  332. package/es/utils/cleanProps.js +9 -21
  333. package/es/utils/clone.js +34 -27
  334. package/es/utils/color.js +310 -276
  335. package/es/utils/css-accessors.js +94 -45
  336. package/es/utils/dom/detect.js +29 -29
  337. package/es/utils/dom/document.js +23 -19
  338. package/es/utils/dom/element.js +139 -105
  339. package/es/utils/dom/getDataset.js +9 -9
  340. package/es/utils/dom/isDOMElement.js +3 -5
  341. package/es/utils/dom/normalizeWheel.js +32 -28
  342. package/es/utils/dom/popContainer.js +12 -13
  343. package/es/utils/dom/popover.js +79 -59
  344. package/es/utils/dom/ready.js +5 -6
  345. package/es/utils/dom/translate.js +10 -12
  346. package/es/utils/errors.js +47 -28
  347. package/es/utils/expose.js +97 -58
  348. package/es/utils/flat.js +122 -107
  349. package/es/utils/func.js +38 -20
  350. package/es/utils/hash.js +24 -20
  351. package/es/utils/index.js +24 -49
  352. package/es/utils/is.js +91 -70
  353. package/es/utils/lazyload.js +104 -86
  354. package/es/utils/notification.js +34 -20
  355. package/es/utils/numbers.js +61 -51
  356. package/es/utils/objects.js +221 -140
  357. package/es/utils/proptypes.js +21 -34
  358. package/es/utils/shallowEqual.js +46 -42
  359. package/es/utils/strings.js +50 -32
  360. package/es/utils/transform.js +24 -9
  361. package/es/utils/tree.js +78 -63
  362. package/es/utils/uid.js +14 -17
  363. package/es/utils/validate/index.js +71 -50
  364. package/es/utils/validate/isJson.js +7 -10
  365. package/es/utils/validate/nullable.js +10 -9
  366. package/es/utils/validate/range.js +22 -19
  367. package/es/utils/validate/rangeLength.js +19 -16
  368. package/es/utils/validate/regExp.js +10 -10
  369. package/es/utils/validate/required.js +11 -8
  370. package/es/utils/validate/type.js +56 -59
  371. package/es/utils/vars-inject.js +3420 -4248
  372. package/lib/DatePicker/utils.js +1 -1
  373. package/lib/Form/Field.js +8 -4
  374. package/lib/Form/Form.js +3 -0
  375. package/lib/Form/Item.js +1 -1
  376. package/lib/Form/index.d.ts +1 -0
  377. package/lib/Form/inputable.js +1 -1
  378. package/lib/Pagination/Jumper.js +3 -0
  379. package/lib/index.d.ts +1 -1
  380. package/lib/index.js +1 -1
  381. package/package.json +3 -2
@@ -1,296 +1,304 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
- import { datepickerClass } from './styles'
4
- import utils from './utils'
5
- import paramUtils from './paramUtils'
6
- import Icon from './Icon'
7
- import { getLocale } from '../locale'
8
- import { PureComponent } from '../component'
9
- import Time from './Time'
10
-
11
- const minStr = 'yyyy-MM-dd 00:00:00'
12
- const maxStr = 'yyyy-MM-dd 23:59:59'
13
-
14
- class Day extends PureComponent {
15
- constructor(props) {
16
- super(props)
17
-
18
- this.state = {
19
- hover: null,
20
- }
21
-
22
- this.handleNextMonth = this.handleMonth.bind(this, 1)
23
- this.handlePrevMonth = this.handleMonth.bind(this, -1)
24
- this.handleNextYear = this.handleMonth.bind(this, 12)
25
- this.handlePrevYear = this.handleMonth.bind(this, -12)
26
- this.handleMonthMode = this.handleModeChange.bind(this, 'month')
27
- this.handleYearMode = this.handleModeChange.bind(this, 'year')
28
- this.handleWeekLeave = this.handleWeek.bind(this, null)
29
- this.handleTimeChange = this.handleTimeChange.bind(this)
30
- this.formatWithDefaultTime = this.formatWithDefaultTime.bind(this)
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { datepickerClass } from './styles';
7
+ import utils from './utils';
8
+ import paramUtils from './paramUtils';
9
+ import Icon from './Icon';
10
+ import { getLocale } from '../locale';
11
+ import { PureComponent } from '../component';
12
+ import Time from './Time';
13
+ var minStr = 'yyyy-MM-dd 00:00:00';
14
+ var maxStr = 'yyyy-MM-dd 23:59:59';
15
+
16
+ var Day =
17
+ /*#__PURE__*/
18
+ function (_PureComponent) {
19
+ _inheritsLoose(Day, _PureComponent);
20
+
21
+ function Day(props) {
22
+ var _this;
23
+
24
+ _this = _PureComponent.call(this, props) || this;
25
+ _this.state = {
26
+ hover: null
27
+ };
28
+ _this.handleNextMonth = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), 1);
29
+ _this.handlePrevMonth = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), -1);
30
+ _this.handleNextYear = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), 12);
31
+ _this.handlePrevYear = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), -12);
32
+ _this.handleMonthMode = _this.handleModeChange.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'month');
33
+ _this.handleYearMode = _this.handleModeChange.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'year');
34
+ _this.handleWeekLeave = _this.handleWeek.bind(_assertThisInitialized(_assertThisInitialized(_this)), null);
35
+ _this.handleTimeChange = _this.handleTimeChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
36
+ _this.formatWithDefaultTime = _this.formatWithDefaultTime.bind(_assertThisInitialized(_assertThisInitialized(_this)));
37
+ return _this;
31
38
  }
32
39
 
33
- getDays() {
34
- const { current } = this.props
35
- if (!current) return this.cachedDays
36
- const date = utils.clearHMS(current)
37
- if (this.cachedDate && utils.isSameMonth(this.cachedDate, date) && this.cachedDays) {
38
- return this.cachedDays
39
- }
40
- this.cachedDays = utils.getDaysOfMonth(date)
41
- this.cachedDate = date
40
+ var _proto = Day.prototype;
42
41
 
43
- return this.cachedDays
44
- }
42
+ _proto.getDays = function getDays() {
43
+ var current = this.props.current;
44
+ if (!current) return this.cachedDays;
45
+ var date = utils.clearHMS(current);
45
46
 
46
- formatWithDefaultTime(i) {
47
- let idx = 0
48
- const { current, defaultTime, index } = this.props
49
- if (typeof index === 'number') idx = index
50
- if (typeof i === 'number') idx = i
51
- if (!defaultTime[idx]) return current
52
- return utils.cloneTime(current, defaultTime[idx], utils.TIME_FORMAT)
53
- }
47
+ if (this.cachedDate && utils.isSameMonth(this.cachedDate, date) && this.cachedDays) {
48
+ return this.cachedDays;
49
+ }
54
50
 
55
- handleDayDoubleClick(date) {
56
- const { type, defaultTime, index } = this.props
57
- // range & datetime & deafultTime
58
- if (type !== 'datetime' || !defaultTime.length || index === undefined) return
59
- this.handleDayClick(date, 0)
60
- this.handleDayClick(date, 1)
61
- }
51
+ this.cachedDays = utils.getDaysOfMonth(date);
52
+ this.cachedDate = date;
53
+ return this.cachedDays;
54
+ };
55
+
56
+ _proto.formatWithDefaultTime = function formatWithDefaultTime(i) {
57
+ var idx = 0;
58
+ var _this$props = this.props,
59
+ current = _this$props.current,
60
+ defaultTime = _this$props.defaultTime,
61
+ index = _this$props.index;
62
+ if (typeof index === 'number') idx = index;
63
+ if (typeof i === 'number') idx = i;
64
+ if (!defaultTime[idx]) return current;
65
+ return utils.cloneTime(current, defaultTime[idx], utils.TIME_FORMAT);
66
+ };
67
+
68
+ _proto.handleDayDoubleClick = function handleDayDoubleClick(date) {
69
+ var _this$props2 = this.props,
70
+ type = _this$props2.type,
71
+ defaultTime = _this$props2.defaultTime,
72
+ index = _this$props2.index; // range & datetime & deafultTime
73
+
74
+ if (type !== 'datetime' || !defaultTime.length || index === undefined) return;
75
+ this.handleDayClick(date, 0);
76
+ this.handleDayClick(date, 1);
77
+ };
78
+
79
+ _proto.handleDayClick = function handleDayClick(date, sync) {
80
+ var _this$props3 = this.props,
81
+ type = _this$props3.type,
82
+ allowSingle = _this$props3.allowSingle,
83
+ rangeDate = _this$props3.rangeDate,
84
+ min = _this$props3.min,
85
+ max = _this$props3.max,
86
+ index = _this$props3.index,
87
+ value = _this$props3.value;
88
+ var current = index === sync && value || this.formatWithDefaultTime(sync);
89
+ var onChange = typeof sync === 'number' ? this.props.onChangeSync.bind(this.props, sync) : this.props.onChange;
62
90
 
63
- handleDayClick(date, sync) {
64
- const { type, allowSingle, rangeDate, min, max, index, value } = this.props
65
- const current = (index === sync && value) || this.formatWithDefaultTime(sync)
66
- const onChange = typeof sync === 'number' ? this.props.onChangeSync.bind(this.props, sync) : this.props.onChange
67
91
  if (type === 'week') {
68
- onChange(...paramUtils.weekHandleChangeParams(date, true, true))
92
+ onChange.apply(void 0, paramUtils.weekHandleChangeParams(date, true, true));
69
93
  } else {
70
- let newDate = new Date(
71
- date.getFullYear(),
72
- date.getMonth(),
73
- date.getDate(),
74
- current.getHours(),
75
- current.getMinutes(),
76
- current.getSeconds()
77
- )
78
- // only can select day with the same day of min/max
79
- if (min && utils.compareAsc(newDate, min) < 0) utils.setTime(newDate, min)
80
- if (max && utils.compareAsc(newDate, max) > 0) utils.setTime(newDate, max)
81
-
82
- if (
83
- allowSingle &&
84
- rangeDate[index] &&
85
- utils.clearHMS(newDate).getTime() === utils.clearHMS(rangeDate[index]).getTime()
86
- )
87
- newDate = ''
88
-
89
- onChange(...paramUtils.dayHandleChangeParams(newDate, true, type !== 'datetime'))
94
+ var newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), current.getHours(), current.getMinutes(), current.getSeconds()); // only can select day with the same day of min/max
95
+
96
+ if (min && utils.compareAsc(newDate, min) < 0) utils.setTime(newDate, min);
97
+ if (max && utils.compareAsc(newDate, max) > 0) utils.setTime(newDate, max);
98
+ if (allowSingle && rangeDate[index] && utils.clearHMS(newDate).getTime() === utils.clearHMS(rangeDate[index]).getTime()) newDate = '';
99
+ onChange.apply(void 0, paramUtils.dayHandleChangeParams(newDate, true, type !== 'datetime'));
90
100
  }
91
- }
101
+ };
92
102
 
93
- handleTimeChange(time, change, end, mode) {
94
- this.props.onChange(...paramUtils.timeHandleChangeParams(time, true, false, mode))
95
- }
103
+ _proto.handleTimeChange = function handleTimeChange(time, change, end, mode) {
104
+ var _this$props4;
96
105
 
97
- handleWeek(hover) {
98
- this.setState({ hover })
99
- }
106
+ (_this$props4 = this.props).onChange.apply(_this$props4, paramUtils.timeHandleChangeParams(time, true, false, mode));
107
+ };
100
108
 
101
- handleMonth(month) {
102
- const { current, onChange } = this.props
103
- // warning: month === 12 || month === -12, this is statement is year mode.
104
- if (month === -12 || month === 12) {
105
- onChange(...paramUtils.yearHandleChangeParams(utils.addMonths(current, month)))
106
- return
107
- }
108
- onChange(...paramUtils.monthHandleChangeParams(utils.addMonths(current, month)))
109
- }
109
+ _proto.handleWeek = function handleWeek(hover) {
110
+ this.setState({
111
+ hover: hover
112
+ });
113
+ };
110
114
 
111
- handleModeChange(mode) {
112
- this.props.onModeChange(mode)
113
- }
115
+ _proto.handleMonth = function handleMonth(month) {
116
+ var _this$props5 = this.props,
117
+ current = _this$props5.current,
118
+ onChange = _this$props5.onChange; // warning: month === 12 || month === -12, this is statement is year mode.
114
119
 
115
- handleDayHover(date) {
116
- this.props.onDayHover(date)
117
- }
120
+ if (month === -12 || month === 12) {
121
+ onChange.apply(void 0, paramUtils.yearHandleChangeParams(utils.addMonths(current, month)));
122
+ return;
123
+ }
118
124
 
119
- renderDay(date, minD, maxD) {
120
- const { current, disabled, value, index, type, rangeDate, range, rangeTemp, min, max } = this.props
121
- const { hover } = this.state
122
- const hmsDate = utils.toDate(date)
123
- utils.setTime(hmsDate, current)
124
- let isDisabled = disabled ? disabled(date) : false
125
+ onChange.apply(void 0, paramUtils.monthHandleChangeParams(utils.addMonths(current, month)));
126
+ };
127
+
128
+ _proto.handleModeChange = function handleModeChange(mode) {
129
+ this.props.onModeChange(mode);
130
+ };
131
+
132
+ _proto.handleDayHover = function handleDayHover(date) {
133
+ this.props.onDayHover(date);
134
+ };
135
+
136
+ _proto.renderDay = function renderDay(date, minD, maxD) {
137
+ var _this$props6 = this.props,
138
+ current = _this$props6.current,
139
+ disabled = _this$props6.disabled,
140
+ value = _this$props6.value,
141
+ index = _this$props6.index,
142
+ type = _this$props6.type,
143
+ rangeDate = _this$props6.rangeDate,
144
+ range = _this$props6.range,
145
+ rangeTemp = _this$props6.rangeTemp,
146
+ min = _this$props6.min,
147
+ max = _this$props6.max;
148
+ var hover = this.state.hover;
149
+ var hmsDate = utils.toDate(date);
150
+ utils.setTime(hmsDate, current);
151
+ var isDisabled = disabled ? disabled(date) : false; // only for single, single picker don't has index
125
152
 
126
- // only for single, single picker don't has index
127
153
  if (index === undefined && !isDisabled) {
128
- if ((minD && utils.compareAsc(date, minD) < 0) || (maxD && utils.compareAsc(date, maxD) > 0)) isDisabled = true
154
+ if (minD && utils.compareAsc(date, minD) < 0 || maxD && utils.compareAsc(date, maxD) > 0) isDisabled = true;
129
155
  }
156
+
130
157
  if (!isDisabled && index === 1) {
131
- if (
132
- (typeof range === 'number' && utils.compareAsc(date, utils.addSeconds(rangeTemp, range)) > 0) ||
133
- utils.compareAsc(date, utils.clearHMS(rangeTemp)) < 0 ||
134
- utils.compareAsc(date, utils.clearHMS(min)) < 0 ||
135
- utils.compareAsc(date, max) > 0
136
- ) {
137
- isDisabled = true
138
- }
139
- // if (utils.compareAsc(date, min) < 0) isDisabled = true
158
+ if (typeof range === 'number' && utils.compareAsc(date, utils.addSeconds(rangeTemp, range)) > 0 || utils.compareAsc(date, utils.clearHMS(rangeTemp)) < 0 || utils.compareAsc(date, utils.clearHMS(min)) < 0 || utils.compareAsc(date, max) > 0) {
159
+ isDisabled = true;
160
+ } // if (utils.compareAsc(date, min) < 0) isDisabled = true
161
+
140
162
  }
141
163
 
142
164
  if (!isDisabled && index === 0) {
143
165
  if (utils.compareAsc(date, utils.clearHMS(min)) < 0 || utils.compareAsc(date, max) > 0) {
144
- isDisabled = true
166
+ isDisabled = true;
145
167
  }
146
168
  }
147
169
 
148
- const classList = [
149
- utils.isSameDay(date, this.today) && 'today',
150
- current.getMonth() !== date.getMonth() && 'other-month',
151
- isDisabled && 'disabled',
152
- ]
170
+ var classList = [utils.isSameDay(date, this.today) && 'today', current.getMonth() !== date.getMonth() && 'other-month', isDisabled && 'disabled'];
171
+ var hoverClass;
172
+ var hoverProps = {};
173
+ var weekStart = getLocale('startOfWeek');
174
+ var weekEnd = weekStart ? 0 : 6;
153
175
 
154
- let hoverClass
155
- const hoverProps = {}
156
- const weekStart = getLocale('startOfWeek')
157
- const weekEnd = weekStart ? 0 : 6
158
176
  if (type === 'week') {
159
- hoverProps.onMouseEnter = this.handleWeek.bind(this, date)
160
- hoverProps.onMouseLeave = this.handleWeekLeave
161
- if (
162
- utils.isSameWeek(date, value, {
163
- weekStartsOn: weekStart,
164
- })
165
- ) {
166
- hoverClass = datepickerClass(
167
- 'active',
168
- date.getDay() === weekStart && 'hover-start',
169
- date.getDay() === weekEnd && 'hover-end'
170
- )
171
- } else if (
172
- hover &&
173
- utils.isSameWeek(date, hover, {
174
- weekStartsOn: weekStart,
175
- })
176
- ) {
177
- hoverClass = datepickerClass(
178
- 'hover',
179
- date.getDay() === weekStart && 'hover-start',
180
- date.getDay() === weekEnd && 'hover-end'
181
- )
177
+ hoverProps.onMouseEnter = this.handleWeek.bind(this, date);
178
+ hoverProps.onMouseLeave = this.handleWeekLeave;
179
+
180
+ if (utils.isSameWeek(date, value, {
181
+ weekStartsOn: weekStart
182
+ })) {
183
+ hoverClass = datepickerClass('active', date.getDay() === weekStart && 'hover-start', date.getDay() === weekEnd && 'hover-end');
184
+ } else if (hover && utils.isSameWeek(date, hover, {
185
+ weekStartsOn: weekStart
186
+ })) {
187
+ hoverClass = datepickerClass('hover', date.getDay() === weekStart && 'hover-start', date.getDay() === weekEnd && 'hover-end');
182
188
  }
183
189
  } else if (rangeDate && current.getMonth() === date.getMonth()) {
184
- hoverProps.onMouseEnter = this.handleDayHover.bind(this, date)
185
-
186
- classList.push(utils.isSameDay(date, rangeDate[index]) && 'active')
187
-
188
- hoverClass = datepickerClass(
189
- utils.compareAsc(rangeDate[0], date) <= 0 && utils.compareAsc(rangeDate[1], date) >= 0 && 'hover',
190
- // Datetime Picker range end datetime classname #330
191
- utils.isSameDay(rangeDate[index], date) && `hover-${index === 0 ? 'start' : 'end'} active`
192
- )
190
+ hoverProps.onMouseEnter = this.handleDayHover.bind(this, date);
191
+ classList.push(utils.isSameDay(date, rangeDate[index]) && 'active');
192
+ hoverClass = datepickerClass(utils.compareAsc(rangeDate[0], date) <= 0 && utils.compareAsc(rangeDate[1], date) >= 0 && 'hover', // Datetime Picker range end datetime classname #330
193
+ utils.isSameDay(rangeDate[index], date) && "hover-" + (index === 0 ? 'start' : 'end') + " active");
193
194
  } else if (value) {
194
- classList.push(utils.isSameDay(date, value) && 'active')
195
+ classList.push(utils.isSameDay(date, value) && 'active');
195
196
  }
196
197
 
197
- return (
198
- <div
199
- key={date.getTime()}
200
- className={hoverClass}
201
- onClick={isDisabled ? undefined : this.handleDayClick.bind(this, date)}
202
- onDoubleClick={isDisabled ? undefined : this.handleDayDoubleClick.bind(this, date)}
203
- {...hoverProps}
204
- >
205
- <span className={datepickerClass(...classList)}>{date.getDate()}</span>
206
- </div>
207
- )
208
- }
209
-
210
- renderTimepicker() {
211
- const { rangeDate, index, showTimePicker } = this.props
212
- if (this.props.type !== 'datetime') return undefined
213
- if (!showTimePicker) return undefined
198
+ return React.createElement("div", _extends({
199
+ key: date.getTime(),
200
+ className: hoverClass,
201
+ onClick: isDisabled ? undefined : this.handleDayClick.bind(this, date),
202
+ onDoubleClick: isDisabled ? undefined : this.handleDayDoubleClick.bind(this, date)
203
+ }, hoverProps), React.createElement("span", {
204
+ className: datepickerClass.apply(void 0, classList)
205
+ }, date.getDate()));
206
+ };
207
+
208
+ _proto.renderTimepicker = function renderTimepicker() {
209
+ var _this$props7 = this.props,
210
+ rangeDate = _this$props7.rangeDate,
211
+ index = _this$props7.index,
212
+ showTimePicker = _this$props7.showTimePicker;
213
+ if (this.props.type !== 'datetime') return undefined;
214
+ if (!showTimePicker) return undefined;
215
+ var format = this.props.format;
214
216
 
215
- let { format } = this.props
216
217
  if (/^[T|t]$/.test(format)) {
217
- format = 'HH:mm:ss'
218
+ format = 'HH:mm:ss';
218
219
  } else {
219
- const match = format.match(/[H|h].*/)
220
- // eslint-disable-next-line
221
- if (match) format = match[0]
222
- }
220
+ var match = format.match(/[H|h].*/); // eslint-disable-next-line
223
221
 
224
- const value = rangeDate ? utils.toDateWithFormat(rangeDate[index], format) : this.props.value
225
- if (!value) return undefined
222
+ if (match) format = match[0];
223
+ }
226
224
 
227
- return (
228
- <div className={datepickerClass('datetime')}>
229
- <Icon name="Clock" className="clock" />
230
- <Time {...this.props} format={format} value={value} onChange={this.handleTimeChange} />
231
- <span>{utils.format(value, format)}</span>
232
- </div>
233
- )
234
- }
225
+ var value = rangeDate ? utils.toDateWithFormat(rangeDate[index], format) : this.props.value;
226
+ if (!value) return undefined;
227
+ return React.createElement("div", {
228
+ className: datepickerClass('datetime')
229
+ }, React.createElement(Icon, {
230
+ name: "Clock",
231
+ className: "clock"
232
+ }), React.createElement(Time, _extends({}, this.props, {
233
+ format: format,
234
+ value: value,
235
+ onChange: this.handleTimeChange
236
+ })), React.createElement("span", null, utils.format(value, format)));
237
+ };
238
+
239
+ _proto.render = function render() {
240
+ var _this2 = this;
241
+
242
+ var _this$props8 = this.props,
243
+ current = _this$props8.current,
244
+ min = _this$props8.min,
245
+ index = _this$props8.index,
246
+ max = _this$props8.max;
247
+ var days = this.getDays();
248
+ this.today = utils.newDate();
249
+ var minDate = min && utils.toDate(utils.format(min, minStr, new Date()));
250
+ var maxDate = max && utils.toDate(utils.format(max, maxStr, new Date()));
251
+ return React.createElement("div", {
252
+ className: datepickerClass('day-picker')
253
+ }, React.createElement("div", {
254
+ className: datepickerClass('title')
255
+ }, getLocale('pickerTitle')[index]), React.createElement("div", {
256
+ className: datepickerClass('header')
257
+ }, React.createElement(Icon, {
258
+ name: "AngleDoubleLeft",
259
+ className: "left",
260
+ disabled: !!(min && current.getFullYear() <= min.getFullYear()),
261
+ onClick: this.handlePrevYear
262
+ }), React.createElement(Icon, {
263
+ name: "AngleLeft",
264
+ className: "left",
265
+ disabled: !!(min && utils.compareMonth(current, min) <= 0),
266
+ onClick: this.handlePrevMonth
267
+ }), React.createElement("span", {
268
+ className: datepickerClass('ym')
269
+ }, React.createElement("span", {
270
+ onClick: this.handleYearMode
271
+ }, current.getFullYear()), React.createElement("span", {
272
+ onClick: this.handleMonthMode
273
+ }, getLocale('monthValues.short')[current.getMonth()])), React.createElement(Icon, {
274
+ name: "AngleRight",
275
+ className: "right" // disabled={max && utils.compareMonth(current, max, 0) >= 0}
276
+ ,
277
+ onClick: this.handleNextMonth
278
+ }), React.createElement(Icon, {
279
+ onClick: this.handleNextYear // disabled={max && current.getFullYear() >= max.getFullYear()}
280
+ ,
281
+ name: "AngleDoubleRight",
282
+ className: "right"
283
+ })), React.createElement("div", {
284
+ className: datepickerClass('week')
285
+ }, getLocale('weekdayValues.narrow').map(function (w) {
286
+ return React.createElement("span", {
287
+ key: w
288
+ }, w);
289
+ })), React.createElement("div", {
290
+ className: datepickerClass('list')
291
+ }, days.map(function (d) {
292
+ return _this2.renderDay(d, minDate, maxDate);
293
+ })), React.createElement("div", {
294
+ style: {
295
+ flex: 1
296
+ }
297
+ }), this.renderTimepicker());
298
+ };
235
299
 
236
- render() {
237
- const { current, min, index, max } = this.props
238
- const days = this.getDays()
239
- this.today = utils.newDate()
240
- const minDate = min && utils.toDate(utils.format(min, minStr, new Date()))
241
- const maxDate = max && utils.toDate(utils.format(max, maxStr, new Date()))
242
-
243
- return (
244
- <div className={datepickerClass('day-picker')}>
245
- <div className={datepickerClass('title')}>{getLocale('pickerTitle')[index]}</div>
246
- <div className={datepickerClass('header')}>
247
- <Icon
248
- name="AngleDoubleLeft"
249
- className="left"
250
- disabled={!!(min && current.getFullYear() <= min.getFullYear())}
251
- onClick={this.handlePrevYear}
252
- />
253
- <Icon
254
- name="AngleLeft"
255
- className="left"
256
- disabled={!!(min && utils.compareMonth(current, min) <= 0)}
257
- onClick={this.handlePrevMonth}
258
- />
259
-
260
- <span className={datepickerClass('ym')}>
261
- <span onClick={this.handleYearMode}>{current.getFullYear()}</span>
262
- <span onClick={this.handleMonthMode}>{getLocale('monthValues.short')[current.getMonth()]}</span>
263
- </span>
264
-
265
- <Icon
266
- name="AngleRight"
267
- className="right"
268
- // disabled={max && utils.compareMonth(current, max, 0) >= 0}
269
- onClick={this.handleNextMonth}
270
- />
271
- <Icon
272
- onClick={this.handleNextYear}
273
- // disabled={max && current.getFullYear() >= max.getFullYear()}
274
- name="AngleDoubleRight"
275
- className="right"
276
- />
277
- </div>
278
-
279
- <div className={datepickerClass('week')}>
280
- {getLocale('weekdayValues.narrow').map(w => (
281
- <span key={w}>{w}</span>
282
- ))}
283
- </div>
284
-
285
- <div className={datepickerClass('list')}>{days.map(d => this.renderDay(d, minDate, maxDate))}</div>
286
-
287
- <div style={{ flex: 1 }} />
288
-
289
- {this.renderTimepicker()}
290
- </div>
291
- )
292
- }
293
- }
300
+ return Day;
301
+ }(PureComponent);
294
302
 
295
303
  Day.propTypes = {
296
304
  current: PropTypes.object.isRequired,
@@ -310,7 +318,6 @@ Day.propTypes = {
310
318
  type: PropTypes.string.isRequired,
311
319
  value: PropTypes.object,
312
320
  defaultTime: PropTypes.array,
313
- allowSingle: PropTypes.bool,
314
- }
315
-
316
- export default Day
321
+ allowSingle: PropTypes.bool
322
+ };
323
+ export default Day;
@@ -1,31 +1,45 @@
1
- import { createElement, PureComponent } from 'react'
2
- import PropTypes from 'prop-types'
3
- import icons from '../icons'
4
- import { datepickerClass } from './styles'
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
+ import { createElement, PureComponent } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import icons from '../icons';
5
+ import { datepickerClass } from './styles';
5
6
 
6
- class Icon extends PureComponent {
7
- render() {
8
- const { className, name, onClick, tag, disabled } = this.props
7
+ var Icon =
8
+ /*#__PURE__*/
9
+ function (_PureComponent) {
10
+ _inheritsLoose(Icon, _PureComponent);
9
11
 
10
- const newProps = {
12
+ function Icon() {
13
+ return _PureComponent.apply(this, arguments) || this;
14
+ }
15
+
16
+ var _proto = Icon.prototype;
17
+
18
+ _proto.render = function render() {
19
+ var _this$props = this.props,
20
+ className = _this$props.className,
21
+ name = _this$props.name,
22
+ onClick = _this$props.onClick,
23
+ tag = _this$props.tag,
24
+ disabled = _this$props.disabled;
25
+ var newProps = {
11
26
  className: datepickerClass(className, 'icon', disabled && 'disabled'),
12
- onClick: disabled ? undefined : onClick,
13
- }
27
+ onClick: disabled ? undefined : onClick
28
+ };
29
+ return createElement(tag, newProps, icons[name]);
30
+ };
14
31
 
15
- return createElement(tag, newProps, icons[name])
16
- }
17
- }
32
+ return Icon;
33
+ }(PureComponent);
18
34
 
19
35
  Icon.propTypes = {
20
36
  className: PropTypes.string,
21
37
  disabled: PropTypes.bool,
22
38
  name: PropTypes.string.isRequired,
23
39
  onClick: PropTypes.func,
24
- tag: PropTypes.string,
25
- }
26
-
40
+ tag: PropTypes.string
41
+ };
27
42
  Icon.defaultProps = {
28
- tag: 'span',
29
- }
30
-
31
- export default Icon
43
+ tag: 'span'
44
+ };
45
+ export default Icon;