funda-ui 4.5.711 → 4.5.713

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 (483) hide show
  1. package/README.md +4 -105
  2. package/package.json +11 -556
  3. package/.gitattributes +0 -2
  4. package/README_PUBLISH.md +0 -126
  5. package/logo.png +0 -0
  6. package/preview.png +0 -0
  7. package/publish/LICENSE +0 -21
  8. package/publish/README.md +0 -126
  9. package/publish/lib/cjs/Accordion/index.d.ts +0 -2
  10. package/publish/lib/cjs/Accordion/index.js +0 -1035
  11. package/publish/lib/cjs/BackToTop/index.d.ts +0 -17
  12. package/publish/lib/cjs/BackToTop/index.js +0 -904
  13. package/publish/lib/cjs/CascadingSelect/index.d.ts +0 -60
  14. package/publish/lib/cjs/CascadingSelect/index.js +0 -2943
  15. package/publish/lib/cjs/CascadingSelectE2E/index.d.ts +0 -71
  16. package/publish/lib/cjs/CascadingSelectE2E/index.js +0 -3540
  17. package/publish/lib/cjs/Checkbox/index.d.ts +0 -28
  18. package/publish/lib/cjs/Checkbox/index.js +0 -662
  19. package/publish/lib/cjs/ColorPicker/index.d.ts +0 -27
  20. package/publish/lib/cjs/ColorPicker/index.js +0 -662
  21. package/publish/lib/cjs/Date/index.d.ts +0 -70
  22. package/publish/lib/cjs/Date/index.js +0 -6200
  23. package/publish/lib/cjs/DigitalClock/index.d.ts +0 -7
  24. package/publish/lib/cjs/DigitalClock/index.js +0 -402
  25. package/publish/lib/cjs/DragDropList/index.d.ts +0 -44
  26. package/publish/lib/cjs/DragDropList/index.js +0 -1587
  27. package/publish/lib/cjs/DropdownMenu/index.d.ts +0 -38
  28. package/publish/lib/cjs/DropdownMenu/index.js +0 -1498
  29. package/publish/lib/cjs/DynamicFields/index.d.ts +0 -40
  30. package/publish/lib/cjs/DynamicFields/index.js +0 -810
  31. package/publish/lib/cjs/EventCalendar/index.d.ts +0 -61
  32. package/publish/lib/cjs/EventCalendar/index.js +0 -3740
  33. package/publish/lib/cjs/EventCalendarTimeline/index.d.ts +0 -100
  34. package/publish/lib/cjs/EventCalendarTimeline/index.js +0 -6084
  35. package/publish/lib/cjs/File/index.d.ts +0 -40
  36. package/publish/lib/cjs/File/index.js +0 -1751
  37. package/publish/lib/cjs/HorizontalScrollContent/index.d.ts +0 -14
  38. package/publish/lib/cjs/HorizontalScrollContent/index.js +0 -426
  39. package/publish/lib/cjs/Input/index.d.ts +0 -59
  40. package/publish/lib/cjs/Input/index.js +0 -1455
  41. package/publish/lib/cjs/LiveSearch/index.d.ts +0 -69
  42. package/publish/lib/cjs/LiveSearch/index.js +0 -3626
  43. package/publish/lib/cjs/MasonryLayout/index.d.ts +0 -14
  44. package/publish/lib/cjs/MasonryLayout/index.js +0 -689
  45. package/publish/lib/cjs/ModalDialog/index.d.ts +0 -79
  46. package/publish/lib/cjs/ModalDialog/index.js +0 -1695
  47. package/publish/lib/cjs/ModeSwitch/index.d.ts +0 -17
  48. package/publish/lib/cjs/ModeSwitch/index.js +0 -202
  49. package/publish/lib/cjs/MultilevelDropdownMenu/index.d.ts +0 -20
  50. package/publish/lib/cjs/MultilevelDropdownMenu/index.js +0 -930
  51. package/publish/lib/cjs/MultipleCheckboxes/index.d.ts +0 -41
  52. package/publish/lib/cjs/MultipleCheckboxes/index.js +0 -1717
  53. package/publish/lib/cjs/MultipleSelect/index.d.ts +0 -65
  54. package/publish/lib/cjs/MultipleSelect/index.js +0 -3704
  55. package/publish/lib/cjs/NativeSelect/index.d.ts +0 -37
  56. package/publish/lib/cjs/NativeSelect/index.js +0 -1631
  57. package/publish/lib/cjs/NumberInput/index.d.ts +0 -40
  58. package/publish/lib/cjs/NumberInput/index.js +0 -1188
  59. package/publish/lib/cjs/Pagination/index.d.ts +0 -51
  60. package/publish/lib/cjs/Pagination/index.js +0 -612
  61. package/publish/lib/cjs/Radio/index.d.ts +0 -45
  62. package/publish/lib/cjs/Radio/index.js +0 -1391
  63. package/publish/lib/cjs/RangeSlider/index.d.ts +0 -22
  64. package/publish/lib/cjs/RangeSlider/index.js +0 -2665
  65. package/publish/lib/cjs/RootPortal/index.d.ts +0 -8
  66. package/publish/lib/cjs/RootPortal/index.js +0 -141
  67. package/publish/lib/cjs/ScrollReveal/index.d.ts +0 -21
  68. package/publish/lib/cjs/ScrollReveal/index.js +0 -401
  69. package/publish/lib/cjs/Scrollbar/index.d.ts +0 -17
  70. package/publish/lib/cjs/Scrollbar/index.js +0 -1107
  71. package/publish/lib/cjs/SearchBar/index.d.ts +0 -41
  72. package/publish/lib/cjs/SearchBar/index.js +0 -701
  73. package/publish/lib/cjs/Select/index.d.ts +0 -99
  74. package/publish/lib/cjs/Select/index.js +0 -5697
  75. package/publish/lib/cjs/ShowMoreLess/index.d.ts +0 -36
  76. package/publish/lib/cjs/ShowMoreLess/index.js +0 -387
  77. package/publish/lib/cjs/Switch/index.d.ts +0 -25
  78. package/publish/lib/cjs/Switch/index.js +0 -628
  79. package/publish/lib/cjs/Table/index.d.ts +0 -12
  80. package/publish/lib/cjs/Table/index.js +0 -2062
  81. package/publish/lib/cjs/Tabs/index.d.ts +0 -3
  82. package/publish/lib/cjs/Tabs/index.js +0 -771
  83. package/publish/lib/cjs/TagInput/index.d.ts +0 -31
  84. package/publish/lib/cjs/TagInput/index.js +0 -1144
  85. package/publish/lib/cjs/Textarea/index.d.ts +0 -50
  86. package/publish/lib/cjs/Textarea/index.js +0 -1784
  87. package/publish/lib/cjs/Toast/index.d.ts +0 -34
  88. package/publish/lib/cjs/Toast/index.js +0 -861
  89. package/publish/lib/cjs/Tooltip/index.d.ts +0 -23
  90. package/publish/lib/cjs/Tooltip/index.js +0 -1674
  91. package/publish/lib/cjs/Tree/index.d.ts +0 -62
  92. package/publish/lib/cjs/Tree/index.js +0 -1960
  93. package/publish/lib/cjs/Utils/anim.d.ts +0 -11
  94. package/publish/lib/cjs/Utils/anim.js +0 -400
  95. package/publish/lib/cjs/Utils/bodyScrollLock.d.ts +0 -8
  96. package/publish/lib/cjs/Utils/bodyScrollLock.js +0 -311
  97. package/publish/lib/cjs/Utils/buffer.d.ts +0 -67
  98. package/publish/lib/cjs/Utils/buffer.js +0 -343
  99. package/publish/lib/cjs/Utils/cls.d.ts +0 -15
  100. package/publish/lib/cjs/Utils/cls.js +0 -124
  101. package/publish/lib/cjs/Utils/convert.d.ts +0 -25
  102. package/publish/lib/cjs/Utils/convert.js +0 -109
  103. package/publish/lib/cjs/Utils/date.d.ts +0 -217
  104. package/publish/lib/cjs/Utils/date.js +0 -567
  105. package/publish/lib/cjs/Utils/dom.d.ts +0 -13
  106. package/publish/lib/cjs/Utils/dom.js +0 -215
  107. package/publish/lib/cjs/Utils/easing.d.ts +0 -29
  108. package/publish/lib/cjs/Utils/easing.js +0 -221
  109. package/publish/lib/cjs/Utils/extract.d.ts +0 -28
  110. package/publish/lib/cjs/Utils/extract.js +0 -130
  111. package/publish/lib/cjs/Utils/getElementProperty.d.ts +0 -52
  112. package/publish/lib/cjs/Utils/getElementProperty.js +0 -189
  113. package/publish/lib/cjs/Utils/guid.d.ts +0 -7
  114. package/publish/lib/cjs/Utils/guid.js +0 -67
  115. package/publish/lib/cjs/Utils/initDefaultOptions.d.ts +0 -21
  116. package/publish/lib/cjs/Utils/initDefaultOptions.js +0 -131
  117. package/publish/lib/cjs/Utils/inputsCalculation.d.ts +0 -28
  118. package/publish/lib/cjs/Utils/inputsCalculation.js +0 -188
  119. package/publish/lib/cjs/Utils/math.d.ts +0 -77
  120. package/publish/lib/cjs/Utils/math.js +0 -305
  121. package/publish/lib/cjs/Utils/object.d.ts +0 -18
  122. package/publish/lib/cjs/Utils/object.js +0 -120
  123. package/publish/lib/cjs/Utils/os.d.ts +0 -2
  124. package/publish/lib/cjs/Utils/os.js +0 -104
  125. package/publish/lib/cjs/Utils/performance.d.ts +0 -3
  126. package/publish/lib/cjs/Utils/performance.js +0 -94
  127. package/publish/lib/cjs/Utils/tree.d.ts +0 -40
  128. package/publish/lib/cjs/Utils/tree.js +0 -195
  129. package/publish/lib/cjs/Utils/useAutosizeTextArea.d.ts +0 -10
  130. package/publish/lib/cjs/Utils/useAutosizeTextArea.js +0 -227
  131. package/publish/lib/cjs/Utils/useBoundedDrag.d.ts +0 -125
  132. package/publish/lib/cjs/Utils/useBoundedDrag.js +0 -380
  133. package/publish/lib/cjs/Utils/useClickOutside.d.ts +0 -33
  134. package/publish/lib/cjs/Utils/useClickOutside.js +0 -166
  135. package/publish/lib/cjs/Utils/useComId.d.ts +0 -6
  136. package/publish/lib/cjs/Utils/useComId.js +0 -114
  137. package/publish/lib/cjs/Utils/useDebounce.d.ts +0 -20
  138. package/publish/lib/cjs/Utils/useDebounce.js +0 -138
  139. package/publish/lib/cjs/Utils/useDragDropPosition.d.ts +0 -169
  140. package/publish/lib/cjs/Utils/useDragDropPosition.js +0 -456
  141. package/publish/lib/cjs/Utils/useDraggable.d.ts +0 -62
  142. package/publish/lib/cjs/Utils/useDraggable.js +0 -348
  143. package/publish/lib/cjs/Utils/useInterval.d.ts +0 -5
  144. package/publish/lib/cjs/Utils/useInterval.js +0 -168
  145. package/publish/lib/cjs/Utils/useIsMobile.d.ts +0 -2
  146. package/publish/lib/cjs/Utils/useIsMobile.js +0 -168
  147. package/publish/lib/cjs/Utils/useKeyPress.d.ts +0 -44
  148. package/publish/lib/cjs/Utils/useKeyPress.js +0 -200
  149. package/publish/lib/cjs/Utils/useThrottle.d.ts +0 -2
  150. package/publish/lib/cjs/Utils/useThrottle.js +0 -136
  151. package/publish/lib/cjs/Utils/useWindowScroll.d.ts +0 -12
  152. package/publish/lib/cjs/Utils/useWindowScroll.js +0 -217
  153. package/publish/lib/cjs/Utils/viewport.d.ts +0 -7
  154. package/publish/lib/cjs/Utils/viewport.js +0 -64
  155. package/publish/lib/cjs/index.d.ts +0 -45
  156. package/publish/lib/cjs/index.js +0 -46
  157. package/publish/lib/css/BackToTop/index.css +0 -34
  158. package/publish/lib/css/CascadingSelect/index.css +0 -216
  159. package/publish/lib/css/CascadingSelectE2E/index.css +0 -216
  160. package/publish/lib/css/ColorPicker/index.css +0 -58
  161. package/publish/lib/css/Date/index.css +0 -434
  162. package/publish/lib/css/DragDropList/index.css +0 -188
  163. package/publish/lib/css/DropdownMenu/index.css +0 -151
  164. package/publish/lib/css/EventCalendar/index.css +0 -300
  165. package/publish/lib/css/EventCalendarTimeline/index.css +0 -694
  166. package/publish/lib/css/HorizontalScrollContent/index.css +0 -70
  167. package/publish/lib/css/LiveSearch/index.css +0 -55
  168. package/publish/lib/css/MultilevelDropdownMenu/index.css +0 -38
  169. package/publish/lib/css/MultipleSelect/index.css +0 -313
  170. package/publish/lib/css/RangeSlider/index.css +0 -150
  171. package/publish/lib/css/Scrollbar/index.css +0 -176
  172. package/publish/lib/css/Select/index.css +0 -368
  173. package/publish/lib/css/ShowMoreLess/index.css +0 -23
  174. package/publish/lib/css/Table/index.css +0 -584
  175. package/publish/lib/css/TagInput/index.css +0 -91
  176. package/publish/lib/css/Toast/index.css +0 -201
  177. package/publish/lib/css/Tooltip/index.css +0 -197
  178. package/publish/lib/css/Tree/index.css +0 -232
  179. package/publish/lib/esm/Accordion/Accordion.tsx +0 -184
  180. package/publish/lib/esm/Accordion/AccordionItem.tsx +0 -143
  181. package/publish/lib/esm/Accordion/index.tsx +0 -2
  182. package/publish/lib/esm/BackToTop/index.scss +0 -47
  183. package/publish/lib/esm/BackToTop/index.tsx +0 -177
  184. package/publish/lib/esm/CascadingSelect/Group.tsx +0 -82
  185. package/publish/lib/esm/CascadingSelect/index.scss +0 -291
  186. package/publish/lib/esm/CascadingSelect/index.tsx +0 -1203
  187. package/publish/lib/esm/CascadingSelectE2E/Group.tsx +0 -83
  188. package/publish/lib/esm/CascadingSelectE2E/index.scss +0 -293
  189. package/publish/lib/esm/CascadingSelectE2E/index.tsx +0 -1471
  190. package/publish/lib/esm/Checkbox/index.tsx +0 -193
  191. package/publish/lib/esm/ColorPicker/index.scss +0 -91
  192. package/publish/lib/esm/ColorPicker/index.tsx +0 -204
  193. package/publish/lib/esm/Date/Calendar.tsx +0 -723
  194. package/publish/lib/esm/Date/index.scss +0 -567
  195. package/publish/lib/esm/Date/index.tsx +0 -1683
  196. package/publish/lib/esm/Date/localization/en_US.js +0 -13
  197. package/publish/lib/esm/Date/localization/zh_CN.js +0 -12
  198. package/publish/lib/esm/DigitalClock/index.tsx +0 -74
  199. package/publish/lib/esm/DragDropList/index.scss +0 -245
  200. package/publish/lib/esm/DragDropList/index.tsx +0 -494
  201. package/publish/lib/esm/DropdownMenu/Option.tsx +0 -55
  202. package/publish/lib/esm/DropdownMenu/index.scss +0 -205
  203. package/publish/lib/esm/DropdownMenu/index.tsx +0 -377
  204. package/publish/lib/esm/DynamicFields/index.tsx +0 -404
  205. package/publish/lib/esm/EventCalendar/index.scss +0 -407
  206. package/publish/lib/esm/EventCalendar/index.tsx +0 -1004
  207. package/publish/lib/esm/EventCalendarTimeline/index.scss +0 -926
  208. package/publish/lib/esm/EventCalendarTimeline/index.tsx +0 -2683
  209. package/publish/lib/esm/File/index.tsx +0 -477
  210. package/publish/lib/esm/HorizontalScrollContent/index.scss +0 -87
  211. package/publish/lib/esm/HorizontalScrollContent/index.tsx +0 -171
  212. package/publish/lib/esm/Input/index.tsx +0 -614
  213. package/publish/lib/esm/LiveSearch/index.scss +0 -82
  214. package/publish/lib/esm/LiveSearch/index.tsx +0 -960
  215. package/publish/lib/esm/MasonryLayout/index.tsx +0 -326
  216. package/publish/lib/esm/ModalDialog/index.tsx +0 -552
  217. package/publish/lib/esm/ModeSwitch/index.tsx +0 -82
  218. package/publish/lib/esm/MultilevelDropdownMenu/ItemList.tsx +0 -265
  219. package/publish/lib/esm/MultilevelDropdownMenu/index.scss +0 -79
  220. package/publish/lib/esm/MultilevelDropdownMenu/index.tsx +0 -77
  221. package/publish/lib/esm/MultipleCheckboxes/index.tsx +0 -669
  222. package/publish/lib/esm/MultipleSelect/index.scss +0 -398
  223. package/publish/lib/esm/MultipleSelect/index.tsx +0 -766
  224. package/publish/lib/esm/MultipleSelect/utils/func.ts +0 -61
  225. package/publish/lib/esm/NativeSelect/index.tsx +0 -396
  226. package/publish/lib/esm/NativeSelect/utils/func.ts +0 -49
  227. package/publish/lib/esm/NumberInput/index.tsx +0 -385
  228. package/publish/lib/esm/Pagination/index.tsx +0 -286
  229. package/publish/lib/esm/Pagination/pagination-navigators.tsx +0 -60
  230. package/publish/lib/esm/Radio/index.tsx +0 -670
  231. package/publish/lib/esm/RangeSlider/index.scss +0 -186
  232. package/publish/lib/esm/RangeSlider/index.tsx +0 -241
  233. package/publish/lib/esm/RootPortal/index.tsx +0 -53
  234. package/publish/lib/esm/ScrollReveal/index.tsx +0 -148
  235. package/publish/lib/esm/Scrollbar/index.scss +0 -221
  236. package/publish/lib/esm/Scrollbar/index.tsx +0 -561
  237. package/publish/lib/esm/SearchBar/index.tsx +0 -253
  238. package/publish/lib/esm/Select/index.scss +0 -553
  239. package/publish/lib/esm/Select/index.tsx +0 -2816
  240. package/publish/lib/esm/Select/utils/func.ts +0 -106
  241. package/publish/lib/esm/ShowMoreLess/index.scss +0 -27
  242. package/publish/lib/esm/ShowMoreLess/index.tsx +0 -145
  243. package/publish/lib/esm/Switch/index.tsx +0 -147
  244. package/publish/lib/esm/Table/Table.tsx +0 -257
  245. package/publish/lib/esm/Table/TableBody.tsx +0 -41
  246. package/publish/lib/esm/Table/TableCaption.tsx +0 -34
  247. package/publish/lib/esm/Table/TableCell.tsx +0 -123
  248. package/publish/lib/esm/Table/TableColgroup.tsx +0 -38
  249. package/publish/lib/esm/Table/TableContext.tsx +0 -26
  250. package/publish/lib/esm/Table/TableFoot.tsx +0 -28
  251. package/publish/lib/esm/Table/TableHead.tsx +0 -28
  252. package/publish/lib/esm/Table/TableRow.tsx +0 -76
  253. package/publish/lib/esm/Table/index.scss +0 -418
  254. package/publish/lib/esm/Table/index.tsx +0 -14
  255. package/publish/lib/esm/Table/utils/DragHandleSprite.tsx +0 -46
  256. package/publish/lib/esm/Table/utils/SortSprite.tsx +0 -57
  257. package/publish/lib/esm/Table/utils/TableFilter.tsx +0 -56
  258. package/publish/lib/esm/Table/utils/ToggleSelection.tsx +0 -225
  259. package/publish/lib/esm/Table/utils/func.ts +0 -171
  260. package/publish/lib/esm/Table/utils/hooks/useTableDraggable.tsx +0 -342
  261. package/publish/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +0 -154
  262. package/publish/lib/esm/Table/utils/hooks/useTableResponsive.tsx +0 -92
  263. package/publish/lib/esm/Table/utils/hooks/useTableSort.tsx +0 -143
  264. package/publish/lib/esm/Tabs/TabList.tsx +0 -50
  265. package/publish/lib/esm/Tabs/TabPanel.tsx +0 -44
  266. package/publish/lib/esm/Tabs/Tabs.tsx +0 -282
  267. package/publish/lib/esm/Tabs/index.tsx +0 -3
  268. package/publish/lib/esm/TagInput/index.scss +0 -126
  269. package/publish/lib/esm/TagInput/index.tsx +0 -352
  270. package/publish/lib/esm/Textarea/index.tsx +0 -608
  271. package/publish/lib/esm/Toast/Item.tsx +0 -124
  272. package/publish/lib/esm/Toast/index.scss +0 -269
  273. package/publish/lib/esm/Toast/index.tsx +0 -374
  274. package/publish/lib/esm/Tooltip/index.scss +0 -269
  275. package/publish/lib/esm/Tooltip/index.tsx +0 -312
  276. package/publish/lib/esm/Tree/TreeList.tsx +0 -616
  277. package/publish/lib/esm/Tree/index.scss +0 -386
  278. package/publish/lib/esm/Tree/index.tsx +0 -396
  279. package/publish/lib/esm/Tree/init-height.tsx +0 -27
  280. package/publish/lib/esm/Tree/utils/func.ts +0 -15
  281. package/publish/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +0 -125
  282. package/publish/lib/esm/Utils/hooks/useBoundedDrag.tsx +0 -301
  283. package/publish/lib/esm/Utils/hooks/useClickOutside.tsx +0 -69
  284. package/publish/lib/esm/Utils/hooks/useComId.tsx +0 -13
  285. package/publish/lib/esm/Utils/hooks/useDebounce.tsx +0 -40
  286. package/publish/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -420
  287. package/publish/lib/esm/Utils/hooks/useDraggable.tsx +0 -265
  288. package/publish/lib/esm/Utils/hooks/useInterval.tsx +0 -74
  289. package/publish/lib/esm/Utils/hooks/useIsMobile.tsx +0 -56
  290. package/publish/lib/esm/Utils/hooks/useKeyPress.tsx +0 -104
  291. package/publish/lib/esm/Utils/hooks/useThrottle.tsx +0 -39
  292. package/publish/lib/esm/Utils/hooks/useWindowScroll.tsx +0 -83
  293. package/publish/lib/esm/Utils/libs/anim.ts +0 -96
  294. package/publish/lib/esm/Utils/libs/buffer.ts +0 -262
  295. package/publish/lib/esm/Utils/libs/cls.ts +0 -64
  296. package/publish/lib/esm/Utils/libs/convert.ts +0 -59
  297. package/publish/lib/esm/Utils/libs/date.ts +0 -578
  298. package/publish/lib/esm/Utils/libs/dom.ts +0 -150
  299. package/publish/lib/esm/Utils/libs/easing.ts +0 -201
  300. package/publish/lib/esm/Utils/libs/extract.ts +0 -86
  301. package/publish/lib/esm/Utils/libs/getElementProperty.ts +0 -150
  302. package/publish/lib/esm/Utils/libs/guid.ts +0 -16
  303. package/publish/lib/esm/Utils/libs/initDefaultOptions.ts +0 -104
  304. package/publish/lib/esm/Utils/libs/inputsCalculation.ts +0 -160
  305. package/publish/lib/esm/Utils/libs/math.ts +0 -276
  306. package/publish/lib/esm/Utils/libs/object.ts +0 -68
  307. package/publish/lib/esm/Utils/libs/os.ts +0 -63
  308. package/publish/lib/esm/Utils/libs/performance.ts +0 -47
  309. package/publish/lib/esm/Utils/libs/tree.ts +0 -119
  310. package/publish/lib/esm/Utils/libs/viewport.ts +0 -20
  311. package/publish/lib/esm/Utils/plugins/bodyScrollLock.ts +0 -286
  312. package/publish/lib/esm/index.js +0 -43
  313. package/publish/package.json +0 -1
  314. /package/{publish/Accordion → Accordion}/index.d.ts +0 -0
  315. /package/{publish/Accordion → Accordion}/index.js +0 -0
  316. /package/{publish/BackToTop → BackToTop}/index.css +0 -0
  317. /package/{publish/BackToTop → BackToTop}/index.d.ts +0 -0
  318. /package/{publish/BackToTop → BackToTop}/index.js +0 -0
  319. /package/{publish/CascadingSelect → CascadingSelect}/index.css +0 -0
  320. /package/{publish/CascadingSelect → CascadingSelect}/index.d.ts +0 -0
  321. /package/{publish/CascadingSelect → CascadingSelect}/index.js +0 -0
  322. /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.css +0 -0
  323. /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.d.ts +0 -0
  324. /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.js +0 -0
  325. /package/{publish/Checkbox → Checkbox}/index.d.ts +0 -0
  326. /package/{publish/Checkbox → Checkbox}/index.js +0 -0
  327. /package/{publish/ColorPicker → ColorPicker}/index.css +0 -0
  328. /package/{publish/ColorPicker → ColorPicker}/index.d.ts +0 -0
  329. /package/{publish/ColorPicker → ColorPicker}/index.js +0 -0
  330. /package/{publish/Date → Date}/index.css +0 -0
  331. /package/{publish/Date → Date}/index.d.ts +0 -0
  332. /package/{publish/Date → Date}/index.js +0 -0
  333. /package/{publish/DigitalClock → DigitalClock}/index.d.ts +0 -0
  334. /package/{publish/DigitalClock → DigitalClock}/index.js +0 -0
  335. /package/{publish/DragDropList → DragDropList}/index.css +0 -0
  336. /package/{publish/DragDropList → DragDropList}/index.d.ts +0 -0
  337. /package/{publish/DragDropList → DragDropList}/index.js +0 -0
  338. /package/{publish/DropdownMenu → DropdownMenu}/index.css +0 -0
  339. /package/{publish/DropdownMenu → DropdownMenu}/index.d.ts +0 -0
  340. /package/{publish/DropdownMenu → DropdownMenu}/index.js +0 -0
  341. /package/{publish/DynamicFields → DynamicFields}/index.d.ts +0 -0
  342. /package/{publish/DynamicFields → DynamicFields}/index.js +0 -0
  343. /package/{publish/EventCalendar → EventCalendar}/index.css +0 -0
  344. /package/{publish/EventCalendar → EventCalendar}/index.d.ts +0 -0
  345. /package/{publish/EventCalendar → EventCalendar}/index.js +0 -0
  346. /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.css +0 -0
  347. /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.d.ts +0 -0
  348. /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.js +0 -0
  349. /package/{publish/File → File}/index.d.ts +0 -0
  350. /package/{publish/File → File}/index.js +0 -0
  351. /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.css +0 -0
  352. /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.d.ts +0 -0
  353. /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.js +0 -0
  354. /package/{publish/Input → Input}/index.d.ts +0 -0
  355. /package/{publish/Input → Input}/index.js +0 -0
  356. /package/{publish/LiveSearch → LiveSearch}/index.css +0 -0
  357. /package/{publish/LiveSearch → LiveSearch}/index.d.ts +0 -0
  358. /package/{publish/LiveSearch → LiveSearch}/index.js +0 -0
  359. /package/{publish/MasonryLayout → MasonryLayout}/index.d.ts +0 -0
  360. /package/{publish/MasonryLayout → MasonryLayout}/index.js +0 -0
  361. /package/{publish/ModalDialog → ModalDialog}/index.d.ts +0 -0
  362. /package/{publish/ModalDialog → ModalDialog}/index.js +0 -0
  363. /package/{publish/ModeSwitch → ModeSwitch}/index.d.ts +0 -0
  364. /package/{publish/ModeSwitch → ModeSwitch}/index.js +0 -0
  365. /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.css +0 -0
  366. /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.d.ts +0 -0
  367. /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.js +0 -0
  368. /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.d.ts +0 -0
  369. /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.js +0 -0
  370. /package/{publish/MultipleSelect → MultipleSelect}/index.css +0 -0
  371. /package/{publish/MultipleSelect → MultipleSelect}/index.d.ts +0 -0
  372. /package/{publish/MultipleSelect → MultipleSelect}/index.js +0 -0
  373. /package/{publish/NativeSelect → NativeSelect}/index.d.ts +0 -0
  374. /package/{publish/NativeSelect → NativeSelect}/index.js +0 -0
  375. /package/{publish/NumberInput → NumberInput}/index.d.ts +0 -0
  376. /package/{publish/NumberInput → NumberInput}/index.js +0 -0
  377. /package/{publish/Pagination → Pagination}/index.d.ts +0 -0
  378. /package/{publish/Pagination → Pagination}/index.js +0 -0
  379. /package/{publish/Radio → Radio}/index.d.ts +0 -0
  380. /package/{publish/Radio → Radio}/index.js +0 -0
  381. /package/{publish/RangeSlider → RangeSlider}/index.css +0 -0
  382. /package/{publish/RangeSlider → RangeSlider}/index.d.ts +0 -0
  383. /package/{publish/RangeSlider → RangeSlider}/index.js +0 -0
  384. /package/{publish/RootPortal → RootPortal}/index.d.ts +0 -0
  385. /package/{publish/RootPortal → RootPortal}/index.js +0 -0
  386. /package/{publish/ScrollReveal → ScrollReveal}/index.d.ts +0 -0
  387. /package/{publish/ScrollReveal → ScrollReveal}/index.js +0 -0
  388. /package/{publish/Scrollbar → Scrollbar}/index.css +0 -0
  389. /package/{publish/Scrollbar → Scrollbar}/index.d.ts +0 -0
  390. /package/{publish/Scrollbar → Scrollbar}/index.js +0 -0
  391. /package/{publish/SearchBar → SearchBar}/index.d.ts +0 -0
  392. /package/{publish/SearchBar → SearchBar}/index.js +0 -0
  393. /package/{publish/Select → Select}/index.css +0 -0
  394. /package/{publish/Select → Select}/index.d.ts +0 -0
  395. /package/{publish/Select → Select}/index.js +0 -0
  396. /package/{publish/ShowMoreLess → ShowMoreLess}/index.css +0 -0
  397. /package/{publish/ShowMoreLess → ShowMoreLess}/index.d.ts +0 -0
  398. /package/{publish/ShowMoreLess → ShowMoreLess}/index.js +0 -0
  399. /package/{publish/Switch → Switch}/index.d.ts +0 -0
  400. /package/{publish/Switch → Switch}/index.js +0 -0
  401. /package/{publish/Table → Table}/index.css +0 -0
  402. /package/{publish/Table → Table}/index.d.ts +0 -0
  403. /package/{publish/Table → Table}/index.js +0 -0
  404. /package/{publish/Tabs → Tabs}/index.d.ts +0 -0
  405. /package/{publish/Tabs → Tabs}/index.js +0 -0
  406. /package/{publish/TagInput → TagInput}/index.css +0 -0
  407. /package/{publish/TagInput → TagInput}/index.d.ts +0 -0
  408. /package/{publish/TagInput → TagInput}/index.js +0 -0
  409. /package/{publish/Textarea → Textarea}/index.d.ts +0 -0
  410. /package/{publish/Textarea → Textarea}/index.js +0 -0
  411. /package/{publish/Toast → Toast}/index.css +0 -0
  412. /package/{publish/Toast → Toast}/index.d.ts +0 -0
  413. /package/{publish/Toast → Toast}/index.js +0 -0
  414. /package/{publish/Tooltip → Tooltip}/index.css +0 -0
  415. /package/{publish/Tooltip → Tooltip}/index.d.ts +0 -0
  416. /package/{publish/Tooltip → Tooltip}/index.js +0 -0
  417. /package/{publish/Tree → Tree}/index.css +0 -0
  418. /package/{publish/Tree → Tree}/index.d.ts +0 -0
  419. /package/{publish/Tree → Tree}/index.js +0 -0
  420. /package/{publish/Utils → Utils}/anim.d.ts +0 -0
  421. /package/{publish/Utils → Utils}/anim.js +0 -0
  422. /package/{publish/Utils → Utils}/bodyScrollLock.d.ts +0 -0
  423. /package/{publish/Utils → Utils}/bodyScrollLock.js +0 -0
  424. /package/{publish/Utils → Utils}/buffer.d.ts +0 -0
  425. /package/{publish/Utils → Utils}/buffer.js +0 -0
  426. /package/{publish/Utils → Utils}/cls.d.ts +0 -0
  427. /package/{publish/Utils → Utils}/cls.js +0 -0
  428. /package/{publish/Utils → Utils}/convert.d.ts +0 -0
  429. /package/{publish/Utils → Utils}/convert.js +0 -0
  430. /package/{publish/Utils → Utils}/date.d.ts +0 -0
  431. /package/{publish/Utils → Utils}/date.js +0 -0
  432. /package/{publish/Utils → Utils}/dom.d.ts +0 -0
  433. /package/{publish/Utils → Utils}/dom.js +0 -0
  434. /package/{publish/Utils → Utils}/easing.d.ts +0 -0
  435. /package/{publish/Utils → Utils}/easing.js +0 -0
  436. /package/{publish/Utils → Utils}/extract.d.ts +0 -0
  437. /package/{publish/Utils → Utils}/extract.js +0 -0
  438. /package/{publish/Utils → Utils}/getElementProperty.d.ts +0 -0
  439. /package/{publish/Utils → Utils}/getElementProperty.js +0 -0
  440. /package/{publish/Utils → Utils}/guid.d.ts +0 -0
  441. /package/{publish/Utils → Utils}/guid.js +0 -0
  442. /package/{publish/Utils → Utils}/initDefaultOptions.d.ts +0 -0
  443. /package/{publish/Utils → Utils}/initDefaultOptions.js +0 -0
  444. /package/{publish/Utils → Utils}/inputsCalculation.d.ts +0 -0
  445. /package/{publish/Utils → Utils}/inputsCalculation.js +0 -0
  446. /package/{publish/Utils → Utils}/math.d.ts +0 -0
  447. /package/{publish/Utils → Utils}/math.js +0 -0
  448. /package/{publish/Utils → Utils}/object.d.ts +0 -0
  449. /package/{publish/Utils → Utils}/object.js +0 -0
  450. /package/{publish/Utils → Utils}/os.d.ts +0 -0
  451. /package/{publish/Utils → Utils}/os.js +0 -0
  452. /package/{publish/Utils → Utils}/performance.d.ts +0 -0
  453. /package/{publish/Utils → Utils}/performance.js +0 -0
  454. /package/{publish/Utils → Utils}/tree.d.ts +0 -0
  455. /package/{publish/Utils → Utils}/tree.js +0 -0
  456. /package/{publish/Utils → Utils}/useAutosizeTextArea.d.ts +0 -0
  457. /package/{publish/Utils → Utils}/useAutosizeTextArea.js +0 -0
  458. /package/{publish/Utils → Utils}/useBoundedDrag.d.ts +0 -0
  459. /package/{publish/Utils → Utils}/useBoundedDrag.js +0 -0
  460. /package/{publish/Utils → Utils}/useClickOutside.d.ts +0 -0
  461. /package/{publish/Utils → Utils}/useClickOutside.js +0 -0
  462. /package/{publish/Utils → Utils}/useComId.d.ts +0 -0
  463. /package/{publish/Utils → Utils}/useComId.js +0 -0
  464. /package/{publish/Utils → Utils}/useDebounce.d.ts +0 -0
  465. /package/{publish/Utils → Utils}/useDebounce.js +0 -0
  466. /package/{publish/Utils → Utils}/useDragDropPosition.d.ts +0 -0
  467. /package/{publish/Utils → Utils}/useDragDropPosition.js +0 -0
  468. /package/{publish/Utils → Utils}/useDraggable.d.ts +0 -0
  469. /package/{publish/Utils → Utils}/useDraggable.js +0 -0
  470. /package/{publish/Utils → Utils}/useInterval.d.ts +0 -0
  471. /package/{publish/Utils → Utils}/useInterval.js +0 -0
  472. /package/{publish/Utils → Utils}/useIsMobile.d.ts +0 -0
  473. /package/{publish/Utils → Utils}/useIsMobile.js +0 -0
  474. /package/{publish/Utils → Utils}/useKeyPress.d.ts +0 -0
  475. /package/{publish/Utils → Utils}/useKeyPress.js +0 -0
  476. /package/{publish/Utils → Utils}/useThrottle.d.ts +0 -0
  477. /package/{publish/Utils → Utils}/useThrottle.js +0 -0
  478. /package/{publish/Utils → Utils}/useWindowScroll.d.ts +0 -0
  479. /package/{publish/Utils → Utils}/useWindowScroll.js +0 -0
  480. /package/{publish/Utils → Utils}/viewport.d.ts +0 -0
  481. /package/{publish/Utils → Utils}/viewport.js +0 -0
  482. /package/{publish/all.d.ts → all.d.ts} +0 -0
  483. /package/{publish/all.js → all.js} +0 -0
