amis-rev-ui 6.13.0

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 (783) hide show
  1. package/LICENSE +201 -0
  2. package/esm/HTMLFilterContext.d.ts +3 -0
  3. package/esm/HTMLFilterContext.js +10 -0
  4. package/esm/components/404.js +35 -0
  5. package/esm/components/Alert.js +266 -0
  6. package/esm/components/Alert2.js +58 -0
  7. package/esm/components/AlphabetIndexer.d.ts +11 -0
  8. package/esm/components/AlphabetIndexer.js +48 -0
  9. package/esm/components/AnchorNav.js +153 -0
  10. package/esm/components/AnchorNavSection.d.ts +2 -0
  11. package/esm/components/AnchorNavSection.js +7 -0
  12. package/esm/components/ArrayInput.js +146 -0
  13. package/esm/components/AsideNav.js +133 -0
  14. package/esm/components/AssociatedSelection.js +107 -0
  15. package/esm/components/AutoFoldedList.js +124 -0
  16. package/esm/components/AutoSizer.d.ts +2 -0
  17. package/esm/components/AutoSizer.js +8 -0
  18. package/esm/components/Avatar.js +126 -0
  19. package/esm/components/Badge.d.ts +20 -0
  20. package/esm/components/Badge.js +154 -0
  21. package/esm/components/BaiduMapPicker.js +366 -0
  22. package/esm/components/BarCode.js +42 -0
  23. package/esm/components/Breadcrumb.js +160 -0
  24. package/esm/components/Button.js +64 -0
  25. package/esm/components/CalendarMobile.js +538 -0
  26. package/esm/components/Card.js +88 -0
  27. package/esm/components/Cascader.js +515 -0
  28. package/esm/components/ChainedDropdownSelection.js +104 -0
  29. package/esm/components/ChainedSelection.js +184 -0
  30. package/esm/components/Checkbox.js +87 -0
  31. package/esm/components/CityArea.js +190 -0
  32. package/esm/components/CityDB.d.ts +13 -0
  33. package/esm/components/CityDB.js +3942 -0
  34. package/esm/components/CodeMirror.d.ts +29 -0
  35. package/esm/components/CodeMirror.js +140 -0
  36. package/esm/components/Collapse.js +184 -0
  37. package/esm/components/CollapseGroup.js +117 -0
  38. package/esm/components/ColorPicker.js +259 -0
  39. package/esm/components/Combo.js +212 -0
  40. package/esm/components/ConditionBuilder.d.ts +2 -0
  41. package/esm/components/ConditionBuilder.js +7 -0
  42. package/esm/components/ConfirmBox.js +128 -0
  43. package/esm/components/ContextMenu.js +310 -0
  44. package/esm/components/DatePicker.js +716 -0
  45. package/esm/components/DateRangePicker.js +1385 -0
  46. package/esm/components/DiffEditor.d.ts +21 -0
  47. package/esm/components/DiffEditor.js +119 -0
  48. package/esm/components/DndContainer.js +25 -0
  49. package/esm/components/Drawer.js +272 -0
  50. package/esm/components/DropDownSelection.js +77 -0
  51. package/esm/components/DropdownContextMenus.js +93 -0
  52. package/esm/components/Editor.js +238 -0
  53. package/esm/components/Form.d.ts +31 -0
  54. package/esm/components/Form.js +84 -0
  55. package/esm/components/FormField.js +78 -0
  56. package/esm/components/FormulaPicker.d.ts +2 -0
  57. package/esm/components/FormulaPicker.js +7 -0
  58. package/esm/components/GaodeMapPicker.js +204 -0
  59. package/esm/components/GridNav.d.ts +53 -0
  60. package/esm/components/GridNav.js +125 -0
  61. package/esm/components/GridNavItem.d.ts +2 -0
  62. package/esm/components/GridNavItem.js +7 -0
  63. package/esm/components/GroupedSelection.js +138 -0
  64. package/esm/components/HeadCellDropDown.d.ts +2 -0
  65. package/esm/components/HeadCellDropDown.js +7 -0
  66. package/esm/components/HorizontalScroll.d.ts +74 -0
  67. package/esm/components/HorizontalScroll.js +271 -0
  68. package/esm/components/Html.js +55 -0
  69. package/esm/components/Icon.d.ts +2 -0
  70. package/esm/components/Icon.js +7 -0
  71. package/esm/components/ImageGallery.js +396 -0
  72. package/esm/components/Input.d.ts +18 -0
  73. package/esm/components/Input.js +75 -0
  74. package/esm/components/InputBox.js +99 -0
  75. package/esm/components/InputBoxWithSuggestion.js +70 -0
  76. package/esm/components/InputJSONSchema.d.ts +2 -0
  77. package/esm/components/InputJSONSchema.js +7 -0
  78. package/esm/components/InputTable.js +176 -0
  79. package/esm/components/JSONSchemaEditor.d.ts +2 -0
  80. package/esm/components/JSONSchemaEditor.js +7 -0
  81. package/esm/components/Layout.js +60 -0
  82. package/esm/components/Link.js +44 -0
  83. package/esm/components/ListGroup.js +31 -0
  84. package/esm/components/ListMenu.js +62 -0
  85. package/esm/components/LocationPicker.js +208 -0
  86. package/esm/components/Markdown.d.ts +25 -0
  87. package/esm/components/Markdown.js +70 -0
  88. package/esm/components/Menu.d.ts +2 -0
  89. package/esm/components/Menu.js +7 -0
  90. package/esm/components/MixedInput.js +88 -0
  91. package/esm/components/MobileDevTool.d.ts +12 -0
  92. package/esm/components/MobileDevTool.js +312 -0
  93. package/esm/components/Modal.js +261 -0
  94. package/esm/components/ModalManager.d.ts +16 -0
  95. package/esm/components/ModalManager.js +42 -0
  96. package/esm/components/MultilineText.js +90 -0
  97. package/esm/components/NumberInput.js +274 -0
  98. package/esm/components/OverflowTpl.js +100 -0
  99. package/esm/components/Pagination.js +377 -0
  100. package/esm/components/PdfViewer.js +83 -0
  101. package/esm/components/Picker.js +73 -0
  102. package/esm/components/PickerColumn.js +276 -0
  103. package/esm/components/PickerContainer.js +157 -0
  104. package/esm/components/PopOverContainer.d.ts +59 -0
  105. package/esm/components/PopOverContainer.js +148 -0
  106. package/esm/components/PopUp.js +85 -0
  107. package/esm/components/Progress.js +136 -0
  108. package/esm/components/PullRefresh.js +172 -0
  109. package/esm/components/Radios.js +129 -0
  110. package/esm/components/Range.js +516 -0
  111. package/esm/components/Rating.js +341 -0
  112. package/esm/components/ResultBox.js +195 -0
  113. package/esm/components/ResultList.js +253 -0
  114. package/esm/components/ResultTableList.js +152 -0
  115. package/esm/components/ResultTreeList.js +241 -0
  116. package/esm/components/RichText.d.ts +48 -0
  117. package/esm/components/RichText.js +271 -0
  118. package/esm/components/SearchBox.js +298 -0
  119. package/esm/components/Select.js +814 -0
  120. package/esm/components/SelectMobile.d.ts +38 -0
  121. package/esm/components/SelectMobile.js +369 -0
  122. package/esm/components/Selection.js +166 -0
  123. package/esm/components/Shape.js +429 -0
  124. package/esm/components/Signature.js +294 -0
  125. package/esm/components/Slider.js +140 -0
  126. package/esm/components/SparkLine.js +62 -0
  127. package/esm/components/Spinner.js +202 -0
  128. package/esm/components/Steps.js +76 -0
  129. package/esm/components/Switch.js +73 -0
  130. package/esm/components/Tab.d.ts +2 -0
  131. package/esm/components/Tab.js +7 -0
  132. package/esm/components/Table.d.ts +2 -0
  133. package/esm/components/Table.js +7 -0
  134. package/esm/components/TableSelection.js +169 -0
  135. package/esm/components/Tabs.js +607 -0
  136. package/esm/components/TabsTransfer.js +221 -0
  137. package/esm/components/TabsTransferPicker.js +81 -0
  138. package/esm/components/Tag.js +137 -0
  139. package/esm/components/Textarea.js +146 -0
  140. package/esm/components/Timeline.js +60 -0
  141. package/esm/components/TimelineItem.js +101 -0
  142. package/esm/components/Tinymce.d.ts +66 -0
  143. package/esm/components/Tinymce.js +634 -0
  144. package/esm/components/TitleBar.js +48 -0
  145. package/esm/components/Toast.js +247 -0
  146. package/esm/components/Tooltip.js +36 -0
  147. package/esm/components/TooltipWrapper.js +180 -0
  148. package/esm/components/Transfer.js +485 -0
  149. package/esm/components/TransferDropDown.js +98 -0
  150. package/esm/components/TransferPicker.js +98 -0
  151. package/esm/components/TransferSearch.js +100 -0
  152. package/esm/components/Tree.js +1256 -0
  153. package/esm/components/TreeSelection.js +201 -0
  154. package/esm/components/UserSelect.js +674 -0
  155. package/esm/components/UserTabSelect.js +227 -0
  156. package/esm/components/VerificationCode.js +172 -0
  157. package/esm/components/VirtualList.d.ts +2 -0
  158. package/esm/components/VirtualList.js +7 -0
  159. package/esm/components/WithRemoteConfig.d.ts +70 -0
  160. package/esm/components/WithRemoteConfig.js +301 -0
  161. package/esm/components/WithStore.d.ts +13 -0
  162. package/esm/components/WithStore.js +48 -0
  163. package/esm/components/calendar/Calendar.d.ts +83 -0
  164. package/esm/components/calendar/Calendar.js +529 -0
  165. package/esm/components/calendar/CalendarContainer.d.ts +10 -0
  166. package/esm/components/calendar/CalendarContainer.js +27 -0
  167. package/esm/components/calendar/DaysView.js +528 -0
  168. package/esm/components/calendar/MonthsView.js +175 -0
  169. package/esm/components/calendar/QuartersView.js +125 -0
  170. package/esm/components/calendar/TimeView.js +559 -0
  171. package/esm/components/calendar/YearsView.js +122 -0
  172. package/esm/components/condition-builder/Expression.js +121 -0
  173. package/esm/components/condition-builder/Field.js +32 -0
  174. package/esm/components/condition-builder/Func.js +75 -0
  175. package/esm/components/condition-builder/Group.js +196 -0
  176. package/esm/components/condition-builder/GroupOrItem.js +107 -0
  177. package/esm/components/condition-builder/InputSwitch.js +28 -0
  178. package/esm/components/condition-builder/Item.js +233 -0
  179. package/esm/components/condition-builder/Value.js +115 -0
  180. package/esm/components/condition-builder/config.d.ts +36 -0
  181. package/esm/components/condition-builder/config.js +120 -0
  182. package/esm/components/condition-builder/index.js +242 -0
  183. package/esm/components/condition-builder/types.d.ts +116 -0
  184. package/esm/components/formula/CodeEditor.js +99 -0
  185. package/esm/components/formula/Editor.js +446 -0
  186. package/esm/components/formula/FuncList.js +64 -0
  187. package/esm/components/formula/Input.js +141 -0
  188. package/esm/components/formula/Picker.js +454 -0
  189. package/esm/components/formula/VariableList.js +185 -0
  190. package/esm/components/formula/plugin.d.ts +51 -0
  191. package/esm/components/formula/plugin.js +445 -0
  192. package/esm/components/icons.d.ts +61 -0
  193. package/esm/components/icons.js +458 -0
  194. package/esm/components/index.d.ts +138 -0
  195. package/esm/components/json-schema/Array.d.ts +3 -0
  196. package/esm/components/json-schema/Array.js +129 -0
  197. package/esm/components/json-schema/Item.d.ts +5 -0
  198. package/esm/components/json-schema/Item.js +63 -0
  199. package/esm/components/json-schema/Object.d.ts +5 -0
  200. package/esm/components/json-schema/Object.js +272 -0
  201. package/esm/components/json-schema/index.js +29 -0
  202. package/esm/components/menu/MenuContext.d.ts +82 -0
  203. package/esm/components/menu/MenuContext.js +25 -0
  204. package/esm/components/menu/MenuItem.js +112 -0
  205. package/esm/components/menu/PanelMenu.js +68 -0
  206. package/esm/components/menu/SubMenu.js +137 -0
  207. package/esm/components/menu/index.js +368 -0
  208. package/esm/components/schema-editor/Array.d.ts +11 -0
  209. package/esm/components/schema-editor/Array.js +84 -0
  210. package/esm/components/schema-editor/Common.d.ts +61 -0
  211. package/esm/components/schema-editor/Common.js +162 -0
  212. package/esm/components/schema-editor/Item.d.ts +8 -0
  213. package/esm/components/schema-editor/Item.js +24 -0
  214. package/esm/components/schema-editor/Object.d.ts +51 -0
  215. package/esm/components/schema-editor/Object.js +294 -0
  216. package/esm/components/schema-editor/SchemaVariableList.js +74 -0
  217. package/esm/components/schema-editor/SchemaVariableListPicker.js +34 -0
  218. package/esm/components/schema-editor/index.js +122 -0
  219. package/esm/components/table/Cell.d.ts +36 -0
  220. package/esm/components/table/Cell.js +43 -0
  221. package/esm/components/table/ColGroup.d.ts +24 -0
  222. package/esm/components/table/ColGroup.js +77 -0
  223. package/esm/components/table/Head.d.ts +45 -0
  224. package/esm/components/table/Head.js +150 -0
  225. package/esm/components/table/HeadCellDropDown.js +54 -0
  226. package/esm/components/table/HeadCellFilter.js +130 -0
  227. package/esm/components/table/HeadCellSelect.js +51 -0
  228. package/esm/components/table/HeadCellSort.js +88 -0
  229. package/esm/components/table/ItemActionsWrapper.d.ts +10 -0
  230. package/esm/components/table/ItemActionsWrapper.js +29 -0
  231. package/esm/components/table/Row.d.ts +56 -0
  232. package/esm/components/table/Row.js +224 -0
  233. package/esm/components/table/SummaryRow.d.ts +28 -0
  234. package/esm/components/table/SummaryRow.js +73 -0
  235. package/esm/components/table/index.js +1095 -0
  236. package/esm/components/table/util.d.ts +25 -0
  237. package/esm/components/table/util.js +279 -0
  238. package/esm/components/virtual-list/AutoSizer.d.ts +19 -0
  239. package/esm/components/virtual-list/AutoSizer.js +48 -0
  240. package/esm/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
  241. package/esm/components/virtual-list/SizeAndPositionManager.js +216 -0
  242. package/esm/components/virtual-list/constants.d.ts +34 -0
  243. package/esm/components/virtual-list/constants.js +45 -0
  244. package/esm/components/virtual-list/index.d.ts +98 -0
  245. package/esm/components/virtual-list/index.js +288 -0
  246. package/esm/components/withBadge.d.ts +2 -0
  247. package/esm/components/withBadge.js +7 -0
  248. package/esm/hooks/index.d.ts +8 -0
  249. package/esm/hooks/use-click-away.d.ts +12 -0
  250. package/esm/hooks/use-click-away.js +55 -0
  251. package/esm/hooks/use-on-screen.d.ts +2 -0
  252. package/esm/hooks/use-on-screen.js +28 -0
  253. package/esm/hooks/use-set-state.d.ts +2 -0
  254. package/esm/hooks/use-set-state.js +19 -0
  255. package/esm/hooks/use-sub-form.d.ts +4 -0
  256. package/esm/hooks/use-sub-form.js +39 -0
  257. package/esm/hooks/use-touch.d.ts +16 -0
  258. package/esm/hooks/use-touch.js +77 -0
  259. package/esm/hooks/use-update-effect.d.ts +3 -0
  260. package/esm/hooks/use-update-effect.js +21 -0
  261. package/esm/hooks/use-validation-resolver.d.ts +7 -0
  262. package/esm/hooks/use-validation-resolver.js +115 -0
  263. package/esm/icons/alert-danger.svg.js +22 -0
  264. package/esm/icons/alert-info.svg.js +22 -0
  265. package/esm/icons/alert-success.svg.js +22 -0
  266. package/esm/icons/alert-warning.svg.js +22 -0
  267. package/esm/icons/arrow-double-left.svg.js +24 -0
  268. package/esm/icons/arrow-double-right.svg.js +24 -0
  269. package/esm/icons/back.svg.js +21 -0
  270. package/esm/icons/calendar.svg.js +31 -0
  271. package/esm/icons/caret.svg.js +21 -0
  272. package/esm/icons/check.svg.js +21 -0
  273. package/esm/icons/clock.svg.js +29 -0
  274. package/esm/icons/close-small.svg.js +24 -0
  275. package/esm/icons/close.svg.js +21 -0
  276. package/esm/icons/cloud-upload.svg.js +22 -0
  277. package/esm/icons/column-filter.svg.js +22 -0
  278. package/esm/icons/columns.svg.js +21 -0
  279. package/esm/icons/compress-alt.svg.js +21 -0
  280. package/esm/icons/copy.svg.js +26 -0
  281. package/esm/icons/date.svg.js +26 -0
  282. package/esm/icons/department.svg.js +52 -0
  283. package/esm/icons/desk-empty.svg.js +73 -0
  284. package/esm/icons/dot.svg.js +36 -0
  285. package/esm/icons/down-arrow-bold.svg.js +22 -0
  286. package/esm/icons/down.svg.js +23 -0
  287. package/esm/icons/download.svg.js +24 -0
  288. package/esm/icons/drag-bar.svg.js +53 -0
  289. package/esm/icons/drag.svg.js +22 -0
  290. package/esm/icons/edit.svg.js +21 -0
  291. package/esm/icons/ellipsis-v.svg.js +21 -0
  292. package/esm/icons/enter.svg.js +20 -0
  293. package/esm/icons/exchange.svg.js +21 -0
  294. package/esm/icons/expand-alt.svg.js +21 -0
  295. package/esm/icons/fail.svg.js +31 -0
  296. package/esm/icons/file.svg.js +22 -0
  297. package/esm/icons/filter.svg.js +21 -0
  298. package/esm/icons/folder.svg.js +24 -0
  299. package/esm/icons/fullscreen.svg.js +21 -0
  300. package/esm/icons/function.svg.js +21 -0
  301. package/esm/icons/home.svg.js +21 -0
  302. package/esm/icons/if.svg.js +21 -0
  303. package/esm/icons/image.svg.js +20 -0
  304. package/esm/icons/info-circle.svg.js +21 -0
  305. package/esm/icons/info.svg.js +27 -0
  306. package/esm/icons/input-clear.svg.js +20 -0
  307. package/esm/icons/invisible.svg.js +22 -0
  308. package/esm/icons/left-arrow.svg.js +23 -0
  309. package/esm/icons/loading-outline.svg.js +21 -0
  310. package/esm/icons/location.svg.js +20 -0
  311. package/esm/icons/menu.svg.js +20 -0
  312. package/esm/icons/minus.svg.js +21 -0
  313. package/esm/icons/move.svg.js +22 -0
  314. package/esm/icons/mute.svg.js +21 -0
  315. package/esm/icons/new-edit.svg.js +22 -0
  316. package/esm/icons/pause.svg.js +21 -0
  317. package/esm/icons/pencil.svg.js +21 -0
  318. package/esm/icons/play.svg.js +20 -0
  319. package/esm/icons/plus-cicle.svg.js +20 -0
  320. package/esm/icons/plus-fine.svg.js +21 -0
  321. package/esm/icons/plus.svg.js +21 -0
  322. package/esm/icons/post.svg.js +48 -0
  323. package/esm/icons/question-mark.svg.js +26 -0
  324. package/esm/icons/question.svg.js +21 -0
  325. package/esm/icons/question2.svg.js +34 -0
  326. package/esm/icons/redo.svg.js +21 -0
  327. package/esm/icons/refresh.svg.js +21 -0
  328. package/esm/icons/reload.svg.js +21 -0
  329. package/esm/icons/remove.svg.js +21 -0
  330. package/esm/icons/retry.svg.js +24 -0
  331. package/esm/icons/right-arrow-bold.svg.js +21 -0
  332. package/esm/icons/right-arrow.svg.js +23 -0
  333. package/esm/icons/right-double-arrow.svg.js +22 -0
  334. package/esm/icons/role.svg.js +43 -0
  335. package/esm/icons/rotate-left.svg.js +22 -0
  336. package/esm/icons/rotate-right.svg.js +22 -0
  337. package/esm/icons/rotate-screen.svg.js +21 -0
  338. package/esm/icons/scale-origin.svg.js +24 -0
  339. package/esm/icons/schedule.svg.js +24 -0
  340. package/esm/icons/search.svg.js +21 -0
  341. package/esm/icons/setting.svg.js +21 -0
  342. package/esm/icons/slider-handle-icon.svg.js +22 -0
  343. package/esm/icons/sort-asc.svg.js +21 -0
  344. package/esm/icons/sort-default.svg.js +21 -0
  345. package/esm/icons/sort-desc.svg.js +21 -0
  346. package/esm/icons/star.svg.js +21 -0
  347. package/esm/icons/status-close.svg.js +23 -0
  348. package/esm/icons/steps-finsh.svg.js +22 -0
  349. package/esm/icons/sub-plus.svg.js +20 -0
  350. package/esm/icons/success.svg.js +29 -0
  351. package/esm/icons/transparent.svg.js +38 -0
  352. package/esm/icons/trash.svg.js +22 -0
  353. package/esm/icons/tree-down.svg.js +21 -0
  354. package/esm/icons/undo-normal.svg.js +25 -0
  355. package/esm/icons/undo.svg.js +21 -0
  356. package/esm/icons/unfullscreen.svg.js +21 -0
  357. package/esm/icons/upload.svg.js +21 -0
  358. package/esm/icons/user-remove.svg.js +33 -0
  359. package/esm/icons/view.svg.js +22 -0
  360. package/esm/icons/volume.svg.js +24 -0
  361. package/esm/icons/warning-mark.svg.js +22 -0
  362. package/esm/icons/warning.svg.js +21 -0
  363. package/esm/icons/window-restore.svg.js +21 -0
  364. package/esm/icons/zoom-in.svg.js +21 -0
  365. package/esm/icons/zoom-out.svg.js +21 -0
  366. package/esm/index.d.ts +16 -0
  367. package/esm/index.js +157 -0
  368. package/esm/locale/de-DE.d.ts +1 -0
  369. package/esm/locale/de-DE.js +423 -0
  370. package/esm/locale/en-US.d.ts +1 -0
  371. package/esm/locale/en-US.js +429 -0
  372. package/esm/locale/zh-CN.d.ts +1 -0
  373. package/esm/locale/zh-CN.js +438 -0
  374. package/esm/themes/ang.d.ts +3 -0
  375. package/esm/themes/ang.js +15 -0
  376. package/esm/themes/antd.d.ts +1 -0
  377. package/esm/themes/antd.js +42 -0
  378. package/esm/themes/cxd.d.ts +3 -0
  379. package/esm/themes/cxd.js +455 -0
  380. package/esm/themes/dark.d.ts +3 -0
  381. package/esm/themes/dark.js +23 -0
  382. package/esm/themes/default.d.ts +4 -0
  383. package/esm/utils/index.d.ts +2 -0
  384. package/esm/utils/smoothSignature.d.ts +86 -0
  385. package/esm/utils/vectorComputed.d.ts +20 -0
  386. package/esm/utils/vectorComputed.js +75 -0
  387. package/esm/withRemoteConfig.d.ts +2 -0
  388. package/esm/withRemoteConfig.js +7 -0
  389. package/esm/withStore.d.ts +2 -0
  390. package/esm/withStore.js +7 -0
  391. package/lib/HTMLFilterContext.d.ts +3 -0
  392. package/lib/components/AlphabetIndexer.d.ts +11 -0
  393. package/lib/components/AnchorNavSection.d.ts +2 -0
  394. package/lib/components/AutoSizer.d.ts +2 -0
  395. package/lib/components/Badge.d.ts +20 -0
  396. package/lib/components/BarCode.js +44 -0
  397. package/lib/components/CityDB.d.ts +13 -0
  398. package/lib/components/CityDB.js +3945 -0
  399. package/lib/components/CodeMirror.d.ts +29 -0
  400. package/lib/components/ColorPicker.js +267 -0
  401. package/lib/components/ConditionBuilder.d.ts +2 -0
  402. package/lib/components/DiffEditor.d.ts +21 -0
  403. package/lib/components/Form.d.ts +31 -0
  404. package/lib/components/FormulaPicker.d.ts +2 -0
  405. package/lib/components/GridNav.d.ts +53 -0
  406. package/lib/components/GridNavItem.d.ts +2 -0
  407. package/lib/components/HeadCellDropDown.d.ts +2 -0
  408. package/lib/components/HorizontalScroll.d.ts +74 -0
  409. package/lib/components/Icon.d.ts +2 -0
  410. package/lib/components/Input.d.ts +18 -0
  411. package/lib/components/InputJSONSchema.d.ts +2 -0
  412. package/lib/components/JSONSchemaEditor.d.ts +2 -0
  413. package/lib/components/Markdown.d.ts +25 -0
  414. package/lib/components/Markdown.js +76 -0
  415. package/lib/components/Menu.d.ts +2 -0
  416. package/lib/components/MobileDevTool.d.ts +12 -0
  417. package/lib/components/ModalManager.d.ts +16 -0
  418. package/lib/components/PdfViewer.js +83 -0
  419. package/lib/components/PopOverContainer.d.ts +59 -0
  420. package/lib/components/RichText.d.ts +48 -0
  421. package/lib/components/RichText.js +275 -0
  422. package/lib/components/SelectMobile.d.ts +38 -0
  423. package/lib/components/Tab.d.ts +2 -0
  424. package/lib/components/Table.d.ts +2 -0
  425. package/lib/components/Tinymce.d.ts +66 -0
  426. package/lib/components/Tinymce.js +641 -0
  427. package/lib/components/VirtualList.d.ts +2 -0
  428. package/lib/components/WithRemoteConfig.d.ts +70 -0
  429. package/lib/components/WithStore.d.ts +13 -0
  430. package/lib/components/calendar/Calendar.d.ts +83 -0
  431. package/lib/components/calendar/CalendarContainer.d.ts +10 -0
  432. package/lib/components/condition-builder/config.d.ts +36 -0
  433. package/lib/components/condition-builder/types.d.ts +116 -0
  434. package/lib/components/formula/plugin.d.ts +51 -0
  435. package/lib/components/icons.d.ts +61 -0
  436. package/lib/components/index.d.ts +138 -0
  437. package/lib/components/json-schema/Array.d.ts +3 -0
  438. package/lib/components/json-schema/Item.d.ts +5 -0
  439. package/lib/components/json-schema/Object.d.ts +5 -0
  440. package/lib/components/menu/MenuContext.d.ts +82 -0
  441. package/lib/components/schema-editor/Array.d.ts +11 -0
  442. package/lib/components/schema-editor/Common.d.ts +61 -0
  443. package/lib/components/schema-editor/Item.d.ts +8 -0
  444. package/lib/components/schema-editor/Object.d.ts +51 -0
  445. package/lib/components/table/Cell.d.ts +36 -0
  446. package/lib/components/table/ColGroup.d.ts +24 -0
  447. package/lib/components/table/Head.d.ts +45 -0
  448. package/lib/components/table/ItemActionsWrapper.d.ts +10 -0
  449. package/lib/components/table/Row.d.ts +56 -0
  450. package/lib/components/table/SummaryRow.d.ts +28 -0
  451. package/lib/components/table/util.d.ts +25 -0
  452. package/lib/components/virtual-list/AutoSizer.d.ts +19 -0
  453. package/lib/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
  454. package/lib/components/virtual-list/constants.d.ts +34 -0
  455. package/lib/components/virtual-list/index.d.ts +98 -0
  456. package/lib/components/withBadge.d.ts +2 -0
  457. package/lib/helper.css +47762 -0
  458. package/lib/hooks/index.d.ts +8 -0
  459. package/lib/hooks/use-click-away.d.ts +12 -0
  460. package/lib/hooks/use-on-screen.d.ts +2 -0
  461. package/lib/hooks/use-set-state.d.ts +2 -0
  462. package/lib/hooks/use-sub-form.d.ts +4 -0
  463. package/lib/hooks/use-touch.d.ts +16 -0
  464. package/lib/hooks/use-update-effect.d.ts +3 -0
  465. package/lib/hooks/use-validation-resolver.d.ts +7 -0
  466. package/lib/index.d.ts +16 -0
  467. package/lib/index.js +28 -0
  468. package/lib/locale/de-DE.d.ts +1 -0
  469. package/lib/locale/en-US.d.ts +1 -0
  470. package/lib/locale/zh-CN.d.ts +1 -0
  471. package/lib/scss/helper.scss.js +12 -0
  472. package/lib/scss/themes/ang.scss.js +12 -0
  473. package/lib/scss/themes/antd.scss.js +12 -0
  474. package/lib/scss/themes/cxd.scss.js +12 -0
  475. package/lib/scss/themes/dark.scss.js +12 -0
  476. package/lib/scss/themes/default.scss.js +12 -0
  477. package/lib/themes/ang.css +45895 -0
  478. package/lib/themes/ang.d.ts +3 -0
  479. package/lib/themes/antd.css +45882 -0
  480. package/lib/themes/antd.d.ts +1 -0
  481. package/lib/themes/cxd.css +45871 -0
  482. package/lib/themes/cxd.d.ts +3 -0
  483. package/lib/themes/dark.css +45902 -0
  484. package/lib/themes/dark.d.ts +3 -0
  485. package/lib/themes/default.css +45871 -0
  486. package/lib/themes/default.d.ts +4 -0
  487. package/lib/utils/index.d.ts +2 -0
  488. package/lib/utils/smoothSignature.d.ts +86 -0
  489. package/lib/utils/vectorComputed.d.ts +20 -0
  490. package/lib/withRemoteConfig.d.ts +2 -0
  491. package/lib/withStore.d.ts +2 -0
  492. package/package.json +158 -0
  493. package/scss/README.md +9 -0
  494. package/scss/_components.scss +4346 -0
  495. package/scss/_functions.scss +137 -0
  496. package/scss/_mixins.scss +805 -0
  497. package/scss/_properties.scss +898 -0
  498. package/scss/_thirds.scss +12 -0
  499. package/scss/_utilities.scss +1757 -0
  500. package/scss/_variables.scss +439 -0
  501. package/scss/base/_animate.scss +84 -0
  502. package/scss/base/_common.scss +19 -0
  503. package/scss/base/_normalize.scss +376 -0
  504. package/scss/base/_reset.scss +18 -0
  505. package/scss/base/_typography.scss +79 -0
  506. package/scss/components/_alert.scss +123 -0
  507. package/scss/components/_anchor-nav.scss +158 -0
  508. package/scss/components/_app.scss +46 -0
  509. package/scss/components/_array-input.scss +107 -0
  510. package/scss/components/_audio.scss +146 -0
  511. package/scss/components/_auto-folder.scss +40 -0
  512. package/scss/components/_avatar.scss +55 -0
  513. package/scss/components/_badge.scss +145 -0
  514. package/scss/components/_barcode.scss +6 -0
  515. package/scss/components/_breadcrumb.scss +110 -0
  516. package/scss/components/_button-group.scss +165 -0
  517. package/scss/components/_button.scss +871 -0
  518. package/scss/components/_calendar.scss +442 -0
  519. package/scss/components/_card.scss +389 -0
  520. package/scss/components/_card2.scss +28 -0
  521. package/scss/components/_cards.scss +221 -0
  522. package/scss/components/_carousel.scss +292 -0
  523. package/scss/components/_cascader.scss +157 -0
  524. package/scss/components/_chart.scss +22 -0
  525. package/scss/components/_city-area.scss +37 -0
  526. package/scss/components/_code.scss +10 -0
  527. package/scss/components/_collapse-group.scss +83 -0
  528. package/scss/components/_collapse.scss +245 -0
  529. package/scss/components/_color.scss +17 -0
  530. package/scss/components/_column-toggler.scss +261 -0
  531. package/scss/components/_condition-builder.scss +521 -0
  532. package/scss/components/_context-menu.scss +204 -0
  533. package/scss/components/_copyable.scss +10 -0
  534. package/scss/components/_crud.scss +195 -0
  535. package/scss/components/_crud2.scss +345 -0
  536. package/scss/components/_debug.scss +259 -0
  537. package/scss/components/_divider.scss +81 -0
  538. package/scss/components/_drawer.scss +393 -0
  539. package/scss/components/_dropdown-context-menus.scss +27 -0
  540. package/scss/components/_dropdown.scss +159 -0
  541. package/scss/components/_each.scss +7 -0
  542. package/scss/components/_formula.scss +723 -0
  543. package/scss/components/_grid-nav.scss +128 -0
  544. package/scss/components/_horizontal-scroll.scss +51 -0
  545. package/scss/components/_icon.scss +4 -0
  546. package/scss/components/_image-gallery.scss +331 -0
  547. package/scss/components/_images.scss +650 -0
  548. package/scss/components/_input-box.scss +111 -0
  549. package/scss/components/_json-schema-editor.scss +149 -0
  550. package/scss/components/_json-schema.scss +166 -0
  551. package/scss/components/_json.scss +7 -0
  552. package/scss/components/_link.scss +22 -0
  553. package/scss/components/_list-menu.scss +114 -0
  554. package/scss/components/_list.scss +313 -0
  555. package/scss/components/_log.scss +169 -0
  556. package/scss/components/_mapping.scss +6 -0
  557. package/scss/components/_markdown.scss +266 -0
  558. package/scss/components/_menu.scss +795 -0
  559. package/scss/components/_mobile-dev-tool.scss +175 -0
  560. package/scss/components/_modal.scss +282 -0
  561. package/scss/components/_multiline-text.scss +20 -0
  562. package/scss/components/_nav.scss +45 -0
  563. package/scss/components/_overflow-tpl.scss +5 -0
  564. package/scss/components/_page.scss +198 -0
  565. package/scss/components/_pagination.scss +403 -0
  566. package/scss/components/_panel.scss +263 -0
  567. package/scss/components/_pdf_viewer.scss +47 -0
  568. package/scss/components/_picker-columns.scss +140 -0
  569. package/scss/components/_popover.scss +54 -0
  570. package/scss/components/_popoverable.scss +100 -0
  571. package/scss/components/_popup.scss +171 -0
  572. package/scss/components/_portlet.scss +51 -0
  573. package/scss/components/_print.scss +13 -0
  574. package/scss/components/_progress.scss +165 -0
  575. package/scss/components/_property.scss +47 -0
  576. package/scss/components/_pull-refresh.scss +30 -0
  577. package/scss/components/_quick-edit.scss +53 -0
  578. package/scss/components/_remark.scss +58 -0
  579. package/scss/components/_result-box.scss +380 -0
  580. package/scss/components/_search-box.scss +267 -0
  581. package/scss/components/_service.scss +3 -0
  582. package/scss/components/_shape.scss +19 -0
  583. package/scss/components/_signature.scss +98 -0
  584. package/scss/components/_slider.scss +27 -0
  585. package/scss/components/_sparkline.scss +18 -0
  586. package/scss/components/_spinner.scss +214 -0
  587. package/scss/components/_status.scss +118 -0
  588. package/scss/components/_steps.scss +481 -0
  589. package/scss/components/_table.scss +1234 -0
  590. package/scss/components/_table2.scss +1066 -0
  591. package/scss/components/_tabs.scss +1410 -0
  592. package/scss/components/_tag.scss +191 -0
  593. package/scss/components/_timeline.scss +572 -0
  594. package/scss/components/_toast.scss +342 -0
  595. package/scss/components/_tooltip.scss +340 -0
  596. package/scss/components/_tpl.scss +51 -0
  597. package/scss/components/_verificationCode.scss +33 -0
  598. package/scss/components/_video.scss +38 -0
  599. package/scss/components/_wizard.scss +287 -0
  600. package/scss/components/_wrapper.scss +26 -0
  601. package/scss/components/form/_chained-select.scss +10 -0
  602. package/scss/components/form/_checks.scss +433 -0
  603. package/scss/components/form/_city.scss +33 -0
  604. package/scss/components/form/_color.scss +148 -0
  605. package/scss/components/form/_combo.scss +360 -0
  606. package/scss/components/form/_date-range.scss +332 -0
  607. package/scss/components/form/_date.scss +807 -0
  608. package/scss/components/form/_editor.scss +139 -0
  609. package/scss/components/form/_excel.scss +150 -0
  610. package/scss/components/form/_fieldset.scss +202 -0
  611. package/scss/components/form/_file.scss +308 -0
  612. package/scss/components/form/_form.scss +936 -0
  613. package/scss/components/form/_group.scss +116 -0
  614. package/scss/components/form/_icon-picker.scss +113 -0
  615. package/scss/components/form/_icon-select.scss +245 -0
  616. package/scss/components/form/_image.scss +359 -0
  617. package/scss/components/form/_input-group.scss +213 -0
  618. package/scss/components/form/_input-table.scss +17 -0
  619. package/scss/components/form/_list.scss +225 -0
  620. package/scss/components/form/_location.scss +210 -0
  621. package/scss/components/form/_matrix.scss +7 -0
  622. package/scss/components/form/_nested-select.scss +149 -0
  623. package/scss/components/form/_number.scss +633 -0
  624. package/scss/components/form/_picker.scss +237 -0
  625. package/scss/components/form/_qr-code.scss +4 -0
  626. package/scss/components/form/_range.scss +438 -0
  627. package/scss/components/form/_rating.scss +94 -0
  628. package/scss/components/form/_repeat.scss +40 -0
  629. package/scss/components/form/_result-list.scss +98 -0
  630. package/scss/components/form/_rich-text.scss +163 -0
  631. package/scss/components/form/_select.scss +712 -0
  632. package/scss/components/form/_selection.scss +485 -0
  633. package/scss/components/form/_sub-form.scss +118 -0
  634. package/scss/components/form/_switch.scss +228 -0
  635. package/scss/components/form/_tag.scss +146 -0
  636. package/scss/components/form/_text.scss +508 -0
  637. package/scss/components/form/_textarea.scss +78 -0
  638. package/scss/components/form/_tinymce.scss +6 -0
  639. package/scss/components/form/_transfer.scss +624 -0
  640. package/scss/components/form/_tree-select.scss +47 -0
  641. package/scss/components/form/_tree.scss +458 -0
  642. package/scss/components/form/_user-select.scss +643 -0
  643. package/scss/components/react-datetime.scss +267 -0
  644. package/scss/helper/background/_background-color.md +131 -0
  645. package/scss/helper/background/_background-color.scss +214 -0
  646. package/scss/helper/border/_border-color.md +109 -0
  647. package/scss/helper/border/_border-color.scss +178 -0
  648. package/scss/helper/border/_border-radius.md +86 -0
  649. package/scss/helper/border/_border-radius.scss +152 -0
  650. package/scss/helper/border/_border-style.md +11 -0
  651. package/scss/helper/border/_border-style.scss +40 -0
  652. package/scss/helper/border/_border-width.md +31 -0
  653. package/scss/helper/border/_border-width.scss +72 -0
  654. package/scss/helper/box-alignment/_align-content.md +12 -0
  655. package/scss/helper/box-alignment/_align-content.scss +44 -0
  656. package/scss/helper/box-alignment/_align-items.md +11 -0
  657. package/scss/helper/box-alignment/_align-items.scss +41 -0
  658. package/scss/helper/box-alignment/_align-self.md +11 -0
  659. package/scss/helper/box-alignment/_align-self.scss +40 -0
  660. package/scss/helper/box-alignment/_justify-content.md +12 -0
  661. package/scss/helper/box-alignment/_justify-content.scss +44 -0
  662. package/scss/helper/box-alignment/_justify-items.md +11 -0
  663. package/scss/helper/box-alignment/_justify-items.scss +40 -0
  664. package/scss/helper/box-alignment/_justify-self.md +11 -0
  665. package/scss/helper/box-alignment/_justify-self.scss +40 -0
  666. package/scss/helper/box-alignment/_place-content.md +13 -0
  667. package/scss/helper/box-alignment/_place-content.scss +48 -0
  668. package/scss/helper/box-alignment/_place-items.md +11 -0
  669. package/scss/helper/box-alignment/_place-items.scss +40 -0
  670. package/scss/helper/box-alignment/_place-self.md +11 -0
  671. package/scss/helper/box-alignment/_place-self.scss +40 -0
  672. package/scss/helper/effect/_box-shadow.md +16 -0
  673. package/scss/helper/effect/_box-shadow.scss +74 -0
  674. package/scss/helper/effect/_opacity.md +21 -0
  675. package/scss/helper/effect/_opacity.scss +66 -0
  676. package/scss/helper/flex/_direction.md +10 -0
  677. package/scss/helper/flex/_direction.scss +41 -0
  678. package/scss/helper/flex/_flex.md +10 -0
  679. package/scss/helper/flex/_flex.scss +38 -0
  680. package/scss/helper/flex/_grow.md +8 -0
  681. package/scss/helper/flex/_grow.scss +28 -0
  682. package/scss/helper/flex/_order.md +20 -0
  683. package/scss/helper/flex/_order.scss +56 -0
  684. package/scss/helper/flex/_shrink.md +8 -0
  685. package/scss/helper/flex/_shrink.scss +27 -0
  686. package/scss/helper/flex/_wrap.md +9 -0
  687. package/scss/helper/flex/_wrap.scss +36 -0
  688. package/scss/helper/grid/_auto-columns.md +10 -0
  689. package/scss/helper/grid/_auto-columns.scss +38 -0
  690. package/scss/helper/grid/_auto-flow.md +10 -0
  691. package/scss/helper/grid/_auto-flow.scss +38 -0
  692. package/scss/helper/grid/_auto-rows.md +10 -0
  693. package/scss/helper/grid/_auto-rows.scss +38 -0
  694. package/scss/helper/grid/_column-start-end.md +48 -0
  695. package/scss/helper/grid/_column-start-end.scss +201 -0
  696. package/scss/helper/grid/_columns.md +19 -0
  697. package/scss/helper/grid/_columns.scss +74 -0
  698. package/scss/helper/grid/_gap.md +117 -0
  699. package/scss/helper/grid/_gap.scss +154 -0
  700. package/scss/helper/grid/_row-start-end.md +48 -0
  701. package/scss/helper/grid/_row-start-end.scss +201 -0
  702. package/scss/helper/grid/_rows.md +13 -0
  703. package/scss/helper/grid/_rows.scss +50 -0
  704. package/scss/helper/layout/_box-sizing.md +35 -0
  705. package/scss/helper/layout/_box-sizing.scss +51 -0
  706. package/scss/helper/layout/_clear.md +27 -0
  707. package/scss/helper/layout/_clear.scss +56 -0
  708. package/scss/helper/layout/_display.md +41 -0
  709. package/scss/helper/layout/_display.scss +82 -0
  710. package/scss/helper/layout/_float.md +47 -0
  711. package/scss/helper/layout/_float.scss +71 -0
  712. package/scss/helper/layout/_overflow.md +34 -0
  713. package/scss/helper/layout/_overflow.scss +85 -0
  714. package/scss/helper/layout/_position.md +27 -0
  715. package/scss/helper/layout/_position.scss +55 -0
  716. package/scss/helper/layout/_top-right-bottom-left.md +150 -0
  717. package/scss/helper/layout/_top-right-bottom-left.scss +292 -0
  718. package/scss/helper/layout/_visibility.md +21 -0
  719. package/scss/helper/layout/_visibility.scss +42 -0
  720. package/scss/helper/layout/_z-index.md +37 -0
  721. package/scss/helper/layout/_z-index.scss +67 -0
  722. package/scss/helper/sizing/_height.md +103 -0
  723. package/scss/helper/sizing/_height.scss +161 -0
  724. package/scss/helper/sizing/_width.md +109 -0
  725. package/scss/helper/sizing/_width.scss +174 -0
  726. package/scss/helper/spacing/_margin.md +527 -0
  727. package/scss/helper/spacing/_margin.scss +821 -0
  728. package/scss/helper/spacing/_padding.md +265 -0
  729. package/scss/helper/spacing/_padding.scss +394 -0
  730. package/scss/helper/spacing/_space-between.md +155 -0
  731. package/scss/helper/spacing/_space-between.scss +224 -0
  732. package/scss/helper/typography/_font-family.md +9 -0
  733. package/scss/helper/typography/_font-family.scss +28 -0
  734. package/scss/helper/typography/_font-size.md +19 -0
  735. package/scss/helper/typography/_font-size.scss +40 -0
  736. package/scss/helper/typography/_font-style.md +8 -0
  737. package/scss/helper/typography/_font-style.scss +31 -0
  738. package/scss/helper/typography/_font-weight.md +15 -0
  739. package/scss/helper/typography/_font-weight.scss +49 -0
  740. package/scss/helper/typography/_letter-spacing.md +12 -0
  741. package/scss/helper/typography/_letter-spacing.scss +43 -0
  742. package/scss/helper/typography/_line-height.md +20 -0
  743. package/scss/helper/typography/_line-height.scss +59 -0
  744. package/scss/helper/typography/_list-style-type.md +11 -0
  745. package/scss/helper/typography/_list-style-type.scss +43 -0
  746. package/scss/helper/typography/_text-align.md +10 -0
  747. package/scss/helper/typography/_text-align.scss +34 -0
  748. package/scss/helper/typography/_text-color.md +110 -0
  749. package/scss/helper/typography/_text-color.scss +184 -0
  750. package/scss/helper/typography/_text-decoration.md +9 -0
  751. package/scss/helper/typography/_text-decoration.scss +34 -0
  752. package/scss/helper/typography/_text-overflow.md +9 -0
  753. package/scss/helper/typography/_text-overflow.scss +40 -0
  754. package/scss/helper/typography/_text-transform.md +10 -0
  755. package/scss/helper/typography/_text-transform.scss +40 -0
  756. package/scss/helper/typography/_vertical-align.md +12 -0
  757. package/scss/helper/typography/_vertical-align.scss +44 -0
  758. package/scss/helper/typography/_whitespace.md +11 -0
  759. package/scss/helper/typography/_whitespace.scss +42 -0
  760. package/scss/helper/typography/_word-break.md +9 -0
  761. package/scss/helper/typography/_word-break.scss +36 -0
  762. package/scss/helper.scss +72 -0
  763. package/scss/layout/_aside.scss +361 -0
  764. package/scss/layout/_grid.scss +173 -0
  765. package/scss/layout/_hbox.scss +127 -0
  766. package/scss/layout/_header.scss +0 -0
  767. package/scss/layout/_layout.scss +492 -0
  768. package/scss/layout/_vbox.scss +38 -0
  769. package/scss/themes/_ang-variables.scss +224 -0
  770. package/scss/themes/_antd-variables.scss +238 -0
  771. package/scss/themes/_common.scss +157 -0
  772. package/scss/themes/_cxd-variables.scss +222 -0
  773. package/scss/themes/_dark-variables.scss +229 -0
  774. package/scss/themes/ang-ie11.scss +1 -0
  775. package/scss/themes/ang.scss +27 -0
  776. package/scss/themes/antd-ie11.scss +1 -0
  777. package/scss/themes/antd.scss +5 -0
  778. package/scss/themes/cxd-ie11.scss +1 -0
  779. package/scss/themes/cxd.scss +5 -0
  780. package/scss/themes/dark-ie11.scss +1 -0
  781. package/scss/themes/dark.scss +34 -0
  782. package/scss/themes/default.scss +2 -0
  783. package/scss/themes/extract-antd-color.py +27 -0