@@ -1,1683 +0,0 @@
1
- import React, { useState, useRef, useEffect, forwardRef, KeyboardEvent, ChangeEvent, FocusEvent, useImperativeHandle } from 'react';
2
-
3
- import Input from 'funda-input';
4
- import RootPortal from 'funda-root-portal';
5
-
6
- import useComId from 'funda-utils/dist/cjs/useComId';
7
- import {
8
- padZero,
9
- dateFormat,
10
- isTimeString,
11
- getNow,
12
- isValidDate,
13
- isValidHours,
14
- isValidMinutesAndSeconds,
15
- isValidYear,
16
- isValidMonth,
17
- isValidDay,
18
- getCurrentYear,
19
- getCurrentMonth,
20
- getCurrentDay,
21
- getLastDayInMonth
22
- } from 'funda-utils/dist/cjs/date';
23
- import useWindowScroll from 'funda-utils/dist/cjs/useWindowScroll';
24
- import useClickOutside from 'funda-utils/dist/cjs/useClickOutside';
25
- import {
26
- getAbsolutePositionOfStage
27
- } from 'funda-utils/dist/cjs/getElementProperty';
28
- import { isNumeric } from 'funda-utils/dist/cjs/math';
29
- import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
30
-
31
- import Calendar from './Calendar';
32
-
33
-
34
-
35
- // Localization
36
- import i18n__en_US from './localization/en_US';
37
- import i18n__zh_CN from './localization/zh_CN';
38
-
39
-
40
-
41
-
42
-
43
- export type DateProps = {
44
- contentRef?: React.ForwardedRef<any>; // could use "Array" on contentRef.current, such as contentRef.current[0], contentRef.current[1]
45
- popupRef?: React.ForwardedRef<any>; // could use "Array" on popupRef.current, such as popupRef.current[0], popupRef.current[1]
46
- depth?: number;
47
- popupClassName?: string;
48
- triggerClassName?: string;
49
- wrapperClassName?: string;
50
- controlClassName?: string;
51
- controlGroupWrapperClassName?: string;
52
- controlGroupTextClassName?: string;
53
- enableEntireAreaPopup?: boolean;
54
- delimiter?: string;
55
- hideClearButton?: boolean;
56
- showToolsWhenHover?: boolean;
57
- offset?: number;
58
- exceededSidePosOffset?: number;
59
- localization?: 'en_US' | 'zh_CN';
60
- type?: 'date' | 'datetime-local' | 'time';
61
- onlyTime?: boolean;
62
- truncateSeconds?: boolean;
63
- valueUseSlash?: boolean;
64
- defaultValue?: string;
65
- value?: string;
66
- clickInitValue?: string;
67
- min?: string;
68
- max?: string;
69
- placeholder?: string;
70
- label?: React.ReactNode | string;
71
- units?: string;
72
- name?: string;
73
- alt?: any;
74
- disabled?: any;
75
- requiredLabel?: React.ReactNode | string;
76
- required?: any;
77
- readOnly?: any;
78
- iconLeft?: React.ReactNode | string;
79
- iconRight?: React.ReactNode | string;
80
-
81
- /** -- */
82
- id?: string;
83
- style?: React.CSSProperties;
84
- autoComplete?: string;
85
- tabIndex?: number;
86
- [key: `data-${string}`]: string | undefined;
87
- onLoad?: (e: any, data: any, allSplittingInputs: any[]) => void;
88
- onChange?: (e: any, data: any, isValidDate: boolean, allSplittingInputs: any[]) => void;
89
- onBlur?: (e: any, allSplittingInputs: any[]) => void;
90
- onFocus?: (e: any, allSplittingInputs: any[]) => void;
91
- onPressEnter?: (e: any, allSplittingInputs: any[]) => void;
92
- onOpenPopup?: (allSplittingInputs: any[]) => void;
93
- onClosePopup?: (allSplittingInputs: any[]) => void;
94
- //
95
- onChangeDate?: (currentData: any) => void;
96
- onChangeMonth?: (currentData: any) => void;
97
- onChangeYear?: (currentData: any) => void;
98
- onChangeToday?: (currentData: any) => void;
99
- onChangeHours?: (currentData: any) => void;
100
- onChangeMinutes?: (currentData: any) => void;
101
- onChangeSeconds?: (currentData: any) => void;
102
- onClear?: (currentData: any) => void;
103
-
104
-
105
-
106
- // calendar
107
- langHoursTitle?: string;
108
- langMinutesTitle?: string;
109
- langSecondsTitle?: string;
110
- langWeek?: string[];
111
- langWeekFull?: string[];
112
- langMonths?: string[];
113
- langMonthsFull?: string[];
114
- langToday?: string;
115
- };
116
-
117
-
118
- const Date = forwardRef((props: DateProps, externalRef: any) => {
119
- const {
120
- contentRef,
121
- popupRef,
122
- depth,
123
- triggerClassName,
124
- popupClassName,
125
- wrapperClassName,
126
- controlClassName,
127
- controlGroupWrapperClassName,
128
- controlGroupTextClassName,
129
- enableEntireAreaPopup,
130
- delimiter,
131
- hideClearButton,
132
- showToolsWhenHover,
133
- offset,
134
- exceededSidePosOffset,
135
- localization,
136
- type,
137
- onlyTime,
138
- truncateSeconds,
139
- valueUseSlash,
140
- disabled,
141
- requiredLabel,
142
- required,
143
- readOnly,
144
- defaultValue,
145
- value,
146
- clickInitValue,
147
- min,
148
- max,
149
- placeholder,
150
- label,
151
- units,
152
- name,
153
- alt,
154
- id,
155
- iconLeft,
156
- iconRight,
157
- autoComplete,
158
- style,
159
- tabIndex,
160
- onLoad,
161
- onChange,
162
- onBlur,
163
- onFocus,
164
- onPressEnter,
165
- onOpenPopup,
166
- onClosePopup,
167
-
168
- //
169
- onChangeDate,
170
- onChangeMonth,
171
- onChangeYear,
172
- onChangeToday,
173
- onChangeHours,
174
- onChangeMinutes,
175
- onChangeSeconds,
176
- onClear,
177
-
178
-
179
- //calendar
180
- langHoursTitle,
181
- langMinutesTitle,
182
- langSecondsTitle,
183
- langWeek,
184
- langWeekFull,
185
- langMonths,
186
- langMonthsFull,
187
- langToday,
188
-
189
- //
190
- ...attributes
191
- } = props;
192
-
193
-
194
- const DEPTH = depth || 1055; // the default value same as bootstrap
195
- const defaultValueIsEmpty = (s: any) => {
196
- return typeof s === 'undefined' || s === null || s === 'null' || s === '';
197
- };
198
-
199
-
200
-
201
-
202
- // Localization
203
- let _langHoursTitle = langHoursTitle || 'Hours';
204
- let _langMinutesTitle = langMinutesTitle || 'Minutes';
205
- let _langSecondsTitle= langSecondsTitle || 'Seconds';
206
- let _langWeek = langWeek;
207
- let _langWeekFull = langWeekFull;
208
- let _langMonths = langMonths;
209
- let _langMonthsFull = langMonthsFull;
210
- let _langToday = langToday;
211
-
212
- //
213
- const DELIMITER_DATE = delimiter || '/';
214
- const DELIMITER_TIME = ':';
215
- const SHOW_TOOLS_ENABLED = !(typeof showToolsWhenHover === 'undefined' || showToolsWhenHover === false);
216
- const HIDE_CLEAR_BTN_ENABLED = !(typeof hideClearButton === 'undefined' || hideClearButton === false);
217
-
218
- //
219
- const COM_HAS_DATE = typeof onlyTime === 'undefined' || onlyTime === false;
220
- const COM_HAS_TIME = type === 'datetime-local' || type === 'time';
221
- const COM_NO_SECONDS = typeof truncateSeconds === 'undefined' || truncateSeconds === false;
222
-
223
-
224
-
225
- // placeholder
226
- let datePlaceholder = placeholder || placeholder === '' ? placeholder : 'yyyy/MM/dd HH:mm:ss';
227
-
228
- if (typeof placeholder === 'undefined') {
229
- datePlaceholder = `${COM_HAS_DATE ? 'yyyy/MM/dd ' : ''}${COM_HAS_TIME ? `HH:mm${COM_NO_SECONDS ? ':ss' : ''}` : ''}`;
230
- }
231
-
232
- if (typeof localization === 'string') {
233
-
234
- switch (localization) {
235
- case 'en_US':
236
- _langHoursTitle = i18n__en_US.hoursTitle;
237
- _langMinutesTitle = i18n__en_US.minutesTitle;
238
- _langSecondsTitle = i18n__en_US.secondsTitle;
239
- _langWeek = i18n__en_US.week;
240
- _langWeekFull = i18n__en_US.weekFull;
241
- _langMonths = i18n__en_US.months;
242
- _langMonthsFull = i18n__en_US.monthsFull;
243
- _langToday = i18n__en_US.today;
244
- break;
245
-
246
- case 'zh_CN':
247
- _langHoursTitle = i18n__zh_CN.hoursTitle;
248
- _langMinutesTitle = i18n__zh_CN.minutesTitle;
249
- _langSecondsTitle = i18n__zh_CN.secondsTitle;
250
- _langWeek = i18n__zh_CN.week;
251
- _langWeekFull = i18n__zh_CN.weekFull;
252
- _langMonths = i18n__zh_CN.months;
253
- _langMonthsFull = i18n__zh_CN.monthsFull;
254
- _langToday = i18n__zh_CN.today;
255
- break;
256
-
257
- }
258
-
259
- }
260
-
261
-
262
-
263
- //
264
- const POS_OFFSET = Number(offset) || 10;
265
- const EXCEEDED_SIDE_POS_OFFSET = Number(exceededSidePosOffset) || 15;
266
- const uniqueID = useComId();
267
- const idRes = id || uniqueID;
268
- const rootRef = useRef<any>(null);
269
- const modalRef = useRef<any>(null);
270
- const inputRef = useRef<any>(null);
271
- const listContentRef = useRef<any>(null);
272
-
273
- const partedInputYear = useRef<HTMLInputElement | null>(null);
274
- const partedInputMonth = useRef<HTMLInputElement | null>(null);
275
- const partedInputDay = useRef<HTMLInputElement | null>(null);
276
- const partedInputHours = useRef<HTMLInputElement | null>(null);
277
- const partedInputMinutes = useRef<HTMLInputElement | null>(null);
278
- const partedInputSeconds = useRef<HTMLInputElement | null>(null);
279
-
280
- const [dateDefaultValueExist, setDateDefaultValueExist] = useState<boolean>(false);
281
- const [initSplitClickEvOk, setInitSplitClickEvOk] = useState<boolean>(false);
282
- const [splitVals, setSplitVals] = useState<any[]>(['0000','00','00','00','00','00']);
283
- const [changedVal, setChangedVal] = useState<string>(value || '');
284
- const [isShow, setIsShow] = useState<boolean>(false);
285
- const [dateVal, setDateVal] = useState<string>('');
286
- const [timeVal, setTimeVal] = useState<string[]>(['00', '00', '00']);
287
-
288
- const hoursArr = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'];
289
- const msArr = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'];
290
-
291
- // blur for popup window
292
- const popupBlurEnabled = useRef<boolean>(false); // DO NOT USE 'useState()'
293
-
294
-
295
- // effective element movement on keystroke
296
- const [focusableSplitInputId, setFocusableSplitInputId] = useState<string>(COM_HAS_DATE ? 'el-year' : 'el-hours');
297
- const [splitInputsIds] = useState<string[]>(['el-year', 'el-month', 'el-day', 'el-hours', 'el-minutes', 'el-seconds']);
298
- const splitInputs = useRef(new Map<string, HTMLElement>());
299
- const splitInputsTabIndex = tabIndex || 0;
300
-
301
-
302
-
303
- //
304
- const getAllSplittingInputs = () => {
305
- return [
306
- partedInputYear.current,
307
- partedInputMonth.current,
308
- partedInputDay.current,
309
- partedInputHours.current,
310
- partedInputMinutes.current,
311
- partedInputSeconds.current
312
- ];
313
- };
314
-
315
- const onlyHHmm = (str: string) => {
316
- // match HH:mm
317
- const timePattern = /^([01]\d|2[0-3]):([0-5]\d)$/;
318
- return timePattern.test(str);
319
- };
320
-
321
-
322
- // exposes the following methods
323
- useImperativeHandle(
324
- popupRef,
325
- () => ({
326
- close: () => {
327
- popwinPosHide();
328
- handleBlur(null);
329
- }
330
- }),
331
- [popupRef],
332
- );
333
-
334
- useImperativeHandle(
335
- contentRef,
336
- () => ({
337
- control: () => {
338
- return getAllSplittingInputs();
339
- },
340
- clear: (cb?: any) => {
341
- clearAll();
342
- cb?.();
343
- },
344
- blur: (cb?: any) => {
345
- getAllSplittingInputs().forEach((el: any) => {
346
- if (el !== null) el.blur();
347
- });
348
-
349
- handleBlur(null);
350
- cb?.();
351
- },
352
- /*
353
- set('2024-04-18 21:54:09', () => { console.log('callback') }])
354
- */
355
- set: (value: any, cb?: any) => {
356
-
357
- const [curInitSplitClickEvOk, curNoTargetVal, curTargetVal] = getActualDefaultValue(value, true);
358
- setDateDefaultValueExist(defaultValueIsEmpty(value) ? false : true);
359
- initValue(curTargetVal);
360
-
361
- cb?.();
362
- }
363
- }),
364
- [contentRef],
365
- );
366
-
367
-
368
- // click outside
369
- useClickOutside({
370
- enabled: isShow && rootRef.current,
371
- isOutside: (event: any) => {
372
- return event.target.closest(`.date2d__wrapper`) === null && event.target.closest(`.date2d-cal__wrapper`) === null;
373
- },
374
- handle: (event: any) => {
375
- popwinPosHide();
376
-
377
- //remove focus style
378
- rootRef.current?.classList.remove('focus');
379
-
380
- // move out the popup window
381
- if (popupBlurEnabled.current) {
382
- onBlur?.(inputRef.current, getAllSplittingInputs());
383
- popupBlurEnabled.current = false;
384
- }
385
- }
386
- }, [isShow, rootRef]);
387
-
388
-
389
-
390
-
391
- // Add function to the element that should be used as the scrollable area.
392
- // const [scrollData, windowScrollUpdate] = useWindowScroll({
393
- // performance: ['debounce', 50], // "['debounce', 500]" or "['throttle', 500]"
394
- // handle: (scrollData: any) => {
395
- // popwinPosHide();
396
- // }
397
- // });
398
-
399
-
400
-
401
- const getFullTimeData = (v: Date | String, padZeroEnabled: boolean = true) => {
402
-
403
- if (typeof v === 'string' && !isValidDate(v)) {
404
- return {
405
- res: '0000-00-00 00:00:00',
406
- resNoSeconds: '0000-00-00 00:00',
407
- date: `0000-00-00`,
408
- year: `0000`,
409
- month: `00`,
410
- day: `00`,
411
- hours: `00`,
412
- minutes: `00`,
413
- seconds: `00`
414
- }
415
- }
416
-
417
- const date: any = dateFormat(v as any);
418
-
419
- const year = date.getFullYear();
420
- const month = padZero(date.getMonth() + 1, padZeroEnabled);
421
- const day = padZero(date.getDate(), padZeroEnabled);
422
- const hours = padZero(date.getHours(), padZeroEnabled);
423
- const minutes = padZero(date.getMinutes(), padZeroEnabled);
424
- const seconds = padZero(date.getSeconds(), padZeroEnabled);
425
- const res = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
426
- const res2 = `${year}-${month}-${day} ${hours}:${minutes}`;
427
-
428
- return {
429
- res: res,
430
- resNoSeconds: res2,
431
- date: `${year}-${month}-${day}`,
432
- year: `${year}`,
433
- month: `${month}`,
434
- day: `${day}`,
435
- hours: `${hours}`,
436
- minutes: `${minutes}`,
437
- seconds: `${seconds}`
438
- }
439
- };
440
-
441
-
442
- //
443
- const MIN: any = typeof min !== 'undefined' && min !== '' && min !== null && isValidDate(min) ? getFullTimeData(min) : '';
444
- const MAX: any = typeof max !== 'undefined' && max !== '' && max !== null && isValidDate(max) ? getFullTimeData(max) : '';
445
-
446
- const getActualDefaultValue = (v?: any, init: boolean = false) => {
447
- const _v = getFullTimeData(getNow());
448
- const _nowVal: any = `${_v.date} ${_v.hours}:${_v.minutes}:${_v.seconds}`;
449
-
450
- // expected default value (only HH:mm:ss)
451
- const _expectedValue = isTimeString(v) || onlyHHmm(v) ? `${_v.date} ${onlyHHmm(v) ? v + ':00' : v}` : v;
452
-
453
-
454
- if (!init) setInitSplitClickEvOk(true);
455
-
456
-
457
- if (!initSplitClickEvOk) {
458
-
459
-
460
- let noTargetVal = typeof clickInitValue === 'undefined' || clickInitValue === null || clickInitValue === 'null' || clickInitValue === '';
461
- if (!defaultValueIsEmpty(v)) {
462
- noTargetVal = true;
463
- }
464
-
465
- //
466
- let targetVal: any = noTargetVal ? (defaultValueIsEmpty(v) ? _nowVal : _expectedValue) : clickInitValue;
467
-
468
- if (typeof v === 'undefined') {
469
- targetVal = noTargetVal ? _nowVal : clickInitValue;
470
- }
471
-
472
- //
473
- return [false, noTargetVal, targetVal];
474
- } else {
475
-
476
-
477
- let targetVal: any = defaultValueIsEmpty(v) ? _nowVal : _expectedValue;
478
-
479
- if (typeof v === 'undefined') {
480
- targetVal = _nowVal;
481
- }
482
-
483
- return [true, true, targetVal];
484
- }
485
-
486
-
487
-
488
- };
489
-
490
-
491
-
492
- function popwinPosInit() {
493
-
494
- if (modalRef.current === null || listContentRef.current === null || inputRef.current === null) return;
495
-
496
-
497
- // update modal position
498
- const _modalRef: any = modalRef.current;
499
- const _triggerRef: any = inputRef.current;
500
-
501
- // console.log(getAbsolutePositionOfStage(_triggerRef));
502
-
503
- if (_modalRef === null) return;
504
-
505
- const { x, y, width, height } = getAbsolutePositionOfStage(_triggerRef);
506
- const _triggerBox = _triggerRef.getBoundingClientRect();
507
- let targetPos = '';
508
-
509
-
510
- // STEP 1:
511
- //-----------
512
- // Detect position
513
- if (window.innerHeight - _triggerBox.top > 100) {
514
- targetPos = 'bottom';
515
- } else {
516
- targetPos = 'top';
517
- }
518
-
519
- // STEP 2:
520
- //-----------
521
- // Adjust position
522
- if (targetPos === 'top') {
523
- _modalRef.style.left = x + 'px';
524
- //_modalRef.style.top = y - POS_OFFSET - (listContentRef.current.clientHeight) - 2 + 'px';
525
- _modalRef.style.marginTop = 0;
526
- _modalRef.style.top = 'auto';
527
- _modalRef.style.bottom = (window.innerHeight - _triggerBox.top) + POS_OFFSET + 2 + 'px';
528
- _modalRef.style.setProperty('position', 'fixed', 'important');
529
- _modalRef.style.setProperty('position', 'fixed', 'important');
530
- _modalRef.classList.add('pos-top');
531
- }
532
-
533
- if (targetPos === 'bottom') {
534
- _modalRef.style.marginTop = 0;
535
- _modalRef.style.left = x + 'px';
536
- _modalRef.style.bottom = 'auto';
537
- _modalRef.style.top = y + height + POS_OFFSET + 'px';
538
- _modalRef.style.setProperty('position', 'absolute', 'important');
539
- _modalRef.classList.remove('pos-top');
540
- }
541
-
542
- // STEP 3:
543
- //-----------
544
- // Determine whether it exceeds the far right or left side of the screen
545
- // Determine whether it exceeds the max height of the popup
546
- const _modalContent = _modalRef;
547
- const _modalBox = _modalContent.getBoundingClientRect();
548
- if (typeof _modalContent.dataset.offset === 'undefined' && _modalBox.left > 0) {
549
-
550
- // 10 pixels is used to account for some bias in mobile devices
551
- if ((_modalBox.right + 10) > window.innerWidth) {
552
- const _modalOffsetPosition = _modalBox.right - window.innerWidth + EXCEEDED_SIDE_POS_OFFSET;
553
- _modalContent.dataset.offset = _modalOffsetPosition;
554
- _modalContent.style.marginLeft = `-${_modalOffsetPosition}px`;
555
- // console.log('_modalPosition: ', _modalOffsetPosition)
556
- }
557
-
558
-
559
- if ((_modalBox.left - 10) < 0) {
560
- const _modalOffsetPosition = Math.abs(_modalBox.left) + EXCEEDED_SIDE_POS_OFFSET;
561
- _modalContent.dataset.offset = _modalOffsetPosition;
562
- _modalContent.style.marginLeft = `${_modalOffsetPosition}px`;
563
- // console.log('_modalPosition: ', _modalOffsetPosition)
564
- }
565
-
566
- if (window.innerHeight - _modalBox.bottom < 0) {
567
- _modalRef.style.marginTop = `${window.innerHeight - _modalBox.bottom}px`;
568
- }
569
-
570
- }
571
-
572
- }
573
-
574
- function popwinPosHide() {
575
- setIsShow(false);
576
- onClosePopup?.(getAllSplittingInputs());
577
-
578
- }
579
-
580
-
581
-
582
- function handleShow() {
583
- setIsShow(true);
584
-
585
- setTimeout(() => {
586
- popwinPosInit();
587
-
588
- onOpenPopup?.(getAllSplittingInputs());
589
-
590
- }, 0);
591
-
592
- // focus
593
- handleFocus(null);
594
-
595
- }
596
-
597
-
598
- function handleFocus(event: FocusEvent<HTMLElement> | null) {
599
- rootRef.current?.classList.add('focus');
600
-
601
-
602
- //
603
- onFocus?.(inputRef.current, getAllSplittingInputs());
604
-
605
- }
606
-
607
- function handleChange(event: ChangeEvent<HTMLInputElement>) {
608
- const val = event.target.value;
609
-
610
- //
611
- onChange?.(inputRef.current, val, isValidDate(val), getAllSplittingInputs());
612
-
613
- }
614
-
615
-
616
- function handleBlur(event: FocusEvent<HTMLElement> | null) {
617
-
618
- //remove focus style
619
- rootRef.current?.classList.remove('focus');
620
-
621
- //
622
- onBlur?.(inputRef.current, getAllSplittingInputs());
623
- }
624
-
625
-
626
- function handleInitSplitClickEv(e: any) {
627
- e.preventDefault();
628
- e.stopPropagation(); // Avoid triggering other inputs
629
-
630
- e.target.select();
631
-
632
- resetDefauleValueExist();
633
-
634
-
635
- const _date = `${splitVals[0]}-${splitVals[1]}-${splitVals[2]}`;
636
- const _full = `${_date} ${splitVals[3]}:${splitVals[4]}:${splitVals[5]}`;
637
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
638
-
639
- }
640
-
641
- async function handleKeyPressed(event: KeyboardEvent<HTMLDivElement>) {
642
- const key = event.code;
643
-
644
- if (key === 'Enter' || key === 'NumpadEnter') {
645
- event.preventDefault();
646
-
647
- getAllSplittingInputs().forEach((el: any) => {
648
- if (el !== null) el.blur();
649
- });
650
-
651
- handleBlur(null);
652
-
653
- //
654
- onPressEnter?.(inputRef.current, getAllSplittingInputs());
655
- }
656
- }
657
-
658
- async function handleKeyPressedForSplitInputs(event: KeyboardEvent<HTMLDivElement>) {
659
- const key = event.code;
660
- const btnMark = (event.target as any).dataset.mark;
661
- const move = (key: string) => {
662
- const currentIndex = splitInputsIds.findIndex((s: string) => s === btnMark);
663
- const nextIndex = key === 'ArrowLeft' ? currentIndex === splitInputsIds.length - 1 ? 0 : currentIndex - 1 : currentIndex === splitInputsIds.length - 1 ? 0 : currentIndex + 1;
664
- const nextOption = splitInputsIds.at(nextIndex);
665
- if (nextOption) {
666
- setTimeout(() => {
667
- (splitInputs.current.get(nextOption) as HTMLInputElement)?.select();
668
- }, 0);
669
- setFocusableSplitInputId(nextOption);
670
- }
671
- };
672
-
673
- if (key === 'ArrowLeft') {
674
- move('ArrowLeft');
675
- }
676
-
677
- if (key === 'ArrowRight') {
678
- move('ArrowRight');
679
- }
680
- }
681
-
682
-
683
- function clearAll() {
684
- setDateDefaultValueExist(false);
685
- onChange?.(inputRef.current, '', false, getAllSplittingInputs());
686
- }
687
-
688
-
689
-
690
- function resetDefauleValueExist() {
691
- if (!dateDefaultValueExist) setDateDefaultValueExist(true);
692
- }
693
-
694
- function resetPopupBlurStatus() {
695
- if (!popupBlurEnabled.current) popupBlurEnabled.current = true;
696
- }
697
-
698
-
699
- function valueResConverter(inputData: any) {
700
- const v = isValidDate(inputData) ? inputData : `${getFullTimeData(getNow()).date} ${inputData}`;
701
-
702
-
703
- const _onlyTime = `${getFullTimeData(v).hours}:${getFullTimeData(v).minutes}${truncateSeconds ? `` : `:${getFullTimeData(v).seconds}`}`;
704
- const _date = `${getFullTimeData(v).year}${valueUseSlash ? `/` : '-'}${getFullTimeData(v).month}${valueUseSlash ? `/` : '-'}${getFullTimeData(v).day}`;
705
- const _time = COM_HAS_TIME ? ` ${getFullTimeData(v).hours}:${getFullTimeData(v).minutes}${truncateSeconds ? `` : `:${getFullTimeData(v).seconds}`}` : '';
706
-
707
- return onlyTime ? _onlyTime : `${_date}${_time}`;
708
- }
709
-
710
-
711
-
712
- function checkDisabledSeconds(curYear: number | string, curMonth: number, curDay: number | string, curHours: number | string, curMinutes: number | string, curSeconds: number | string) {
713
- let res: boolean = false;
714
-
715
- // maximum
716
- if (MAX !== '') {
717
- if (Number(curYear) > Number(MAX.year)) {
718
- res = true;
719
- }
720
-
721
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) > Number(MAX.month)) {
722
- res = true;
723
- }
724
-
725
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) > Number(MAX.day)) {
726
- res = true;
727
- }
728
-
729
-
730
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) === Number(MAX.day) && Number(curHours) > Number(MAX.hours) ) {
731
- res = true;
732
- }
733
-
734
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) === Number(MAX.day) && Number(curHours) === Number(MAX.hours) && Number(curMinutes) > Number(MAX.minutes) ) {
735
- res = true;
736
- }
737
-
738
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) === Number(MAX.day) && Number(curHours) === Number(MAX.hours) && Number(curMinutes) === Number(MAX.minutes) && Number(curSeconds) > Number(MAX.seconds) ) {
739
- res = true;
740
- }
741
- }
742
-
743
- // minimum
744
- if (MIN !== '') {
745
- if (Number(curYear) < Number(MIN.year)) {
746
- res = true;
747
- }
748
-
749
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) < Number(MIN.month)) {
750
- res = true;
751
- }
752
-
753
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) < Number(MIN.day)) {
754
- res = true;
755
- }
756
-
757
-
758
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) === Number(MIN.day) && Number(curHours) < Number(MIN.hours) ) {
759
- res = true;
760
- }
761
-
762
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) === Number(MIN.day) && Number(curHours) === Number(MIN.hours) && Number(curMinutes) < Number(MIN.minutes) ) {
763
- res = true;
764
- }
765
-
766
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) === Number(MIN.day) && Number(curHours) === Number(MIN.hours) && Number(curMinutes) === Number(MIN.minutes) && Number(curSeconds) < Number(MIN.seconds) ) {
767
- res = true;
768
- }
769
- }
770
-
771
-
772
- return res;
773
- }
774
-
775
-
776
- function checkDisabledMinutes(curYear: number | string, curMonth: number, curDay: number | string, curHours: number | string, curMinutes: number | string) {
777
- let res: boolean = false;
778
-
779
- // maximum
780
- if (MAX !== '') {
781
- if (Number(curYear) > Number(MAX.year)) {
782
- res = true;
783
- }
784
-
785
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) > Number(MAX.month)) {
786
- res = true;
787
- }
788
-
789
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) > Number(MAX.day)) {
790
- res = true;
791
- }
792
-
793
-
794
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) === Number(MAX.day) && Number(curHours) > Number(MAX.hours) ) {
795
- res = true;
796
- }
797
-
798
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) === Number(MAX.day) && Number(curHours) === Number(MAX.hours) && Number(curMinutes) > Number(MAX.minutes) ) {
799
- res = true;
800
- }
801
- }
802
-
803
- // minimum
804
- if (MIN !== '') {
805
- if (Number(curYear) < Number(MIN.year)) {
806
- res = true;
807
- }
808
-
809
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) < Number(MIN.month)) {
810
- res = true;
811
- }
812
-
813
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) < Number(MIN.day)) {
814
- res = true;
815
- }
816
-
817
-
818
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) === Number(MIN.day) && Number(curHours) < Number(MIN.hours) ) {
819
- res = true;
820
- }
821
-
822
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) === Number(MIN.day) && Number(curHours) === Number(MIN.hours) && Number(curMinutes) < Number(MIN.minutes) ) {
823
- res = true;
824
- }
825
- }
826
-
827
-
828
- return res;
829
- }
830
-
831
-
832
- function checkDisabledHours(curYear: number | string, curMonth: number, curDay: number | string, curHours: number | string) {
833
- let res: boolean = false;
834
-
835
- // maximum
836
- if (MAX !== '') {
837
- if (Number(curYear) > Number(MAX.year)) {
838
- res = true;
839
- }
840
-
841
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) > Number(MAX.month)) {
842
- res = true;
843
- }
844
-
845
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) > Number(MAX.day)) {
846
- res = true;
847
- }
848
-
849
-
850
- if (Number(curYear) === Number(MAX.year) && Number(curMonth+1) === Number(MAX.month) && Number(curDay) === Number(MAX.day) && Number(curHours) > Number(MAX.hours) ) {
851
- res = true;
852
- }
853
- }
854
-
855
- // minimum
856
- if (MIN !== '') {
857
- if (Number(curYear) < Number(MIN.year)) {
858
- res = true;
859
- }
860
-
861
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) < Number(MIN.month)) {
862
- res = true;
863
- }
864
-
865
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) < Number(MIN.day)) {
866
- res = true;
867
- }
868
-
869
-
870
- if (Number(curYear) === Number(MIN.year) && Number(curMonth+1) === Number(MIN.month) && Number(curDay) === Number(MIN.day) && Number(curHours) < Number(MIN.hours) ) {
871
- res = true;
872
- }
873
- }
874
-
875
- return res;
876
- }
877
-
878
- function initValue(v: any) {
879
- const _res = valueResConverter(v);
880
-
881
- setChangedVal(_res);
882
-
883
- if (isValidDate(v)) {
884
-
885
- const {
886
- date,
887
- year,
888
- month,
889
- day,
890
- hours,
891
- minutes,
892
- seconds
893
- } = getFullTimeData(v);
894
-
895
-
896
- setDateVal(date);
897
- setTimeVal([hours, minutes, seconds]);
898
- setSplitVals([year, month, day, hours, minutes, seconds]);
899
- }
900
-
901
- return [_res, v]
902
-
903
- }
904
-
905
-
906
- useEffect(() => {
907
-
908
-
909
- // update default value
910
- //--------------
911
- const [curInitSplitClickEvOk, curNoTargetVal, curTargetVal] = getActualDefaultValue(value, true);
912
- setDateDefaultValueExist(defaultValueIsEmpty(value) ? false : true);
913
- const [a, b] = initValue(curTargetVal);
914
- onLoad?.(a, getFullTimeData(b), getAllSplittingInputs());
915
-
916
-
917
- }, [value]);
918
-
919
- useEffect(() => {
920
-
921
- // update default value (It does not re-render the component because the incoming value changes.)
922
- //--------------
923
- if (typeof defaultValue !== 'undefined') { //REQUIRED
924
- const [curInitSplitClickEvOk, curNoTargetVal, curTargetVal] = getActualDefaultValue(defaultValue, true);
925
- setDateDefaultValueExist(defaultValueIsEmpty(defaultValue) ? false : true);
926
- const [a, b] = initValue(curTargetVal);
927
- onLoad?.(a, getFullTimeData(b), getAllSplittingInputs());
928
- }
929
-
930
- }, []);
931
-
932
-
933
- return (
934
- <>
935
-
936
- {label ? <>{typeof label === 'string' ? <div className="date2d__label"><label htmlFor={idRes} className="form-label" dangerouslySetInnerHTML={{ __html: `${label}` }}></label></div> : <div className="date2d__label"><label htmlFor={idRes} className="form-label">{label}</label></div>}</> : null}
937
-
938
-
939
- <div
940
- ref={rootRef}
941
- data-overlay-id={`date2d__wrapper-${idRes}`}
942
- className={combinedCls(
943
- 'date2d__trigger d-inline-block',
944
- `is-${type}`,
945
- triggerClassName,
946
- {
947
- 'date2d__trigger--hover-show-tools': SHOW_TOOLS_ENABLED
948
- }
949
- )}
950
- onFocus={handleFocus}
951
- onBlur={handleBlur}
952
- onKeyDown={handleKeyPressed}
953
- onClick={enableEntireAreaPopup ? handleShow : () => {}}
954
-
955
- >
956
-
957
-
958
- <div className="date2d__control">
959
- <Input
960
- ref={(node) => {
961
- inputRef.current = node;
962
- if (typeof externalRef === 'function') {
963
- externalRef(node);
964
- } else if (externalRef) {
965
- externalRef.current = node;
966
- }
967
- }}
968
- tabIndex={-1}
969
- type="text"
970
- inputMode="none"
971
- data-date-info={JSON.stringify(getFullTimeData(changedVal))}
972
- wrapperClassName={wrapperClassName}
973
- controlClassName={controlClassName}
974
- controlExClassName=""
975
- controlGroupWrapperClassName={controlGroupWrapperClassName}
976
- controlGroupTextClassName={controlGroupTextClassName}
977
- id={idRes}
978
- name={name}
979
- alt={alt}
980
- placeholder={datePlaceholder}
981
- value={!dateDefaultValueExist ? `` : valueResConverter(changedVal)}
982
- autoComplete="off"
983
- onChange={handleChange}
984
- label=""
985
- units={units}
986
- iconLeft={iconLeft}
987
- iconRight={iconRight}
988
- requiredLabel={requiredLabel}
989
- required={required}
990
- appendControl={<>
991
- <div className="date2d__control__inputplaceholder">
992
-
993
-
994
- {/*
995
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
996
- +++++++++++++++++++ Split Inputs +++++++++++++++++++++++++++++
997
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
998
- */}
999
- {COM_HAS_DATE ? <>
1000
- <input
1001
- ref={(node) => {
1002
- partedInputYear.current = node;
1003
- if (node) {
1004
- splitInputs.current.set(splitInputsIds[0], node);
1005
- } else {
1006
- splitInputs.current.delete(splitInputsIds[0]);
1007
- }
1008
- }}
1009
- tabIndex={splitInputsTabIndex}
1010
- data-mark={`${splitInputsIds[0]}`}
1011
- onKeyDown={handleKeyPressedForSplitInputs}
1012
- inputMode="numeric"
1013
- className="date2d__control__inputplaceholder--year"
1014
- value={!dateDefaultValueExist ? `` : splitVals[0]}
1015
- maxLength={4}
1016
- autoComplete="off"
1017
- disabled={disabled || null}
1018
- readOnly={readOnly || null}
1019
- onClick={handleInitSplitClickEv}
1020
- onChange={(e: any) => {
1021
- let _val = e.target.value;
1022
- if (_val !== '' && !isValidYear(_val) && isNumeric(_val) && Number(_val) > 9999) _val = '9999';
1023
- if (_val !== '' && !isValidYear(_val) && !isNumeric(_val)) _val = `${getCurrentYear()}`;
1024
-
1025
-
1026
- const _date = `${_val}-${splitVals[1]}-${splitVals[2]}`;
1027
- const _full = `${_date} ${splitVals[3]}:${splitVals[4]}:${splitVals[5]}`;
1028
-
1029
-
1030
-
1031
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
1032
- setSplitVals((prevState: string[]) => {
1033
- return [_val, prevState[1], prevState[2], prevState[3], prevState[4], prevState[5]];
1034
- });
1035
-
1036
- // update other data
1037
- setDateVal(_date);
1038
- setChangedVal(_full);
1039
- setTimeVal([splitVals[3], splitVals[4], splitVals[5]]);
1040
-
1041
-
1042
- }}
1043
- {...attributes}
1044
- />
1045
- {dateDefaultValueExist ? DELIMITER_DATE : null}
1046
- <input
1047
- ref={(node) => {
1048
- partedInputMonth.current = node;
1049
- if (node) {
1050
- splitInputs.current.set(splitInputsIds[1], node);
1051
- } else {
1052
- splitInputs.current.delete(splitInputsIds[1]);
1053
- }
1054
- }}
1055
- tabIndex={splitInputsTabIndex}
1056
- data-mark={`${splitInputsIds[1]}`}
1057
- onKeyDown={handleKeyPressedForSplitInputs}
1058
- inputMode="numeric"
1059
- className="date2d__control__inputplaceholder--month"
1060
- value={!dateDefaultValueExist ? `` : splitVals[1]}
1061
- maxLength={2}
1062
- autoComplete="off"
1063
- disabled={disabled || null}
1064
- readOnly={readOnly || null}
1065
- onClick={handleInitSplitClickEv}
1066
- onChange={(e: any) => {
1067
- let _val = e.target.value;
1068
- if (_val !== '' && !isValidMonth(_val) && isNumeric(_val)) {
1069
- if (Number(_val) > 12) _val = '12';
1070
- if (Number(_val) < 1 && Number(_val) > 0) _val = '01';
1071
- }
1072
- if (_val !== '' && !isValidMonth(_val) && !isNumeric(_val)) _val = `${getCurrentMonth()}`;
1073
-
1074
-
1075
-
1076
- const _date = `${splitVals[0]}-${_val}-${splitVals[2]}`;
1077
- const _full = `${_date} ${splitVals[3]}:${splitVals[4]}:${splitVals[5]}`;
1078
-
1079
-
1080
-
1081
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
1082
- setSplitVals((prevState: string[]) => {
1083
- return [prevState[0], _val, prevState[2], prevState[3], prevState[4], prevState[5]];
1084
- });
1085
-
1086
- // update other data
1087
- setDateVal(_date);
1088
- setChangedVal(_full);
1089
- setTimeVal([splitVals[3], splitVals[4], splitVals[5]]);
1090
-
1091
- }}
1092
- {...attributes}
1093
- />
1094
- {dateDefaultValueExist ? DELIMITER_DATE : null}
1095
- <input
1096
- ref={(node) => {
1097
- partedInputDay.current = node;
1098
- if (node) {
1099
- splitInputs.current.set(splitInputsIds[2], node);
1100
- } else {
1101
- splitInputs.current.delete(splitInputsIds[2]);
1102
- }
1103
- }}
1104
- tabIndex={splitInputsTabIndex}
1105
- data-mark={`${splitInputsIds[2]}`}
1106
- onKeyDown={handleKeyPressedForSplitInputs}
1107
- inputMode="numeric"
1108
- className="date2d__control__inputplaceholder--day"
1109
- value={!dateDefaultValueExist ? `` : splitVals[2]}
1110
- maxLength={2}
1111
- autoComplete="off"
1112
- disabled={disabled || null}
1113
- readOnly={readOnly || null}
1114
- onClick={handleInitSplitClickEv}
1115
- onChange={(e: any) => {
1116
- let _val = e.target.value;
1117
-
1118
- const _day = `${splitVals[0]}-${splitVals[1]}-01`;
1119
- const d = getLastDayInMonth(_day, new window.Date(_day).getMonth() + 1);
1120
-
1121
- if (_val !== '' && isValidDay(_val) && isNumeric(_val)) {
1122
- if (Number(_val) > Number(d)) _val = `${d}`;
1123
- }
1124
-
1125
- if (_val !== '' && !isValidDay(_val) && isNumeric(_val)) {
1126
- if (Number(_val) > Number(d)) _val = `${d}`;
1127
- if (Number(_val) < 1 && Number(_val) > 0) _val = '01';
1128
- }
1129
- if (_val !== '' && !isValidDay(_val) && !isNumeric(_val)) _val = `${getCurrentDay()}`;
1130
-
1131
-
1132
- const _date = `${splitVals[0]}-${splitVals[1]}-${_val}`;
1133
- const _full = `${_date} ${splitVals[3]}:${splitVals[4]}:${splitVals[5]}`;
1134
-
1135
-
1136
-
1137
-
1138
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
1139
- setSplitVals((prevState: string[]) => {
1140
- return [prevState[0], prevState[1], _val, prevState[3], prevState[4], prevState[5]];
1141
- });
1142
-
1143
- // update other data
1144
- setDateVal(_date);
1145
- setChangedVal(_full);
1146
- setTimeVal([splitVals[3], splitVals[4], splitVals[5]]);
1147
-
1148
-
1149
- }}
1150
- {...attributes}
1151
- />
1152
- &nbsp;
1153
-
1154
- </> : null}
1155
-
1156
- {COM_HAS_TIME ? <>
1157
- {/* TIME CONTROL */}
1158
- <input
1159
- ref={(node) => {
1160
- partedInputHours.current = node;
1161
- if (node) {
1162
- splitInputs.current.set(splitInputsIds[3], node);
1163
- } else {
1164
- splitInputs.current.delete(splitInputsIds[3]);
1165
- }
1166
- }}
1167
- tabIndex={splitInputsTabIndex}
1168
- data-mark={`${splitInputsIds[3]}`}
1169
- onKeyDown={handleKeyPressedForSplitInputs}
1170
- inputMode="numeric"
1171
- className="date2d__control__inputplaceholder--hours"
1172
- value={!dateDefaultValueExist ? `` : splitVals[3]}
1173
- maxLength={2}
1174
- autoComplete="off"
1175
- disabled={disabled || null}
1176
- readOnly={readOnly || null}
1177
- onClick={handleInitSplitClickEv}
1178
- onChange={(e: any) => {
1179
- let _val = e.target.value;
1180
- if (_val !== '' && !isValidHours(_val) && isNumeric(_val) && Number(_val) > 23) _val = '23';
1181
- if (_val !== '' && !isValidHours(_val) && !isNumeric(_val)) _val = '00';
1182
-
1183
-
1184
- const _date = `${splitVals[0]}-${splitVals[1]}-${splitVals[2]}`;
1185
- const _full = `${_date} ${_val}:${splitVals[4]}:${splitVals[5]}`;
1186
-
1187
-
1188
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
1189
- setSplitVals((prevState: string[]) => {
1190
- return [prevState[0], prevState[1], prevState[2], _val, prevState[4], prevState[5]];
1191
- });
1192
-
1193
- // update other data
1194
- setDateVal(_date);
1195
- setChangedVal(_full);
1196
- setTimeVal([_val, splitVals[4], splitVals[5]]);
1197
-
1198
-
1199
- }}
1200
- {...attributes}
1201
- />
1202
- {/* TIME CONTROL */}
1203
-
1204
- {/* TIME CONTROL */}
1205
- {dateDefaultValueExist ? DELIMITER_TIME : null}
1206
- <input
1207
- ref={(node) => {
1208
- partedInputMinutes.current = node;
1209
- if (node) {
1210
- splitInputs.current.set(splitInputsIds[4], node);
1211
- } else {
1212
- splitInputs.current.delete(splitInputsIds[4]);
1213
- }
1214
- }}
1215
- tabIndex={splitInputsTabIndex}
1216
- data-mark={`${splitInputsIds[4]}`}
1217
- onKeyDown={handleKeyPressedForSplitInputs}
1218
- inputMode="numeric"
1219
- className="date2d__control__inputplaceholder--minutes"
1220
- value={!dateDefaultValueExist ? `` : splitVals[4]}
1221
- maxLength={2}
1222
- autoComplete="off"
1223
- disabled={disabled || null}
1224
- readOnly={readOnly || null}
1225
- onClick={handleInitSplitClickEv}
1226
- onChange={(e: any) => {
1227
- let _val = e.target.value;
1228
- if (_val !== '' && !isValidMinutesAndSeconds(_val) && isNumeric(_val) && Number(_val) > 59) _val = '59';
1229
- if (_val !== '' && !isValidMinutesAndSeconds(_val) && !isNumeric(_val)) _val = '00';
1230
-
1231
-
1232
- const _date = `${splitVals[0]}-${splitVals[1]}-${splitVals[2]}`;
1233
- const _full = `${_date} ${splitVals[3]}:${_val}:${splitVals[5]}`;
1234
-
1235
-
1236
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
1237
- setSplitVals((prevState: string[]) => {
1238
- return [prevState[0], prevState[1], prevState[2], prevState[3], _val, prevState[5]];
1239
- });
1240
-
1241
- // update other data
1242
- setDateVal(_date);
1243
- setChangedVal(_full);
1244
- setTimeVal([splitVals[3], _val, splitVals[5]]);
1245
-
1246
-
1247
- }}
1248
- {...attributes}
1249
- />
1250
- {/* TIME CONTROL */}
1251
-
1252
-
1253
- {/* TIME CONTROL */}
1254
- {(COM_NO_SECONDS) ? <>
1255
- {dateDefaultValueExist ? DELIMITER_TIME : null}
1256
- <input
1257
- ref={(node) => {
1258
- partedInputSeconds.current = node;
1259
- if (node) {
1260
- splitInputs.current.set(splitInputsIds[5], node);
1261
- } else {
1262
- splitInputs.current.delete(splitInputsIds[5]);
1263
- }
1264
- }}
1265
- tabIndex={splitInputsTabIndex}
1266
- data-mark={`${splitInputsIds[5]}`}
1267
- onKeyDown={handleKeyPressedForSplitInputs}
1268
- inputMode="numeric"
1269
- className="date2d__control__inputplaceholder--seconds"
1270
- value={!dateDefaultValueExist ? `` : splitVals[5]}
1271
- maxLength={2}
1272
- autoComplete="off"
1273
- disabled={disabled || null}
1274
- readOnly={readOnly || null}
1275
- onClick={handleInitSplitClickEv}
1276
- onChange={(e: any) => {
1277
- let _val = e.target.value;
1278
- if (_val !== '' && !isValidMinutesAndSeconds(_val) && isNumeric(_val) && Number(_val) > 59) _val = '59';
1279
- if (_val !== '' && !isValidMinutesAndSeconds(_val) && !isNumeric(_val)) _val = '00';
1280
-
1281
-
1282
- const _date = `${splitVals[0]}-${splitVals[1]}-${splitVals[2]}`;
1283
- const _full = `${_date} ${splitVals[3]}:${splitVals[4]}:${_val}`;
1284
-
1285
-
1286
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full), getAllSplittingInputs());
1287
- setSplitVals((prevState: string[]) => {
1288
- return [prevState[0], prevState[1], prevState[2], prevState[3], prevState[4], _val];
1289
- });
1290
-
1291
-
1292
- // update other data
1293
- setDateVal(_date);
1294
- setChangedVal(_full);
1295
- setTimeVal([splitVals[3], splitVals[4], _val]);
1296
-
1297
- }}
1298
- {...attributes}
1299
- />
1300
- </> : null}
1301
- {/* TIME CONTROL */}
1302
- </> : null}
1303
-
1304
-
1305
- {/*
1306
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1307
- +++++++++++++++++++ /Split Inputs +++++++++++++++++++++++++++++
1308
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1309
- */}
1310
-
1311
- </div>
1312
- </>}
1313
- style={style}
1314
- {...attributes}
1315
- />
1316
-
1317
- {/* TOOLS */}
1318
- <span className={combinedCls(
1319
- 'date2d__control-tools',
1320
- {
1321
- 'date2d__control-tools--hover-show-tools': SHOW_TOOLS_ENABLED
1322
- }
1323
-
1324
- )}>
1325
-
1326
- <a
1327
- tabIndex={-1}
1328
- href="#"
1329
- className={combinedCls(
1330
- 'date2d__control-tools__close',
1331
- {
1332
- 'd-none': HIDE_CLEAR_BTN_ENABLED || !dateDefaultValueExist
1333
- }
1334
- )} onClick={(e: React.MouseEvent) => {
1335
- e.preventDefault();
1336
- e.stopPropagation(); // Avoid triggering pop-ups
1337
-
1338
- clearAll();
1339
- onClear?.(getFullTimeData(''));
1340
- }}
1341
- ><svg width="12px" height="12px" viewBox="0 0 1024 1024"><path fill="#000" d="M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z" /></svg></a>
1342
-
1343
- <a
1344
- tabIndex={-1}
1345
- href="#"
1346
- className="date2d__control-tools__trigger"
1347
- onClick={(e: React.MouseEvent) => {
1348
- e.preventDefault();
1349
- e.stopPropagation(); // Avoid triggering pop-ups
1350
-
1351
- handleShow();
1352
- }}
1353
- >
1354
- <svg width="14px" height="14px" viewBox="0 0 24 24" fill="none">
1355
- <path d="M3 9H21M9 15L11 17L15 13M7 3V5M17 3V5M6.2 21H17.8C18.9201 21 19.4802 21 19.908 20.782C20.2843 20.5903 20.5903 20.2843 20.782 19.908C21 19.4802 21 18.9201 21 17.8V8.2C21 7.07989 21 6.51984 20.782 6.09202C20.5903 5.71569 20.2843 5.40973 19.908 5.21799C19.4802 5 18.9201 5 17.8 5H6.2C5.0799 5 4.51984 5 4.09202 5.21799C3.71569 5.40973 3.40973 5.71569 3.21799 6.09202C3 6.51984 3 7.07989 3 8.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z" stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
1356
- </svg>
1357
- </a>
1358
-
1359
- </span>
1360
- {/* /TOOLS */}
1361
-
1362
-
1363
- </div>
1364
-
1365
-
1366
-
1367
- </div>
1368
-
1369
-
1370
- <RootPortal show={isShow} containerClassName={combinedCls(
1371
- 'Date',
1372
- `Date--${type}`
1373
- )}>
1374
- <div
1375
- ref={modalRef}
1376
- id={`date2d__wrapper-${idRes}`}
1377
- className={combinedCls(
1378
- 'date2d__wrapper',
1379
- `is-${type}`,
1380
- popupClassName,
1381
- 'active'
1382
- )}
1383
- style={{
1384
- display: 'none',
1385
- zIndex: DEPTH
1386
- }}
1387
- {...attributes}
1388
- >
1389
-
1390
-
1391
- <div
1392
- ref={listContentRef}
1393
- className="date2d__tools-container d-flex flex-row"
1394
- >
1395
- {/* CALENDAR */}
1396
- {COM_HAS_DATE ? <>
1397
- <div className="date2d__calendar">
1398
- <Calendar
1399
- min={min}
1400
- max={max}
1401
- customTodayDate={changedVal}
1402
- langWeek={_langWeek}
1403
- langWeekFull={_langWeekFull}
1404
- langMonths={_langMonths}
1405
- langMonthsFull={_langMonthsFull}
1406
- langToday={_langToday}
1407
- onChangeDate={(e: any, currentData: any) => {
1408
- resetDefauleValueExist();
1409
-
1410
- //
1411
- const _v = getFullTimeData(`${currentData.date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1412
- setDateVal(currentData.date);
1413
- setChangedVal(`${currentData.date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1414
- setSplitVals((prevState: string[]) => {
1415
- return [_v.year, _v.month, _v.day, prevState[3], prevState[4], prevState[5]];
1416
- });
1417
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1418
-
1419
- //
1420
- onChangeDate?.(_v);
1421
-
1422
- //
1423
- resetPopupBlurStatus();
1424
-
1425
-
1426
- }}
1427
- onChangeToday={(currentData: any) => {
1428
- resetDefauleValueExist();
1429
-
1430
- //
1431
- const _date = `${currentData.year}-${currentData.month}-${currentData.day}`;
1432
- const _v = getFullTimeData(`${_date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1433
- setDateVal(`${_date}`);
1434
- setChangedVal(`${_date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1435
- setSplitVals((prevState: string[]) => {
1436
- return [_v.year, _v.month, _v.day, prevState[3], prevState[4], prevState[5]];
1437
- });
1438
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1439
-
1440
- //
1441
- onChangeToday?.(_v);
1442
-
1443
- //
1444
- resetPopupBlurStatus();
1445
-
1446
- }}
1447
- onChangeMonth={(currentData: any) => {
1448
- resetDefauleValueExist();
1449
-
1450
- //
1451
- const _date = `${currentData.year}-${currentData.month}-${currentData.day}`;
1452
- const _v = getFullTimeData(`${_date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1453
- setDateVal(_date);
1454
- setChangedVal(`${_date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1455
- setSplitVals((prevState: string[]) => {
1456
- return [_v.year, _v.month, _v.day, prevState[3], prevState[4], prevState[5]];
1457
- });
1458
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1459
-
1460
- //
1461
- onChangeMonth?.(_v);
1462
-
1463
- //
1464
- resetPopupBlurStatus();
1465
-
1466
- }}
1467
- onChangeYear={(currentData: any) => {
1468
- resetDefauleValueExist();
1469
-
1470
- //
1471
- const _date = `${currentData.year}-${currentData.month}-${currentData.day}`;
1472
- const _v = getFullTimeData(`${_date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1473
- setDateVal(_date);
1474
- setChangedVal(`${_date} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1475
- setSplitVals((prevState: string[]) => {
1476
- return [_v.year, _v.month, _v.day, prevState[3], prevState[4], prevState[5]];
1477
- });
1478
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1479
-
1480
- //
1481
- onChangeYear?.(_v);
1482
-
1483
- //
1484
- resetPopupBlurStatus();
1485
-
1486
-
1487
- }}
1488
- />
1489
- </div>
1490
- </> : null}
1491
-
1492
- {/* /CALENDAR */}
1493
-
1494
-
1495
- {COM_HAS_TIME ? <>
1496
-
1497
- {/* TIME CONTROL */}
1498
- <div className="date2d__hourslist border-end">
1499
- <h3>{_langHoursTitle}</h3>
1500
-
1501
- <ul>
1502
- {hoursArr.map((hour: string, i: number) => {
1503
-
1504
- const _curVal = getFullTimeData(`${dateVal} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1505
-
1506
- return <li key={i}>
1507
- <a
1508
- data-value={hour}
1509
- href="#"
1510
- tabIndex={-1}
1511
- onClick={(e: React.MouseEvent) => {
1512
- e.preventDefault();
1513
- resetDefauleValueExist();
1514
-
1515
- //
1516
- const _val = (e.currentTarget as any).dataset.value;
1517
- const _v = getFullTimeData(`${dateVal} ${_val}:${timeVal[1]}:${timeVal[2]}`);
1518
-
1519
-
1520
- setChangedVal(`${dateVal} ${_val}:${timeVal[1]}:${timeVal[2]}`);
1521
- setTimeVal((prevState: string[]) => {
1522
- return [_val, prevState[1], prevState[2]];
1523
- });
1524
- setSplitVals((prevState: string[]) => {
1525
- return [prevState[0], prevState[1], prevState[2], _v.hours, prevState[4], prevState[5]];
1526
- });
1527
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1528
-
1529
- //
1530
- onChangeHours?.(_v);
1531
-
1532
-
1533
- //
1534
- resetPopupBlurStatus();
1535
-
1536
- }}
1537
- className={combinedCls(
1538
- {
1539
- 'selected': timeVal[0] == hour,
1540
- 'disabled': checkDisabledHours(_curVal.year, Number(_curVal.month)-1, _curVal.day, hour)
1541
- }
1542
- )}
1543
- >
1544
- {hour}
1545
- </a>
1546
- </li>
1547
- })}
1548
-
1549
- </ul>
1550
- </div>
1551
- {/* TIME CONTROL */}
1552
-
1553
- {/* TIME CONTROL */}
1554
- <div className="date2d__minuteslist border-end">
1555
- <h3>{_langMinutesTitle}</h3>
1556
-
1557
- <ul>
1558
- {msArr.map((v: string, i: number) => {
1559
- const _curVal = getFullTimeData(`${dateVal} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1560
-
1561
- return <li key={i}>
1562
- <a
1563
- data-value={v}
1564
- href="#"
1565
- tabIndex={-1}
1566
- onClick={(e: React.MouseEvent) => {
1567
- e.preventDefault();
1568
- resetDefauleValueExist();
1569
-
1570
- //
1571
- const _val = (e.currentTarget as any).dataset.value;
1572
- const _v = getFullTimeData(`${dateVal} ${timeVal[0]}:${_val}:${timeVal[2]}`);
1573
-
1574
- setChangedVal(`${dateVal} ${timeVal[0]}:${_val}:${timeVal[2]}`);
1575
- setTimeVal((prevState: string[]) => {
1576
- return [prevState[0], _val, prevState[2]];
1577
- });
1578
- setSplitVals((prevState: string[]) => {
1579
- return [prevState[0], prevState[1], prevState[2], prevState[3], _v.minutes, prevState[5]];
1580
- });
1581
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1582
-
1583
- //
1584
- onChangeMinutes?.(_v);
1585
-
1586
-
1587
- //
1588
- resetPopupBlurStatus();
1589
-
1590
-
1591
- }}
1592
- className={combinedCls(
1593
- {
1594
- 'selected': timeVal[1] == v,
1595
- 'disabled': checkDisabledMinutes(_curVal.year, Number(_curVal.month)-1, _curVal.day, _curVal.hours, v)
1596
- }
1597
- )}
1598
- >
1599
-
1600
- {v}
1601
- </a>
1602
- </li>
1603
- })}
1604
-
1605
- </ul>
1606
- </div>
1607
- {/* TIME CONTROL */}
1608
-
1609
-
1610
- {/* TIME CONTROL */}
1611
- {(COM_NO_SECONDS) ? <>
1612
- <div className="date2d__secondslist border-end">
1613
- <h3>{_langSecondsTitle}</h3>
1614
-
1615
- <ul>
1616
- {msArr.map((v: string, i: number) => {
1617
- const _curVal = getFullTimeData(`${dateVal} ${timeVal[0]}:${timeVal[1]}:${timeVal[2]}`);
1618
-
1619
- return <li key={i}>
1620
- <a
1621
- data-value={v}
1622
- href="#"
1623
- tabIndex={-1}
1624
- onClick={(e: React.MouseEvent) => {
1625
- e.preventDefault();
1626
- resetDefauleValueExist();
1627
-
1628
- //
1629
- const _val = (e.currentTarget as any).dataset.value;
1630
- const _v = getFullTimeData(`${dateVal} ${timeVal[0]}:${timeVal[1]}:${_val}`);
1631
- setChangedVal(`${dateVal} ${timeVal[0]}:${timeVal[1]}:${_val}`);
1632
- setTimeVal((prevState: string[]) => {
1633
- return [prevState[0], prevState[1], _val];
1634
- });
1635
- setSplitVals((prevState: string[]) => {
1636
- return [prevState[0], prevState[1], prevState[2], prevState[3], prevState[5], _v.seconds ];
1637
- });
1638
- onChange?.(inputRef.current, _v, true, getAllSplittingInputs());
1639
-
1640
- //
1641
- onChangeSeconds?.(_v);
1642
-
1643
-
1644
- //
1645
- resetPopupBlurStatus();
1646
-
1647
- }}
1648
- className={combinedCls(
1649
- {
1650
- 'selected': timeVal[2] == v,
1651
- 'disabled': checkDisabledSeconds(_curVal.year, Number(_curVal.month)-1, _curVal.day, _curVal.hours, _curVal.minutes, v)
1652
- }
1653
- )}
1654
- >
1655
-
1656
- {v}
1657
- </a>
1658
- </li>
1659
- })}
1660
-
1661
- </ul>
1662
- </div>
1663
- </> : null}
1664
- {/* TIME CONTROL */}
1665
- </> : null}
1666
-
1667
-
1668
-
1669
- </div>
1670
-
1671
- </div>
1672
- </RootPortal>
1673
-
1674
-
1675
-
1676
-
1677
-
1678
- </>
1679
- )
1680
- });
1681
-
1682
-
1683
- export default Date;