@@ -0,0 +1,1385 @@
1
+ /**
2
+ * amis-rev-ui v6.13.0
3
+ * Copyright 2018-2026 fex
4
+ */
5
+
6
+ import { __extends, __assign, __spreadArray, __read, __rest } from 'tslib';
7
+ import React__default from 'react';
8
+ import { filterDate, str2function, noop, isExpression, FormulaExec, getComputedStyle, ucFirst, Overlay, findDomCompat, PopOver, themeable, localeable } from 'amis-rev-core';
9
+ import moment from 'moment';
10
+ import omit from 'lodash/omit';
11
+ import kebabCase from 'lodash/kebabCase';
12
+ import { Icon } from './icons.js';
13
+ import Calendar from './calendar/Calendar.js';
14
+ import PopUp from './PopUp.js';
15
+ import CalendarMobile from './CalendarMobile.js';
16
+ import Input from './Input.js';
17
+ import Button from './Button.js';
18
+
19
+ /**
20
+ * @file DateRangePicker
21
+ * @description 自定义日期范围时间选择器组件
22
+ * @author fex
23
+ */
24
+ var availableShortcuts = {
25
+ 'today': {
26
+ label: 'Date.today',
27
+ startDate: function (now) {
28
+ return now.startOf('day');
29
+ },
30
+ endDate: function (now) {
31
+ return now;
32
+ }
33
+ },
34
+ 'yesterday': {
35
+ label: 'Date.yesterday',
36
+ startDate: function (now) {
37
+ return now.add(-1, 'days').startOf('day');
38
+ },
39
+ endDate: function (now) {
40
+ return now.add(-1, 'days').endOf('day');
41
+ }
42
+ },
43
+ 'tomorrow': {
44
+ label: 'Date.tomorrow',
45
+ startDate: function (now) {
46
+ return now.add(1, 'days').startOf('day');
47
+ },
48
+ endDate: function (now) {
49
+ return now.add(1, 'days').endOf('day');
50
+ }
51
+ },
52
+ // 兼容一下错误的用法
53
+ '1daysago': {
54
+ label: 'DateRange.1daysago',
55
+ startDate: function (now) {
56
+ return now.add(-1, 'days');
57
+ },
58
+ endDate: function (now) {
59
+ return now;
60
+ }
61
+ },
62
+ '1dayago': {
63
+ label: 'DateRange.1daysago',
64
+ startDate: function (now) {
65
+ return now.add(-1, 'days');
66
+ },
67
+ endDate: function (now) {
68
+ return now;
69
+ }
70
+ },
71
+ '7daysago': {
72
+ label: 'DateRange.7daysago',
73
+ startDate: function (now) {
74
+ return now.add(-7, 'days').startOf('day');
75
+ },
76
+ endDate: function (now) {
77
+ return now.add(-1, 'days').endOf('day');
78
+ }
79
+ },
80
+ '30daysago': {
81
+ label: 'DateRange.30daysago',
82
+ startDate: function (now) {
83
+ return now.add(-30, 'days').startOf('day');
84
+ },
85
+ endDate: function (now) {
86
+ return now.add(-1, 'days').endOf('day');
87
+ }
88
+ },
89
+ '90daysago': {
90
+ label: 'DateRange.90daysago',
91
+ startDate: function (now) {
92
+ return now.add(-90, 'days').startOf('day');
93
+ },
94
+ endDate: function (now) {
95
+ return now.add(-1, 'days').endOf('day');
96
+ }
97
+ },
98
+ 'prevweek': {
99
+ label: 'DateRange.lastWeek',
100
+ startDate: function (now) {
101
+ return now.startOf('week').add(-1, 'weeks');
102
+ },
103
+ endDate: function (now) {
104
+ return now.startOf('week').add(-1, 'days').endOf('day');
105
+ }
106
+ },
107
+ 'thisweek': {
108
+ label: 'DateRange.thisWeek',
109
+ startDate: function (now) {
110
+ return now.startOf('week');
111
+ },
112
+ endDate: function (now) {
113
+ return now.endOf('week');
114
+ }
115
+ },
116
+ 'thismonth': {
117
+ label: 'DateRange.thisMonth',
118
+ startDate: function (now) {
119
+ return now.startOf('month');
120
+ },
121
+ endDate: function (now) {
122
+ return now.endOf('month');
123
+ }
124
+ },
125
+ 'thisquarter': {
126
+ label: 'DateRange.thisQuarter',
127
+ startDate: function (now) {
128
+ return now.startOf('quarter');
129
+ },
130
+ endDate: function (now) {
131
+ return now.endOf('quarter');
132
+ }
133
+ },
134
+ 'prevmonth': {
135
+ label: 'DateRange.lastMonth',
136
+ startDate: function (now) {
137
+ return now.startOf('month').add(-1, 'month');
138
+ },
139
+ endDate: function (now) {
140
+ return now.startOf('month').add(-1, 'day').endOf('day');
141
+ }
142
+ },
143
+ 'prevquarter': {
144
+ label: 'DateRange.lastQuarter',
145
+ startDate: function (now) {
146
+ return now.startOf('quarter').add(-1, 'quarter');
147
+ },
148
+ endDate: function (now) {
149
+ return now.startOf('quarter').add(-1, 'day').endOf('day');
150
+ }
151
+ },
152
+ 'thisyear': {
153
+ label: 'DateRange.thisYear',
154
+ startDate: function (now) {
155
+ return now.startOf('year');
156
+ },
157
+ endDate: function (now) {
158
+ return now.endOf('year');
159
+ }
160
+ },
161
+ // 兼容一下之前的用法 'lastYear'
162
+ 'prevyear': {
163
+ label: 'DateRange.lastYear',
164
+ startDate: function (now) {
165
+ return now.startOf('year').add(-1, 'year');
166
+ },
167
+ endDate: function (now) {
168
+ return now.endOf('year').add(-1, 'year').endOf('day');
169
+ }
170
+ },
171
+ 'lastYear': {
172
+ label: 'DateRange.lastYear',
173
+ startDate: function (now) {
174
+ return now.startOf('year').add(-1, 'year');
175
+ },
176
+ endDate: function (now) {
177
+ return now.endOf('year').add(-1, 'year').endOf('day');
178
+ }
179
+ }
180
+ };
181
+ var advancedRanges = [
182
+ {
183
+ regexp: /^(\d+)hoursago$/,
184
+ resolve: function (__, _, hours) {
185
+ return {
186
+ label: __('DateRange.hoursago', { hours: hours }),
187
+ startDate: function (now) {
188
+ return now.add(-hours, 'hours').startOf('hour');
189
+ },
190
+ endDate: function (now) {
191
+ return now.add(-1, 'hours').endOf('hours');
192
+ }
193
+ };
194
+ }
195
+ },
196
+ {
197
+ regexp: /^(\d+)hourslater$/,
198
+ resolve: function (__, _, hours) {
199
+ return {
200
+ label: __('DateRange.hourslater', { hours: hours }),
201
+ startDate: function (now) {
202
+ return now.startOf('hour');
203
+ },
204
+ endDate: function (now) {
205
+ return now.add(hours, 'hours').endOf('hour');
206
+ }
207
+ };
208
+ }
209
+ },
210
+ {
211
+ regexp: /^(\d+)daysago$/,
212
+ resolve: function (__, _, days) {
213
+ return {
214
+ label: __('DateRange.daysago', { days: days }),
215
+ startDate: function (now) {
216
+ return now.add(-days, 'days').startOf('day');
217
+ },
218
+ endDate: function (now) {
219
+ return now.add(-1, 'days').endOf('day');
220
+ }
221
+ };
222
+ }
223
+ },
224
+ {
225
+ regexp: /^(\d+)dayslater$/,
226
+ resolve: function (__, _, days) {
227
+ return {
228
+ label: __('DateRange.dayslater', { days: days }),
229
+ startDate: function (now) {
230
+ return now.startOf('day');
231
+ },
232
+ endDate: function (now) {
233
+ return now.add(days, 'days').endOf('day');
234
+ }
235
+ };
236
+ }
237
+ },
238
+ {
239
+ regexp: /^(\d+)weeksago$/,
240
+ resolve: function (__, _, weeks) {
241
+ return {
242
+ label: __('DateRange.weeksago', { weeks: weeks }),
243
+ startDate: function (now) {
244
+ return now.startOf('week').add(-weeks, 'weeks');
245
+ },
246
+ endDate: function (now) {
247
+ return now.startOf('week').add(-1, 'days').endOf('day');
248
+ }
249
+ };
250
+ }
251
+ },
252
+ {
253
+ regexp: /^(\d+)weekslater$/,
254
+ resolve: function (__, _, weeks) {
255
+ return {
256
+ label: __('DateRange.weekslater', { weeks: weeks }),
257
+ startDate: function (now) {
258
+ return now.startOf('week');
259
+ },
260
+ endDate: function (now) {
261
+ return now.startOf('week').add(weeks, 'weeks').endOf('day');
262
+ }
263
+ };
264
+ }
265
+ },
266
+ {
267
+ regexp: /^(\d+)monthsago$/,
268
+ resolve: function (__, _, months) {
269
+ return {
270
+ label: __('DateRange.monthsago', { months: months }),
271
+ startDate: function (now) {
272
+ return now.startOf('months').add(-months, 'months');
273
+ },
274
+ endDate: function (now) {
275
+ return now.startOf('month').add(-1, 'days').endOf('day');
276
+ }
277
+ };
278
+ }
279
+ },
280
+ {
281
+ regexp: /^(\d+)monthslater$/,
282
+ resolve: function (__, _, months) {
283
+ return {
284
+ label: __('DateRange.monthslater', { months: months }),
285
+ startDate: function (now) {
286
+ return now.startOf('month');
287
+ },
288
+ endDate: function (now) {
289
+ return now.startOf('month').add(months, 'months').endOf('day');
290
+ }
291
+ };
292
+ }
293
+ },
294
+ {
295
+ regexp: /^(\d+)quartersago$/,
296
+ resolve: function (__, _, quarters) {
297
+ return {
298
+ label: __('DateRange.quartersago', { quarters: quarters }),
299
+ startDate: function (now) {
300
+ return now.startOf('quarters').add(-quarters, 'quarters');
301
+ },
302
+ endDate: function (now) {
303
+ return now.startOf('quarter').add(-1, 'days').endOf('day');
304
+ }
305
+ };
306
+ }
307
+ },
308
+ {
309
+ regexp: /^(\d+)quarterslater$/,
310
+ resolve: function (__, _, quarters) {
311
+ return {
312
+ label: __('DateRange.quarterslater', { quarters: quarters }),
313
+ startDate: function (now) {
314
+ return now.startOf('quarter');
315
+ },
316
+ endDate: function (now) {
317
+ return now.startOf('quarter').add(quarters, 'quarters').endOf('day');
318
+ }
319
+ };
320
+ }
321
+ },
322
+ {
323
+ regexp: /^(\d+)yearsago$/,
324
+ resolve: function (__, _, years) {
325
+ return {
326
+ label: __('DateRange.yearsago', { years: years }),
327
+ startDate: function (now) {
328
+ return now.startOf('years').add(-years, 'years');
329
+ },
330
+ endDate: function (now) {
331
+ return now.startOf('year').add(-1, 'days').endOf('day');
332
+ }
333
+ };
334
+ }
335
+ },
336
+ {
337
+ regexp: /^(\d+)yearslater$/,
338
+ resolve: function (__, _, years) {
339
+ return {
340
+ label: __('DateRange.yearslater', { years: years }),
341
+ startDate: function (now) {
342
+ return now.startOf('year');
343
+ },
344
+ endDate: function (now) {
345
+ return now.startOf('year').add(years, 'years').endOf('day');
346
+ }
347
+ };
348
+ }
349
+ }
350
+ ];
351
+ var dateFormats = {
352
+ Y: { format: 'YYYY' },
353
+ Q: { format: 'YYYY [Q]Q' },
354
+ M: { format: 'YYYY-MM' },
355
+ D: { format: 'YYYY-MM-DD' }
356
+ };
357
+ var timeFormats = {
358
+ h: { format: 'HH' },
359
+ H: { format: 'HH' },
360
+ m: { format: 'mm' },
361
+ s: { format: 'ss' },
362
+ S: { format: 'ss' }
363
+ };
364
+ var DateRangePicker = /** @class */ (function (_super) {
365
+ __extends(DateRangePicker, _super);
366
+ function DateRangePicker(props) {
367
+ var _this = _super.call(this, props) || this;
368
+ // 是否是第一次点击,如果是第一次点击就可以点任意地址
369
+ _this.isFirstClick = true;
370
+ _this.nextMonth = moment().add(1, 'months').startOf('day');
371
+ _this.currentMonth = moment().startOf('day');
372
+ _this.startInputRef = React__default.createRef();
373
+ _this.endInputRef = React__default.createRef();
374
+ _this.separatorRef = React__default.createRef();
375
+ _this.calendarRef = React__default.createRef();
376
+ _this.open = _this.open.bind(_this);
377
+ _this.openStart = _this.openStart.bind(_this);
378
+ _this.openEnd = _this.openEnd.bind(_this);
379
+ _this.close = _this.close.bind(_this);
380
+ _this.startInputChange = _this.startInputChange.bind(_this);
381
+ _this.endInputChange = _this.endInputChange.bind(_this);
382
+ _this.handleDateChange = _this.handleDateChange.bind(_this);
383
+ _this.handleStartDateChange = _this.handleStartDateChange.bind(_this);
384
+ _this.handelEndDateChange = _this.handelEndDateChange.bind(_this);
385
+ _this.handleTimeStartChange = _this.handleTimeStartChange.bind(_this);
386
+ _this.handleTimeEndChange = _this.handleTimeEndChange.bind(_this);
387
+ _this.handleFocus = _this.handleFocus.bind(_this);
388
+ _this.handleBlur = _this.handleBlur.bind(_this);
389
+ _this.checkStartIsValidDate = _this.checkStartIsValidDate.bind(_this);
390
+ _this.checkEndIsValidDate = _this.checkEndIsValidDate.bind(_this);
391
+ _this.confirm = _this.confirm.bind(_this);
392
+ _this.clearValue = _this.clearValue.bind(_this);
393
+ _this.dom = React__default.createRef();
394
+ _this.handleClick = _this.handleClick.bind(_this);
395
+ _this.handleKeyPress = _this.handleKeyPress.bind(_this);
396
+ _this.handlePopOverClick = _this.handlePopOverClick.bind(_this);
397
+ _this.renderDay = _this.renderDay.bind(_this);
398
+ _this.renderMonth = _this.renderMonth.bind(_this);
399
+ _this.renderQuarter = _this.renderQuarter.bind(_this);
400
+ _this.renderYear = _this.renderYear.bind(_this);
401
+ _this.handleMobileChange = _this.handleMobileChange.bind(_this);
402
+ _this.handleOutClick = _this.handleOutClick.bind(_this);
403
+ var _a = _this.props, format = _a.format, valueFormat = _a.valueFormat, joinValues = _a.joinValues, delimiter = _a.delimiter, value = _a.value, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, dateFormat = _a.dateFormat, timeFormat = _a.timeFormat, data = _a.data, utc = _a.utc;
404
+ var _b = DateRangePicker.unFormatValue(value, valueFormat || format, joinValues, delimiter, data, utc), startDate = _b.startDate, endDate = _b.endDate;
405
+ var curDateFormat = dateFormat !== null && dateFormat !== void 0 ? dateFormat : '';
406
+ var curTimeFormat = timeFormat !== null && timeFormat !== void 0 ? timeFormat : '';
407
+ var curTimeFormatArr = [];
408
+ !dateFormat &&
409
+ Object.keys(dateFormats).forEach(function (item) {
410
+ var _a;
411
+ if ((_a = (displayFormat || inputFormat)) === null || _a === void 0 ? void 0 : _a.includes(item)) {
412
+ curDateFormat = dateFormats[item].format;
413
+ }
414
+ });
415
+ !timeFormat &&
416
+ Object.keys(timeFormats).forEach(function (item) {
417
+ var _a;
418
+ if ((_a = (displayFormat || inputFormat)) === null || _a === void 0 ? void 0 : _a.includes(item)) {
419
+ curTimeFormatArr.push(timeFormats[item].format);
420
+ }
421
+ });
422
+ curTimeFormat = curTimeFormatArr.length
423
+ ? curTimeFormatArr.join(':')
424
+ : curTimeFormat;
425
+ _this.state = {
426
+ isOpened: false,
427
+ isFocused: false,
428
+ editState: 'start',
429
+ startDate: startDate,
430
+ endDate: endDate,
431
+ oldStartDate: startDate,
432
+ oldEndDate: endDate,
433
+ startInputValue: startDate === null || startDate === void 0 ? void 0 : startDate.format(displayFormat || inputFormat),
434
+ endInputValue: endDate === null || endDate === void 0 ? void 0 : endDate.format(displayFormat || inputFormat),
435
+ endDateOpenedFirst: false,
436
+ curDateFormat: curDateFormat,
437
+ curTimeFormat: curTimeFormat
438
+ };
439
+ return _this;
440
+ }
441
+ DateRangePicker.formatValue = function (newValue, valueFormat, joinValues, delimiter, utc) {
442
+ var _a, _b;
443
+ if (utc === void 0) { utc = false; }
444
+ newValue = [
445
+ (_a = (utc ? moment.utc(newValue.startDate) : newValue.startDate)) === null || _a === void 0 ? void 0 : _a.format(valueFormat),
446
+ (_b = (utc ? moment.utc(newValue.endDate) : newValue.endDate)) === null || _b === void 0 ? void 0 : _b.format(valueFormat)
447
+ ];
448
+ if (joinValues) {
449
+ newValue = newValue.join(delimiter);
450
+ }
451
+ return newValue;
452
+ };
453
+ /* 将日期时间转化为momemnt格式,如果输入的内容不合法则返回undefined */
454
+ DateRangePicker.unFormatValue = function (value, format, joinValues, delimiter, data, utc) {
455
+ if (!value) {
456
+ return {
457
+ startDate: undefined,
458
+ endDate: undefined
459
+ };
460
+ }
461
+ if (joinValues && typeof value === 'string') {
462
+ value = value.split(delimiter);
463
+ }
464
+ var startDate = filterDate(value === null || value === void 0 ? void 0 : value[0], data, format, utc);
465
+ var endDate = filterDate(value === null || value === void 0 ? void 0 : value[1], data, format, utc);
466
+ /**
467
+ * 不合法的value输入都丢弃
468
+ * 注意undefined被moment认为是合法的输入,moment会转化为now,所以需要结合在一起判断
469
+ * @reference https://github.com/moment/moment/issues/1639
470
+ */
471
+ return {
472
+ startDate: value[0] && startDate.isValid() ? startDate : undefined,
473
+ endDate: value[1] && endDate.isValid() ? endDate : undefined
474
+ };
475
+ };
476
+ DateRangePicker.prototype.componentDidMount = function () {
477
+ var _a, _b;
478
+ document.body.addEventListener('click', this.handleOutClick, true);
479
+ (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.onRef) === null || _b === void 0 ? void 0 : _b.call(_a, this);
480
+ };
481
+ DateRangePicker.prototype.componentWillUnmount = function () {
482
+ document.body.removeEventListener('click', this.handleOutClick, true);
483
+ };
484
+ DateRangePicker.prototype.handleOutClick = function (e) {
485
+ if (!e.target ||
486
+ !this.dom.current ||
487
+ this.dom.current.contains(e.target) ||
488
+ !this.calendarRef.current ||
489
+ this.calendarRef.current.contains(e.target)) {
490
+ return;
491
+ }
492
+ if (this.state.isOpened) {
493
+ e.preventDefault();
494
+ this.close();
495
+ }
496
+ };
497
+ DateRangePicker.prototype.componentDidUpdate = function (prevProps) {
498
+ var props = this.props;
499
+ var value = props.value, format = props.format, valueFormat = props.valueFormat, joinValues = props.joinValues, inputFormat = props.inputFormat, displayFormat = props.displayFormat, dateFormat = props.dateFormat, timeFormat = props.timeFormat, delimiter = props.delimiter, data = props.data, utc = props.utc;
500
+ if (prevProps.displayFormat != displayFormat ||
501
+ prevProps.inputFormat != inputFormat) {
502
+ var curDateFormat_1 = dateFormat !== null && dateFormat !== void 0 ? dateFormat : '';
503
+ var curTimeFormat = timeFormat !== null && timeFormat !== void 0 ? timeFormat : '';
504
+ var curTimeFormatArr_1 = [];
505
+ !dateFormat &&
506
+ Object.keys(dateFormats).forEach(function (item) {
507
+ var _a;
508
+ if ((_a = (displayFormat || inputFormat)) === null || _a === void 0 ? void 0 : _a.includes(item)) {
509
+ curDateFormat_1 = dateFormats[item].format;
510
+ }
511
+ });
512
+ !timeFormat &&
513
+ Object.keys(timeFormats).forEach(function (item) {
514
+ var _a;
515
+ if ((_a = (displayFormat || inputFormat)) === null || _a === void 0 ? void 0 : _a.includes(item)) {
516
+ curTimeFormatArr_1.push(timeFormats[item].format);
517
+ }
518
+ });
519
+ this.setState({
520
+ curDateFormat: curDateFormat_1,
521
+ curTimeFormat: curTimeFormatArr_1.length
522
+ ? curTimeFormatArr_1.join(':')
523
+ : curTimeFormat
524
+ });
525
+ }
526
+ if (prevProps.value !== value) {
527
+ var _a = DateRangePicker.unFormatValue(value, valueFormat || format, joinValues, delimiter, data, utc), startDate = _a.startDate, endDate = _a.endDate;
528
+ this.setState({
529
+ startDate: startDate,
530
+ endDate: endDate,
531
+ startInputValue: startDate && (startDate === null || startDate === void 0 ? void 0 : startDate.isValid())
532
+ ? startDate === null || startDate === void 0 ? void 0 : startDate.format(displayFormat || inputFormat)
533
+ : '',
534
+ endInputValue: endDate && (endDate === null || endDate === void 0 ? void 0 : endDate.isValid())
535
+ ? endDate === null || endDate === void 0 ? void 0 : endDate.format(displayFormat || inputFormat)
536
+ : ''
537
+ });
538
+ }
539
+ };
540
+ DateRangePicker.prototype.focus = function () {
541
+ if (!this.dom.current || this.props.disabled) {
542
+ return;
543
+ }
544
+ this.dom.current.focus();
545
+ };
546
+ DateRangePicker.prototype.blur = function () {
547
+ if (!this.dom.current || this.props.disabled) {
548
+ return;
549
+ }
550
+ this.dom.current.blur();
551
+ };
552
+ DateRangePicker.prototype.handleFocus = function (e) {
553
+ this.setState({
554
+ isFocused: true
555
+ });
556
+ var onFocus = this.props.onFocus;
557
+ onFocus && onFocus(e);
558
+ };
559
+ DateRangePicker.prototype.handleBlur = function (e) {
560
+ this.setState({
561
+ isFocused: false
562
+ });
563
+ var onBlur = this.props.onBlur;
564
+ onBlur && onBlur(e);
565
+ };
566
+ DateRangePicker.prototype.open = function () {
567
+ if (this.props.disabled) {
568
+ return;
569
+ }
570
+ this.setState({
571
+ isOpened: true
572
+ });
573
+ };
574
+ DateRangePicker.prototype.openStart = function () {
575
+ if (this.props.disabled) {
576
+ return;
577
+ }
578
+ this.setState({
579
+ isOpened: true,
580
+ editState: 'start'
581
+ });
582
+ };
583
+ DateRangePicker.prototype.openEnd = function () {
584
+ if (this.props.disabled) {
585
+ return;
586
+ }
587
+ this.setState({
588
+ isOpened: true,
589
+ editState: 'end',
590
+ endDateOpenedFirst: true
591
+ });
592
+ };
593
+ DateRangePicker.prototype.close = function (isConfirm) {
594
+ if (isConfirm === void 0) { isConfirm = false; }
595
+ var newState = {};
596
+ if (!isConfirm) {
597
+ /** 未点击确认关闭时,将日期恢复至未做任何选择的状态 */
598
+ var _a = this.props, value = _a.value, format = _a.format, valueFormat = _a.valueFormat, joinValues = _a.joinValues, delimiter = _a.delimiter, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, data = _a.data, utc = _a.utc;
599
+ var _b = DateRangePicker.unFormatValue(value, valueFormat || format, joinValues, delimiter, data, utc), startDate = _b.startDate, endDate = _b.endDate;
600
+ Object.assign(newState, {
601
+ startDate: startDate,
602
+ endDate: endDate,
603
+ oldStartDate: startDate,
604
+ oldEndDate: endDate,
605
+ startInputValue: startDate && moment(startDate).isValid()
606
+ ? startDate.format(displayFormat || inputFormat)
607
+ : '',
608
+ endInputValue: endDate && moment(endDate).isValid()
609
+ ? endDate.format(displayFormat || inputFormat)
610
+ : ''
611
+ });
612
+ }
613
+ else {
614
+ Object.assign(newState, {
615
+ oldStartDate: this.state.startDate,
616
+ oldEndDate: this.state.endDate
617
+ });
618
+ }
619
+ this.setState(__assign(__assign({}, newState), { isOpened: false, editState: undefined, endDateOpenedFirst: false }), this.blur);
620
+ };
621
+ DateRangePicker.prototype.handleClick = function () {
622
+ this.state.isOpened ? this.close() : this.open();
623
+ };
624
+ DateRangePicker.prototype.handlePopOverClick = function (e) {
625
+ e.stopPropagation();
626
+ e.preventDefault();
627
+ };
628
+ DateRangePicker.prototype.handleKeyPress = function (e) {
629
+ if (e.key === ' ') {
630
+ this.handleClick();
631
+ e.preventDefault();
632
+ }
633
+ };
634
+ DateRangePicker.prototype.confirm = function () {
635
+ var _a = this.props, format = _a.format, valueFormat = _a.valueFormat, joinValues = _a.joinValues, delimiter = _a.delimiter, utc = _a.utc;
636
+ var _b = this.state, startDate = _b.startDate, endDate = _b.endDate;
637
+ if (!startDate && !endDate) {
638
+ return;
639
+ }
640
+ else if (endDate && (startDate === null || startDate === void 0 ? void 0 : startDate.isAfter(this.state.endDate))) {
641
+ return;
642
+ }
643
+ this.props.onChange(DateRangePicker.formatValue({ startDate: startDate, endDate: endDate }, valueFormat || format, joinValues, delimiter, utc));
644
+ if (startDate && !endDate) {
645
+ this.setState({ editState: 'end', endDateOpenedFirst: false });
646
+ }
647
+ else {
648
+ this.close(true);
649
+ }
650
+ };
651
+ DateRangePicker.prototype.filterDate = function (date, options) {
652
+ if (options === void 0) { options = { type: 'start' }; }
653
+ var _a = options || {
654
+ type: 'start'
655
+ }, type = _a.type, originValue = _a.originValue, timeFormat = _a.timeFormat, subControlViewMode = _a.subControlViewMode, autoInitDefaultValue = _a.autoInitDefaultValue;
656
+ var value = date.clone();
657
+ var _b = this.props, transform = _b.transform, data = _b.data;
658
+ var _c = this.state, startDate = _c.startDate, endDate = _c.endDate;
659
+ /** 此时为点选后的值初始化设置,不应该被内部转化逻辑和transformFn限制 */
660
+ if (autoInitDefaultValue === true) {
661
+ var now_1 = moment();
662
+ /** 如果已经设置了结束时间且当前时间已经超出了结束时间,则开始时间不能超过结束时间 */
663
+ if (!startDate && endDate && type === 'start' && now_1.isAfter(endDate)) {
664
+ value = endDate.clone();
665
+ return value;
666
+ }
667
+ var timePart_1 = {
668
+ date: value.get('date'),
669
+ hour: value.get('hour'),
670
+ minute: value.get('minute'),
671
+ second: value.get('second'),
672
+ millisecond: value.get('millisecond')
673
+ };
674
+ Object.keys(timePart_1).forEach(function (unit) {
675
+ /** 首次选择时间,日期使用当前时间; 将未设置过的时间字段设置为当前值 */
676
+ if ((unit === 'date' && subControlViewMode === 'time') ||
677
+ (unit !== 'date' && timePart_1[unit] === 0)) {
678
+ timePart_1[unit] = now_1.get(unit);
679
+ }
680
+ });
681
+ value.set(timePart_1);
682
+ return value;
683
+ }
684
+ /** 日期时间选择器组件支持用户选择时间,如果用户手动选择了时间,则不需要走默认处理 */
685
+ if (subControlViewMode && subControlViewMode === 'time') {
686
+ return value;
687
+ }
688
+ var transformFn = transform && typeof transform === 'string'
689
+ ? str2function(transform, 'value', 'config', 'props', 'data', 'moment')
690
+ : transform;
691
+ // 没有初始值
692
+ if (!originValue) {
693
+ value = value[type === 'start' ? 'startOf' : 'endOf']('day');
694
+ }
695
+ else if (typeof timeFormat === 'string' && /ss/.test(timeFormat)) {
696
+ value = value[type === 'start' ? 'startOf' : 'endOf']('second');
697
+ }
698
+ else if (typeof timeFormat === 'string' && /mm/.test(timeFormat)) {
699
+ value = value[type === 'start' ? 'startOf' : 'endOf']('minute');
700
+ }
701
+ else if (typeof timeFormat === 'string' && /HH/i.test(timeFormat)) {
702
+ value = value[type === 'start' ? 'startOf' : 'endOf']('hour');
703
+ }
704
+ else if (typeof timeFormat === 'string' && /Q/i.test(timeFormat)) {
705
+ value = value[type === 'start' ? 'startOf' : 'endOf']('quarter');
706
+ }
707
+ else {
708
+ value = value[type === 'start' ? 'startOf' : 'endOf']('day');
709
+ }
710
+ if (typeof transformFn === 'function') {
711
+ value = transformFn(value, { type: type, originValue: originValue, timeFormat: timeFormat }, this.props, data, moment);
712
+ }
713
+ return value;
714
+ };
715
+ DateRangePicker.prototype.handleDateChange = function (newValue, viewMode, status) {
716
+ var embed = this.props.embed;
717
+ var editState = embed
718
+ ? this.state.editState || status
719
+ : this.state.editState;
720
+ if (editState === 'start') {
721
+ this.handleStartDateChange(newValue);
722
+ }
723
+ else if (editState === 'end') {
724
+ this.handelEndDateChange(newValue);
725
+ }
726
+ };
727
+ /**
728
+ * @param {Moment} newValue 当前选择的日期时间值
729
+ * @param {ViewMode=} subControlViewMode 子选择控件的类型,可选参数('time'),用于区分datetime选择器的触发控件
730
+ */
731
+ DateRangePicker.prototype.handleStartDateChange = function (newValue, subControlViewMode) {
732
+ var _a = this.props, minDate = _a.minDate, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, type = _a.type; _a.value;
733
+ var _b = this.state, startDate = _b.startDate; _b.oldStartDate; var endDateOpenedFirst = _b.endDateOpenedFirst, timeFormat = _b.curTimeFormat;
734
+ if (minDate && newValue.isBefore(minDate)) {
735
+ newValue = minDate;
736
+ }
737
+ var date = this.filterDate(newValue, {
738
+ type: 'start',
739
+ originValue: startDate || minDate,
740
+ timeFormat: timeFormat,
741
+ subControlViewMode: subControlViewMode,
742
+ autoInitDefaultValue: !!timeFormat && newValue && !startDate
743
+ });
744
+ var newState = {
745
+ startDate: date,
746
+ startInputValue: date.format(displayFormat || inputFormat)
747
+ };
748
+ // 这些没有时间的选择点第一次后第二次就是选结束时间
749
+ if (!endDateOpenedFirst &&
750
+ (type === 'input-date-range' ||
751
+ type === 'input-year-range' ||
752
+ type === 'input-quarter-range' ||
753
+ type === 'input-month-range')) {
754
+ newState.editState = 'end';
755
+ }
756
+ this.setState(newState);
757
+ };
758
+ /**
759
+ * @param {Moment} newValue 当前选择的日期时间值
760
+ * @param {string=} subControlViewMode 子选择控件的类型的类型,可选参数('time'),用于区分datetime选择器的触发控件
761
+ */
762
+ DateRangePicker.prototype.handelEndDateChange = function (newValue, subControlViewMode) {
763
+ var _this = this;
764
+ var _a = this.props, embed = _a.embed, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, type = _a.type; _a.value;
765
+ var _b = this.state; _b.startDate; var endDate = _b.endDate; _b.oldEndDate; var endDateOpenedFirst = _b.endDateOpenedFirst, timeFormat = _b.curTimeFormat;
766
+ newValue = this.getEndDateByDuration(newValue);
767
+ var editState = endDateOpenedFirst ? 'start' : 'end';
768
+ var date = this.filterDate(newValue, {
769
+ type: 'end',
770
+ originValue: endDate,
771
+ timeFormat: timeFormat,
772
+ subControlViewMode: subControlViewMode,
773
+ autoInitDefaultValue: !!timeFormat && newValue && !endDate
774
+ });
775
+ this.setState({
776
+ endDate: date,
777
+ endInputValue: date.format(displayFormat || inputFormat)
778
+ }, function () {
779
+ embed && _this.confirm();
780
+ });
781
+ if (type !== 'input-datetime-range') {
782
+ this.setState({ editState: editState });
783
+ }
784
+ };
785
+ // 手动控制输入时间
786
+ DateRangePicker.prototype.startInputChange = function (e) {
787
+ var _a = this.props, onChange = _a.onChange, displayFormat = _a.displayFormat, inputFormat = _a.inputFormat; _a.utc;
788
+ var value = e.currentTarget.value;
789
+ this.setState({ startInputValue: value });
790
+ if (value === '') {
791
+ onChange('');
792
+ }
793
+ else {
794
+ var newDate = this.getStartDateByDuration(moment(value, displayFormat || inputFormat));
795
+ this.setState({ startDate: newDate });
796
+ }
797
+ };
798
+ DateRangePicker.prototype.endInputChange = function (e) {
799
+ var _a = this.props, onChange = _a.onChange, displayFormat = _a.displayFormat, inputFormat = _a.inputFormat; _a.utc;
800
+ var value = e.currentTarget.value;
801
+ this.setState({ endInputValue: value });
802
+ if (value === '') {
803
+ onChange('');
804
+ }
805
+ else {
806
+ var newDate = this.getEndDateByDuration(moment(value, displayFormat || inputFormat));
807
+ this.setState({ endDate: newDate });
808
+ }
809
+ };
810
+ // 根据 duration 修复结束时间
811
+ DateRangePicker.prototype.getEndDateByDuration = function (newValue) {
812
+ var _a = this.props, minDuration = _a.minDuration, maxDuration = _a.maxDuration, type = _a.type, maxDate = _a.maxDate;
813
+ var _b = this.state, startDate = _b.startDate; _b.endDate; _b.editState;
814
+ if (!startDate) {
815
+ return newValue;
816
+ }
817
+ // 时间范围必须统一成同一天,不然会不一致
818
+ if (type === 'input-time-range' && startDate) {
819
+ newValue.set({
820
+ year: startDate.year(),
821
+ month: startDate.month(),
822
+ date: startDate.date()
823
+ });
824
+ }
825
+ if (minDuration && newValue.isBefore(startDate.clone().add(minDuration))) {
826
+ newValue = startDate.clone().add(minDuration);
827
+ }
828
+ if (maxDuration && newValue.isAfter(startDate.clone().add(maxDuration))) {
829
+ newValue = startDate.clone().add(maxDuration);
830
+ }
831
+ if (maxDate && newValue && newValue.isAfter(maxDate, 'second')) {
832
+ newValue = maxDate;
833
+ }
834
+ return newValue;
835
+ };
836
+ // 根据 duration 修复起始时间
837
+ DateRangePicker.prototype.getStartDateByDuration = function (newValue) {
838
+ var _a = this.props, minDuration = _a.minDuration, maxDuration = _a.maxDuration, type = _a.type;
839
+ var _b = this.state, endDate = _b.endDate; _b.editState;
840
+ if (!endDate) {
841
+ return newValue;
842
+ }
843
+ // 时间范围必须统一成同一天,不然会不一致
844
+ if (type === 'input-time-range' && endDate) {
845
+ newValue.set({
846
+ year: endDate.year(),
847
+ month: endDate.month(),
848
+ date: endDate.date()
849
+ });
850
+ }
851
+ if (minDuration &&
852
+ newValue.isBefore(endDate.clone().subtract(minDuration))) {
853
+ newValue = endDate.clone().subtract(minDuration);
854
+ }
855
+ if (maxDuration &&
856
+ newValue.isAfter(endDate.clone().subtract(maxDuration))) {
857
+ newValue = endDate.clone().subtract(maxDuration);
858
+ }
859
+ return newValue;
860
+ };
861
+ // 主要用于处理时间的情况
862
+ DateRangePicker.prototype.handleTimeStartChange = function (newValue) {
863
+ var _this = this;
864
+ var _a = this.props, embed = _a.embed, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat; _a.minDuration; _a.maxDuration; var minDate = _a.minDate;
865
+ var _b = this.state; _b.startDate; var endDate = _b.endDate;
866
+ // 时间范围必须统一成同一天,不然会不一致
867
+ if (endDate) {
868
+ newValue.set({
869
+ year: endDate.year(),
870
+ month: endDate.month(),
871
+ date: endDate.date()
872
+ });
873
+ }
874
+ if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
875
+ newValue = minDate;
876
+ }
877
+ this.setState({
878
+ startDate: newValue,
879
+ startInputValue: newValue.format(displayFormat || inputFormat)
880
+ }, function () {
881
+ embed && _this.confirm();
882
+ });
883
+ };
884
+ DateRangePicker.prototype.handleTimeEndChange = function (newValue) {
885
+ var _this = this;
886
+ var _a = this.props, embed = _a.embed, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, minDuration = _a.minDuration, maxDuration = _a.maxDuration, maxDate = _a.maxDate;
887
+ var _b = this.state, startDate = _b.startDate; _b.endDate;
888
+ if (startDate) {
889
+ newValue.set({
890
+ year: startDate.year(),
891
+ month: startDate.month(),
892
+ date: startDate.date()
893
+ });
894
+ }
895
+ if (maxDate && newValue && newValue.isAfter(maxDate, 'second')) {
896
+ newValue = maxDate;
897
+ }
898
+ if (startDate &&
899
+ minDuration &&
900
+ newValue.isBefore(startDate.clone().add(minDuration))) {
901
+ newValue = startDate.clone().add(minDuration);
902
+ }
903
+ if (startDate &&
904
+ maxDuration &&
905
+ newValue.isAfter(startDate.clone().add(maxDuration))) {
906
+ newValue = startDate.clone().add(maxDuration);
907
+ }
908
+ this.setState({
909
+ endDate: newValue,
910
+ endInputValue: newValue.format(displayFormat || inputFormat)
911
+ }, function () {
912
+ embed && _this.confirm();
913
+ });
914
+ };
915
+ DateRangePicker.prototype.handleMobileChange = function (data, callback) {
916
+ this.setState({
917
+ startDate: data.startDate,
918
+ endDate: data.endDate
919
+ }, callback);
920
+ };
921
+ DateRangePicker.prototype.selectShortcut = function (shortcut) {
922
+ var _a = this.props, closeOnSelect = _a.closeOnSelect, minDateRaw = _a.minDateRaw, maxDateRaw = _a.maxDateRaw, format = _a.format, valueFormat = _a.valueFormat, data = _a.data, mobileUI = _a.mobileUI;
923
+ var now = moment();
924
+ /** minDate和maxDate要实时计算,因为用户可能设置为${NOW()},暂时不考虑毫秒级的时间差 */
925
+ var minDate = minDateRaw
926
+ ? filterDate(minDateRaw, data, valueFormat || format)
927
+ : undefined;
928
+ var maxDate = maxDateRaw
929
+ ? filterDate(maxDateRaw, data, valueFormat || format)
930
+ : undefined;
931
+ var startDate = shortcut.startDate(now.clone());
932
+ var endDate = shortcut.endDate(now.clone());
933
+ this.setState({
934
+ startDate: minDate && (minDate === null || minDate === void 0 ? void 0 : minDate.isValid())
935
+ ? moment.max(startDate, minDate)
936
+ : startDate,
937
+ endDate: maxDate && (maxDate === null || maxDate === void 0 ? void 0 : maxDate.isValid()) ? moment.min(maxDate, endDate) : endDate
938
+ }, closeOnSelect && !mobileUI ? this.confirm : noop);
939
+ };
940
+ DateRangePicker.prototype.renderShortcuts = function (shortcuts) {
941
+ var _this = this;
942
+ if (!shortcuts) {
943
+ return null;
944
+ }
945
+ var _a = this.props, ns = _a.classPrefix, format = _a.format, valueFormat = _a.valueFormat, data = _a.data, __ = _a.translate, testIdBuilder = _a.testIdBuilder;
946
+ var shortcutArr;
947
+ if (typeof shortcuts === 'string') {
948
+ shortcutArr = shortcuts.split(',');
949
+ }
950
+ else {
951
+ shortcutArr = shortcuts;
952
+ }
953
+ var TIDBuilder = testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('shortcut');
954
+ return (React__default.createElement("ul", { className: "".concat(ns, "DateRangePicker-rangers") }, shortcutArr.map(function (item, index) {
955
+ if (!item) {
956
+ return null;
957
+ }
958
+ var shortcut = {};
959
+ if (typeof item === 'string') {
960
+ if (availableShortcuts[item]) {
961
+ shortcut = availableShortcuts[item];
962
+ shortcut.key = item;
963
+ }
964
+ else {
965
+ // 通过正则尝试匹配
966
+ for (var i = 0, len = advancedRanges.length; i < len; i++) {
967
+ var value = advancedRanges[i];
968
+ var m = value.regexp.exec(item);
969
+ if (m) {
970
+ shortcut = value.resolve.apply(item, __spreadArray([__], __read(m), false));
971
+ shortcut.key = item;
972
+ }
973
+ }
974
+ }
975
+ }
976
+ else if (item.startDate &&
977
+ item.endDate) {
978
+ var shortcutRaw_1 = __assign({}, item);
979
+ shortcut = __assign(__assign({}, item), { startDate: function () {
980
+ var startDate = isExpression(shortcutRaw_1.startDate)
981
+ ? moment(FormulaExec['formula'](shortcutRaw_1.startDate, data), valueFormat || format)
982
+ : typeof shortcutRaw_1.startDate === 'string'
983
+ ? moment(shortcutRaw_1.startDate, valueFormat || format)
984
+ : shortcutRaw_1.startDate;
985
+ return startDate &&
986
+ moment.isMoment(startDate) &&
987
+ startDate.isValid()
988
+ ? startDate
989
+ : item.startDate;
990
+ }, endDate: function () {
991
+ var endDate = isExpression(shortcutRaw_1.endDate)
992
+ ? moment(FormulaExec['formula'](shortcutRaw_1.endDate, data), valueFormat || format)
993
+ : typeof shortcutRaw_1.endDate === 'string'
994
+ ? moment(shortcutRaw_1.endDate, valueFormat || format)
995
+ : shortcutRaw_1.endDate;
996
+ return endDate && moment.isMoment(endDate) && endDate.isValid()
997
+ ? endDate
998
+ : item.endDate;
999
+ } });
1000
+ }
1001
+ if (Object.keys(shortcut).length) {
1002
+ return (React__default.createElement("li", { className: "".concat(ns, "DateRangePicker-ranger"), onClick: function () { return _this.selectShortcut(shortcut); }, key: index },
1003
+ React__default.createElement("a", __assign({}, TIDBuilder === null || TIDBuilder === void 0 ? void 0 : TIDBuilder.getChild(shortcut.key).getTestId()), __(shortcut.label))));
1004
+ }
1005
+ else {
1006
+ return null;
1007
+ }
1008
+ })));
1009
+ };
1010
+ DateRangePicker.prototype.clearValue = function (e) {
1011
+ e.preventDefault();
1012
+ e.stopPropagation();
1013
+ var onChange = this.props.onChange;
1014
+ this.setState({ startInputValue: '', endInputValue: '' });
1015
+ onChange('');
1016
+ };
1017
+ // 清空
1018
+ DateRangePicker.prototype.clear = function () {
1019
+ var onChange = this.props.onChange;
1020
+ this.setState({ startInputValue: '', endInputValue: '' });
1021
+ onChange('');
1022
+ };
1023
+ // 重置
1024
+ DateRangePicker.prototype.reset = function (resetValue) {
1025
+ var _a = this.props, onChange = _a.onChange, format = _a.format, valueFormat = _a.valueFormat, joinValues = _a.joinValues, delimiter = _a.delimiter, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, data = _a.data, utc = _a.utc;
1026
+ var tmpResetValue = resetValue !== null && resetValue !== void 0 ? resetValue : this.props.resetValue;
1027
+ var _b = DateRangePicker.unFormatValue(tmpResetValue, valueFormat || format, joinValues, delimiter, data, utc), startDate = _b.startDate, endDate = _b.endDate;
1028
+ onChange === null || onChange === void 0 ? void 0 : onChange(tmpResetValue);
1029
+ this.setState({
1030
+ startInputValue: startDate === null || startDate === void 0 ? void 0 : startDate.format(displayFormat || inputFormat),
1031
+ endInputValue: endDate === null || endDate === void 0 ? void 0 : endDate.format(displayFormat || inputFormat)
1032
+ });
1033
+ };
1034
+ DateRangePicker.prototype.checkStartIsValidDate = function (currentDate) {
1035
+ var _a = this.state, endDate = _a.endDate; _a.startDate;
1036
+ var _b = this.props, minDate = _b.minDate, maxDate = _b.maxDate, minDuration = _b.minDuration, maxDuration = _b.maxDuration, viewMode = _b.viewMode;
1037
+ var precision = viewMode === 'time' ? 'hours' : viewMode || 'day';
1038
+ maxDate =
1039
+ maxDate && endDate
1040
+ ? maxDate.isBefore(endDate)
1041
+ ? maxDate
1042
+ : endDate
1043
+ : maxDate || endDate;
1044
+ if (minDate && currentDate.isBefore(minDate, precision)) {
1045
+ return false;
1046
+ }
1047
+ else if (maxDate && currentDate.isAfter(maxDate, precision)) {
1048
+ return false;
1049
+ }
1050
+ else if (
1051
+ // 如果配置了 minDuration 那么 EndDate - minDuration 之后的天数也不能选
1052
+ endDate &&
1053
+ minDuration &&
1054
+ currentDate.isAfter(endDate.clone().subtract(minDuration))) {
1055
+ return false;
1056
+ }
1057
+ else if (endDate &&
1058
+ maxDuration &&
1059
+ currentDate.isBefore(endDate.clone().subtract(maxDuration))) {
1060
+ return false;
1061
+ }
1062
+ return true;
1063
+ };
1064
+ DateRangePicker.prototype.checkEndIsValidDate = function (currentDate) {
1065
+ var startDate = this.state.startDate;
1066
+ var _a = this.props, minDate = _a.minDate, maxDate = _a.maxDate, minDuration = _a.minDuration, maxDuration = _a.maxDuration, viewMode = _a.viewMode;
1067
+ var precision = viewMode === 'time' ? 'hours' : viewMode || 'day';
1068
+ minDate =
1069
+ minDate && startDate
1070
+ ? minDate.isAfter(startDate)
1071
+ ? minDate
1072
+ : startDate
1073
+ : minDate || startDate;
1074
+ // 在 dateTimeRange 的场景下,如果选择了开始时间的时间点不为 0,比如 2020-10-1 10:10,这时 currentDate 传入的当天值是 2020-10-1 00:00,这个值在起始时间后面,导致没法再选这一天了,所以在这时需要先通过将时间都转成 00 再比较
1075
+ if (minDate &&
1076
+ currentDate
1077
+ .startOf('day')
1078
+ .isBefore(minDate.clone().startOf('day'), precision)) {
1079
+ return false;
1080
+ }
1081
+ else if (maxDate && currentDate.isAfter(maxDate, precision)) {
1082
+ return false;
1083
+ }
1084
+ else if (startDate &&
1085
+ minDuration &&
1086
+ currentDate.isBefore(startDate.clone().add(minDuration))) {
1087
+ return false;
1088
+ }
1089
+ else if (startDate &&
1090
+ maxDuration &&
1091
+ currentDate.isAfter(startDate.clone().add(maxDuration))) {
1092
+ return false;
1093
+ }
1094
+ return true;
1095
+ };
1096
+ DateRangePicker.prototype.renderDay = function (props, currentDate) {
1097
+ var _a;
1098
+ var _b = this.state, startDate = _b.startDate, endDate = _b.endDate;
1099
+ var testIdBuilder = this.props.testIdBuilder;
1100
+ if (startDate &&
1101
+ endDate &&
1102
+ currentDate.isBetween(startDate, endDate, 'day', '[]')) {
1103
+ props.className += ' rdtBetween';
1104
+ }
1105
+ // 如果已经选择了开始时间和结束时间,那么中间的时间都不应该高亮
1106
+ if (startDate && endDate && props.className.includes('rdtActive')) {
1107
+ props.className = props.className.replace('rdtActive', '');
1108
+ }
1109
+ if (startDate && currentDate.isSame(startDate, 'day')) {
1110
+ props.className += ' rdtActive rdtStart';
1111
+ }
1112
+ if (endDate && currentDate.isSame(endDate, 'day')) {
1113
+ props.className += ' rdtActive rdtEnd';
1114
+ }
1115
+ var _c = this.getDisabledElementProps(currentDate, 'day'), className = _c.className, others = __rest(_c, ["className"]);
1116
+ props.className += className;
1117
+ return (React__default.createElement("td", __assign({}, omit(props, ['todayActiveStyle']), others),
1118
+ React__default.createElement("span", __assign({}, (_a = testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild(props.key)) === null || _a === void 0 ? void 0 : _a.getTestId()), currentDate.date())));
1119
+ };
1120
+ DateRangePicker.prototype.renderMonth = function (props, month, year, date) {
1121
+ var currentDate = props.viewDate.year(year).month(month);
1122
+ var _a = this.state, startDate = _a.startDate, endDate = _a.endDate;
1123
+ var _b = this.props, __ = _b.translate, testIdBuilder = _b.testIdBuilder;
1124
+ var monthStr = currentDate.format(__('MMM'));
1125
+ var strLength = 3;
1126
+ // Because some months are up to 5 characters long, we want to
1127
+ // use a fixed string length for consistency
1128
+ var monthStrFixedLength = monthStr.substring(0, strLength);
1129
+ if (startDate &&
1130
+ endDate &&
1131
+ currentDate.isBetween(startDate, endDate, 'month', '[]')) {
1132
+ props.className += ' rdtBetween';
1133
+ }
1134
+ // 如果已经选择了开始时间和结束时间,那么中间的时间都不应该高亮
1135
+ if (startDate && endDate && props.className.includes('rdtActive')) {
1136
+ props.className = props.className.replace('rdtActive', '');
1137
+ }
1138
+ if (startDate && currentDate.isSame(startDate, 'month')) {
1139
+ props.className += ' rdtActive rdtStart';
1140
+ }
1141
+ if (endDate && currentDate.isSame(endDate, 'month')) {
1142
+ props.className += ' rdtActive rdtEnd';
1143
+ }
1144
+ var _c = this.getDisabledElementProps(currentDate, 'month'), className = _c.className, others = __rest(_c, ["className"]);
1145
+ props.className += className;
1146
+ return (React__default.createElement("td", __assign({}, omit(props, 'viewDate'), others),
1147
+ React__default.createElement("span", __assign({}, testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild(props.key).getTestId()), monthStrFixedLength)));
1148
+ };
1149
+ DateRangePicker.prototype.renderQuarter = function (props, quarter, year) {
1150
+ var currentDate = moment().year(year).quarter(quarter);
1151
+ var _a = this.state, startDate = _a.startDate, endDate = _a.endDate;
1152
+ var testIdBuilder = this.props.testIdBuilder;
1153
+ if (startDate &&
1154
+ endDate &&
1155
+ currentDate.isBetween(startDate, endDate, 'quarter', '[]')) {
1156
+ props.className += ' rdtBetween';
1157
+ }
1158
+ // 如果已经选择了开始时间和结束时间,那么中间的时间都不应该高亮
1159
+ if (startDate && endDate && props.className.includes('rdtActive')) {
1160
+ props.className = props.className.replace('rdtActive', '');
1161
+ }
1162
+ if (startDate && currentDate.isSame(startDate, 'quarter')) {
1163
+ props.className += ' rdtActive rdtStart';
1164
+ }
1165
+ if (endDate && currentDate.isSame(endDate, 'quarter')) {
1166
+ props.className += ' rdtActive rdtEnd';
1167
+ }
1168
+ var _b = this.getDisabledElementProps(currentDate, 'quarter'), className = _b.className, others = __rest(_b, ["className"]);
1169
+ props.className += className;
1170
+ return (React__default.createElement("td", __assign({}, props, others),
1171
+ React__default.createElement("span", __assign({}, testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild(props.key).getTestId()),
1172
+ "Q",
1173
+ quarter)));
1174
+ };
1175
+ DateRangePicker.prototype.renderYear = function (props, year) {
1176
+ var currentDate = moment().year(year);
1177
+ var _a = this.state, startDate = _a.startDate, endDate = _a.endDate;
1178
+ var testIdBuilder = this.props.testIdBuilder;
1179
+ if (startDate &&
1180
+ endDate &&
1181
+ currentDate.isBetween(startDate, endDate, 'year', '[]')) {
1182
+ props.className += ' rdtBetween';
1183
+ }
1184
+ // 如果已经选择了开始时间和结束时间,那么中间的时间都不应该高亮
1185
+ if (startDate && endDate && props.className.includes('rdtActive')) {
1186
+ props.className = props.className.replace('rdtActive', '');
1187
+ }
1188
+ if (startDate && currentDate.isSame(startDate, 'year')) {
1189
+ props.className += ' rdtActive rdtStart';
1190
+ }
1191
+ if (endDate && currentDate.isSame(endDate, 'year')) {
1192
+ props.className += ' rdtActive rdtEnd';
1193
+ }
1194
+ var _b = this.getDisabledElementProps(currentDate, 'year'), className = _b.className, others = __rest(_b, ["className"]);
1195
+ props.className += className;
1196
+ return (React__default.createElement("td", __assign({}, props, others),
1197
+ React__default.createElement("span", __assign({}, testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild(props.key).getTestId()), year)));
1198
+ };
1199
+ DateRangePicker.prototype.renderCalendar = function () {
1200
+ var _this = this;
1201
+ var _a = this.props, ns = _a.classPrefix, cx = _a.classnames, inputFormat = _a.inputFormat, displayFormat = _a.displayFormat, ranges = _a.ranges, shortcuts = _a.shortcuts, locale = _a.locale, embed = _a.embed, type = _a.type, _b = _a.viewMode, viewMode = _b === void 0 ? 'days' : _b, label = _a.label, mobileUI = _a.mobileUI, testIdBuilder = _a.testIdBuilder;
1202
+ var __ = this.props.translate;
1203
+ var _c = this.state, startDate = _c.startDate, endDate = _c.endDate, editState = _c.editState, curDateFormat = _c.curDateFormat, curTimeFormat = _c.curTimeFormat;
1204
+ var isDateTimeRange = type === 'input-datetime-range';
1205
+ var isDateRange = type === 'input-date-range';
1206
+ // timeRange需要单独选择范围
1207
+ var isTimeRange = isDateTimeRange || viewMode === 'time';
1208
+ var isConfirmBtnDisbaled = (isTimeRange && editState === 'start' && !startDate) ||
1209
+ (isTimeRange && editState === 'end' && !endDate) ||
1210
+ (startDate && (endDate === null || endDate === void 0 ? void 0 : endDate.isBefore(this.state.startDate))) ||
1211
+ /** 日期范围选择之后会立即切换面板,所以开始/结束日期任意一个不合法就不允许更新数据 */
1212
+ (isDateRange &&
1213
+ (!startDate ||
1214
+ !endDate ||
1215
+ !(startDate === null || startDate === void 0 ? void 0 : startDate.isValid()) ||
1216
+ !(endDate === null || endDate === void 0 ? void 0 : endDate.isValid())));
1217
+ return (React__default.createElement("div", { className: cx("".concat(ns, "DateRangePicker-wrap"), { 'is-mobile': mobileUI }), ref: this.calendarRef },
1218
+ mobileUI && !embed ? (React__default.createElement("div", { className: cx('PickerColumns-header') },
1219
+ React__default.createElement(Button, { className: "PickerColumns-cancel", level: "link", onClick: function () { return _this.close(false); } }, __('cancel')),
1220
+ label && typeof label === 'string'
1221
+ ? label
1222
+ : __('Calendar.datepicker'),
1223
+ React__default.createElement(Button, { className: "PickerColumns-confirm", level: "link", disabled: isConfirmBtnDisbaled || !startDate || !endDate, onClick: this.confirm }, __('confirm')))) : null,
1224
+ this.renderShortcuts(ranges || shortcuts),
1225
+ React__default.createElement("div", { className: cx("".concat(ns, "DateRangePicker-picker-wrap"), {
1226
+ 'is-vertical': embed
1227
+ }) },
1228
+ (!isTimeRange ||
1229
+ (editState === 'start' && !embed) ||
1230
+ (mobileUI && isTimeRange)) && (React__default.createElement(Calendar, { className: "".concat(ns, "DateRangePicker-start"), value: startDate,
1231
+ // 区分的原因是 time-range 左侧就只能选起始时间,而其它都能在左侧同时同时选择起始和结束
1232
+ // TODO: 后续得把 time-range 代码拆分出来
1233
+ onChange: isDateTimeRange
1234
+ ? this.handleStartDateChange
1235
+ : viewMode === 'time'
1236
+ ? this.handleTimeStartChange
1237
+ : this.handleDateChange, requiredConfirm: false, dateFormat: curDateFormat, displayForamt: displayFormat || inputFormat, timeFormat: curTimeFormat, isValidDate: this.checkStartIsValidDate, viewMode: viewMode, input: false, onClose: this.close, renderDay: this.renderDay, renderMonth: this.renderMonth, renderQuarter: this.renderQuarter, renderYear: this.renderYear, locale: locale, timeRangeHeader: "\u5F00\u59CB\u65F6\u95F4", embed: embed, status: "start", testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('calendar-start') })),
1238
+ (!isTimeRange ||
1239
+ (editState === 'end' && !embed) ||
1240
+ (mobileUI && isTimeRange)) && (React__default.createElement(Calendar, { className: "".concat(ns, "DateRangePicker-end"), value: endDate, onChange: isDateTimeRange
1241
+ ? this.handelEndDateChange
1242
+ : viewMode === 'time'
1243
+ ? this.handleTimeEndChange
1244
+ : this.handleDateChange, requiredConfirm: false, dateFormat: curDateFormat, displayForamt: displayFormat || inputFormat, timeFormat: curTimeFormat, viewDate: isDateTimeRange ? this.currentMonth : this.nextMonth,
1245
+ // isEndDate
1246
+ isValidDate: this.checkEndIsValidDate, viewMode: viewMode, input: false, onClose: this.close, renderDay: this.renderDay, renderMonth: this.renderMonth, renderQuarter: this.renderQuarter, renderYear: this.renderYear, locale: locale, timeRangeHeader: "\u7ED3\u675F\u65F6\u95F4", embed: embed, status: "end", testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('calendar-end') }))),
1247
+ embed || mobileUI ? null : (React__default.createElement("div", { key: "button", className: "".concat(ns, "DateRangePicker-actions") },
1248
+ React__default.createElement(Button, { size: "sm", onClick: function () { return _this.close(); } }, __('cancel')),
1249
+ React__default.createElement(Button, { level: "primary", size: "sm", className: cx('m-l-sm'), disabled: isConfirmBtnDisbaled, onClick: this.confirm }, __('confirm'))))));
1250
+ };
1251
+ DateRangePicker.prototype.getDisabledElementProps = function (currentDate, granularity) {
1252
+ var _a = this.state; _a.endDateOpenedFirst; var endDate = _a.endDate, startDate = _a.startDate, editState = _a.editState;
1253
+ var afterEndDate = editState === 'start' &&
1254
+ endDate &&
1255
+ currentDate.isAfter(endDate, granularity);
1256
+ var beforeStartDate = editState === 'end' &&
1257
+ startDate &&
1258
+ !currentDate.isSameOrAfter(startDate, granularity);
1259
+ if (afterEndDate || beforeStartDate) {
1260
+ return {
1261
+ className: ' is-disabled',
1262
+ onClick: undefined
1263
+ };
1264
+ }
1265
+ return {
1266
+ className: ''
1267
+ };
1268
+ };
1269
+ /** 获取宽度类型变量的值 */
1270
+ DateRangePicker.prototype.getValidWidthValue = function (element, propsName) {
1271
+ if (!element || !propsName) {
1272
+ return 0;
1273
+ }
1274
+ var propsValue = parseInt(getComputedStyle(element, kebabCase(propsName)), 10);
1275
+ return isNaN(propsValue) ? 0 : propsValue;
1276
+ };
1277
+ DateRangePicker.prototype.renderActiveCursor = function () {
1278
+ var _a, _b, _c, _d;
1279
+ var cx = this.props.classnames;
1280
+ var _e = this.state, editState = _e.editState, isFocused = _e.isFocused;
1281
+ var cursorWidth = 0;
1282
+ var cursorLeft = 0;
1283
+ var parentNode = (_a = this === null || this === void 0 ? void 0 : this.dom) === null || _a === void 0 ? void 0 : _a.current;
1284
+ var startInputNode = (_b = this === null || this === void 0 ? void 0 : this.startInputRef) === null || _b === void 0 ? void 0 : _b.current;
1285
+ var endInputNode = (_c = this === null || this === void 0 ? void 0 : this.endInputRef) === null || _c === void 0 ? void 0 : _c.current;
1286
+ var separatorNode = (_d = this === null || this === void 0 ? void 0 : this.separatorRef) === null || _d === void 0 ? void 0 : _d.current;
1287
+ if (parentNode && startInputNode && endInputNode && separatorNode) {
1288
+ if (editState === 'start') {
1289
+ var paddingWidth = this.getValidWidthValue(parentNode, 'paddingLeft');
1290
+ cursorLeft = paddingWidth;
1291
+ cursorWidth = startInputNode.offsetWidth;
1292
+ }
1293
+ else if (editState === 'end') {
1294
+ var separatorWidth = separatorNode.offsetWidth +
1295
+ this.getValidWidthValue(parentNode, 'paddingLeft') +
1296
+ this.getValidWidthValue(parentNode, 'marginLeft') +
1297
+ this.getValidWidthValue(parentNode, 'paddingRight') +
1298
+ this.getValidWidthValue(parentNode, 'marginRight');
1299
+ cursorLeft = startInputNode.offsetWidth + separatorWidth;
1300
+ cursorWidth = endInputNode.offsetWidth;
1301
+ }
1302
+ else {
1303
+ cursorWidth = 0;
1304
+ }
1305
+ }
1306
+ return (React__default.createElement("div", { className: cx('DateRangePicker-activeCursor', { isFocused: isFocused }), style: {
1307
+ position: 'absolute',
1308
+ left: cursorLeft,
1309
+ width: cursorWidth
1310
+ } }));
1311
+ };
1312
+ DateRangePicker.prototype.getDefaultDate = function () {
1313
+ var _a;
1314
+ var _b = this.props, value = _b.value, data = _b.data, valueFormat = _b.valueFormat, format = _b.format, delimiter = _b.delimiter;
1315
+ if (value) {
1316
+ var startDate = filterDate(Array.isArray(value)
1317
+ ? value[0] || value[1]
1318
+ : (_a = String(value).split(delimiter)) === null || _a === void 0 ? void 0 : _a[0], data, valueFormat || format);
1319
+ return startDate;
1320
+ }
1321
+ return undefined;
1322
+ };
1323
+ DateRangePicker.prototype.render = function () {
1324
+ var _a;
1325
+ var _this = this;
1326
+ var _b = this.props, className = _b.className, popoverClassName = _b.popoverClassName, ns = _b.classPrefix, cx = _b.classnames, value = _b.value, startPlaceholder = _b.startPlaceholder, endPlaceholder = _b.endPlaceholder, popOverContainer = _b.popOverContainer, popOverContainerSelector = _b.popOverContainerSelector, inputFormat = _b.inputFormat, displayFormat = _b.displayFormat; _b.joinValues; _b.delimiter; var clearable = _b.clearable, inputForbid = _b.inputForbid, disabled = _b.disabled, embed = _b.embed, overlayPlacement = _b.overlayPlacement, borderMode = _b.borderMode, mobileUI = _b.mobileUI; _b.timeFormat; var minDate = _b.minDate, maxDate = _b.maxDate, minDuration = _b.minDuration, maxDuration = _b.maxDuration; _b.dateFormat; var _c = _b.viewMode, viewMode = _c === void 0 ? 'days' : _c, ranges = _b.ranges, shortcuts = _b.shortcuts, label = _b.label, animation = _b.animation, testIdBuilder = _b.testIdBuilder, locale = _b.locale;
1327
+ var useCalendarMobile = mobileUI && ['days', 'months', 'quarters'].indexOf(viewMode) > -1;
1328
+ var _d = this.state, isOpened = _d.isOpened, isFocused = _d.isFocused, startDate = _d.startDate, endDate = _d.endDate, curDateFormat = _d.curDateFormat, curTimeFormat = _d.curTimeFormat;
1329
+ var __ = this.props.translate;
1330
+ var calendarMobile = (React__default.createElement(CalendarMobile, { popOverContainer: popOverContainer, timeFormat: curTimeFormat, displayForamt: displayFormat || inputFormat, defaultDate: this.getDefaultDate(), startDate: startDate, endDate: endDate, minDate: minDate, maxDate: maxDate, minDuration: minDuration, maxDuration: maxDuration, dateFormat: curDateFormat, embed: embed, viewMode: viewMode, close: this.close, confirm: this.confirm, onChange: this.handleMobileChange, footerExtra: this.renderShortcuts(ranges || shortcuts), locale: locale, showViewMode: viewMode === 'quarters' || viewMode === 'months' ? 'years' : 'months' }));
1331
+ if (embed) {
1332
+ return (React__default.createElement("div", { className: cx("".concat(ns, "DateRangeCalendar"), {
1333
+ 'is-mobile': mobileUI
1334
+ }, {
1335
+ 'is-disabled': disabled
1336
+ }, className) }, useCalendarMobile ? calendarMobile : this.renderCalendar()));
1337
+ }
1338
+ var CalendarMobileTitle = (React__default.createElement("div", { className: "".concat(ns, "CalendarMobile-title") }, label && typeof label === 'string' ? label : __('Calendar.datepicker')));
1339
+ /** 是否启用游标动画 */
1340
+ var useAnimation = animation !== false;
1341
+ return (React__default.createElement("div", { tabIndex: 0, onKeyPress: this.handleKeyPress, onFocus: this.handleFocus, onBlur: this.handleBlur, className: cx("".concat(ns, "DateRangePicker"), (_a = {
1342
+ 'is-disabled': disabled,
1343
+ 'is-focused': isFocused
1344
+ },
1345
+ _a["".concat(ns, "DateRangePicker--border").concat(ucFirst(borderMode))] = borderMode,
1346
+ _a['is-mobile'] = mobileUI,
1347
+ _a), className), ref: this.dom },
1348
+ React__default.createElement(Input, { className: cx('DateRangePicker-input', {
1349
+ isActive: !useAnimation && this.state.editState === 'start' && isOpened
1350
+ }), onChange: this.startInputChange, onClick: this.openStart, ref: this.startInputRef, placeholder: __(startPlaceholder), autoComplete: "off", value: this.state.startInputValue || '', disabled: disabled, readOnly: mobileUI || inputForbid, testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('start') }),
1351
+ React__default.createElement("span", { className: cx('DateRangePicker-input-separator'), ref: this.separatorRef },
1352
+ React__default.createElement("span", { className: cx('DateRangePicker-input-separator-line') })),
1353
+ React__default.createElement(Input, { className: cx('DateRangePicker-input', {
1354
+ isActive: !useAnimation && this.state.editState === 'end' && isOpened
1355
+ }), onChange: this.endInputChange, onClick: this.openEnd, ref: this.endInputRef, placeholder: __(endPlaceholder), autoComplete: "off", value: this.state.endInputValue || '', disabled: disabled, readOnly: mobileUI || inputForbid, testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('end') }),
1356
+ useAnimation ? this.renderActiveCursor() : null,
1357
+ clearable && !disabled && value ? (React__default.createElement("a", { className: "".concat(ns, "DateRangePicker-clear"), onClick: this.clearValue },
1358
+ React__default.createElement(Icon, { icon: "input-clear", className: "icon" }))) : null,
1359
+ React__default.createElement("a", { className: cx("DateRangePicker-toggler") },
1360
+ React__default.createElement(Icon, { icon: viewMode === 'time' ? 'clock' : 'date', className: "icon", iconContent: viewMode === 'time'
1361
+ ? 'DatePicker-toggler-clock'
1362
+ : 'DatePicker-toggler-date' })),
1363
+ isOpened ? (mobileUI ? (React__default.createElement(PopUp, { isShow: isOpened, container: popOverContainer, className: cx("".concat(ns, "CalendarMobile-pop"), "".concat(ns, "CalendarMobile-pop--").concat(viewMode)), onHide: this.close, header: CalendarMobileTitle, showClose: false }, useCalendarMobile ? calendarMobile : this.renderCalendar())) : (React__default.createElement(Overlay, { target: function () { return _this.dom.current; }, onHide: this.close, container: popOverContainer || (function () { return findDomCompat(_this); }), containerSelector: popOverContainerSelector, rootClose: false, placement: overlayPlacement, show: true },
1364
+ React__default.createElement(PopOver, { classPrefix: ns, className: cx("".concat(ns, "DateRangePicker-popover"), popoverClassName), onHide: this.close, onClick: this.handlePopOverClick }, this.renderCalendar())))) : null));
1365
+ };
1366
+ DateRangePicker.defaultProps = {
1367
+ startPlaceholder: 'Calendar.startPick',
1368
+ endPlaceholder: 'Calendar.endPick',
1369
+ format: 'X',
1370
+ inputFormat: 'YYYY-MM-DD',
1371
+ joinValues: true,
1372
+ clearable: true,
1373
+ delimiter: ',',
1374
+ ranges: '',
1375
+ shortcuts: 'yesterday,7daysago,prevweek,thismonth,prevmonth,prevquarter',
1376
+ resetValue: '',
1377
+ closeOnSelect: true,
1378
+ overlayPlacement: 'auto',
1379
+ endDateOpenedFirst: false
1380
+ };
1381
+ return DateRangePicker;
1382
+ }(React__default.Component));
1383
+ var DateRangePicker$1 = themeable(localeable(DateRangePicker));
1384
+
1385
+ export { DateRangePicker, advancedRanges, availableShortcuts, DateRangePicker$1 as default };