funda-ui 4.5.682 → 4.5.711

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 (506) hide show
  1. package/.gitattributes +2 -0
  2. package/README.md +105 -4
  3. package/README_PUBLISH.md +126 -0
  4. package/lib/cjs/DragDropList/index.d.ts +1 -0
  5. package/lib/cjs/DragDropList/index.js +4 -6
  6. package/lib/cjs/MultipleSelect/index.d.ts +1 -0
  7. package/lib/cjs/MultipleSelect/index.js +23 -25
  8. package/lib/cjs/Textarea/index.d.ts +1 -0
  9. package/lib/cjs/Textarea/index.js +55 -13
  10. package/lib/cjs/Tree/index.d.ts +1 -0
  11. package/lib/cjs/Tree/index.js +29 -0
  12. package/lib/cjs/Utils/useAutosizeTextArea.d.ts +4 -1
  13. package/lib/cjs/Utils/useAutosizeTextArea.js +37 -2
  14. package/lib/cjs/Utils/useBoundedDrag.d.ts +0 -2
  15. package/lib/cjs/Utils/useBoundedDrag.js +0 -2
  16. package/lib/cjs/Utils/useIsMobile.d.ts +2 -0
  17. package/lib/cjs/Utils/useIsMobile.js +168 -0
  18. package/lib/cjs/index.js +0 -1
  19. package/lib/esm/DragDropList/index.tsx +1 -0
  20. package/lib/esm/MultipleSelect/index.tsx +1 -0
  21. package/lib/esm/Textarea/index.tsx +17 -12
  22. package/lib/esm/Tree/TreeList.tsx +32 -0
  23. package/lib/esm/Tree/index.tsx +3 -0
  24. package/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +39 -4
  25. package/lib/esm/Utils/hooks/useBoundedDrag.tsx +0 -2
  26. package/lib/esm/Utils/hooks/useIsMobile.tsx +56 -0
  27. package/logo.png +0 -0
  28. package/package.json +556 -11
  29. package/preview.png +0 -0
  30. package/{DragDropList → publish/DragDropList}/index.d.ts +1 -0
  31. package/{DragDropList → publish/DragDropList}/index.js +4 -6
  32. package/publish/LICENSE +21 -0
  33. package/{MultipleSelect → publish/MultipleSelect}/index.d.ts +1 -0
  34. package/{MultipleSelect → publish/MultipleSelect}/index.js +23 -25
  35. package/publish/README.md +126 -0
  36. package/{Textarea → publish/Textarea}/index.d.ts +1 -0
  37. package/{Textarea → publish/Textarea}/index.js +55 -13
  38. package/{Tree → publish/Tree}/index.d.ts +1 -0
  39. package/{Tree → publish/Tree}/index.js +29 -0
  40. package/{Utils → publish/Utils}/useAutosizeTextArea.d.ts +4 -1
  41. package/{Utils → publish/Utils}/useAutosizeTextArea.js +37 -2
  42. package/{Utils → publish/Utils}/useBoundedDrag.d.ts +0 -2
  43. package/{Utils → publish/Utils}/useBoundedDrag.js +0 -2
  44. package/publish/Utils/useIsMobile.d.ts +2 -0
  45. package/publish/Utils/useIsMobile.js +168 -0
  46. package/{all.js → publish/all.js} +0 -1
  47. package/publish/lib/cjs/Accordion/index.d.ts +2 -0
  48. package/publish/lib/cjs/Accordion/index.js +1035 -0
  49. package/publish/lib/cjs/BackToTop/index.d.ts +17 -0
  50. package/publish/lib/cjs/BackToTop/index.js +904 -0
  51. package/publish/lib/cjs/CascadingSelect/index.d.ts +60 -0
  52. package/publish/lib/cjs/CascadingSelect/index.js +2943 -0
  53. package/publish/lib/cjs/CascadingSelectE2E/index.d.ts +71 -0
  54. package/publish/lib/cjs/CascadingSelectE2E/index.js +3540 -0
  55. package/publish/lib/cjs/Checkbox/index.d.ts +28 -0
  56. package/publish/lib/cjs/Checkbox/index.js +662 -0
  57. package/publish/lib/cjs/ColorPicker/index.d.ts +27 -0
  58. package/publish/lib/cjs/ColorPicker/index.js +662 -0
  59. package/publish/lib/cjs/Date/index.d.ts +70 -0
  60. package/publish/lib/cjs/Date/index.js +6200 -0
  61. package/publish/lib/cjs/DigitalClock/index.d.ts +7 -0
  62. package/publish/lib/cjs/DigitalClock/index.js +402 -0
  63. package/publish/lib/cjs/DragDropList/index.d.ts +44 -0
  64. package/publish/lib/cjs/DragDropList/index.js +1587 -0
  65. package/publish/lib/cjs/DropdownMenu/index.d.ts +38 -0
  66. package/publish/lib/cjs/DropdownMenu/index.js +1498 -0
  67. package/publish/lib/cjs/DynamicFields/index.d.ts +40 -0
  68. package/publish/lib/cjs/DynamicFields/index.js +810 -0
  69. package/publish/lib/cjs/EventCalendar/index.d.ts +61 -0
  70. package/publish/lib/cjs/EventCalendar/index.js +3740 -0
  71. package/publish/lib/cjs/EventCalendarTimeline/index.d.ts +100 -0
  72. package/publish/lib/cjs/EventCalendarTimeline/index.js +6084 -0
  73. package/publish/lib/cjs/File/index.d.ts +40 -0
  74. package/publish/lib/cjs/File/index.js +1751 -0
  75. package/publish/lib/cjs/HorizontalScrollContent/index.d.ts +14 -0
  76. package/publish/lib/cjs/HorizontalScrollContent/index.js +426 -0
  77. package/publish/lib/cjs/Input/index.d.ts +59 -0
  78. package/publish/lib/cjs/Input/index.js +1455 -0
  79. package/publish/lib/cjs/LiveSearch/index.d.ts +69 -0
  80. package/publish/lib/cjs/LiveSearch/index.js +3626 -0
  81. package/publish/lib/cjs/MasonryLayout/index.d.ts +14 -0
  82. package/publish/lib/cjs/MasonryLayout/index.js +689 -0
  83. package/publish/lib/cjs/ModalDialog/index.d.ts +79 -0
  84. package/publish/lib/cjs/ModalDialog/index.js +1695 -0
  85. package/publish/lib/cjs/ModeSwitch/index.d.ts +17 -0
  86. package/publish/lib/cjs/ModeSwitch/index.js +202 -0
  87. package/publish/lib/cjs/MultilevelDropdownMenu/index.d.ts +20 -0
  88. package/publish/lib/cjs/MultilevelDropdownMenu/index.js +930 -0
  89. package/publish/lib/cjs/MultipleCheckboxes/index.d.ts +41 -0
  90. package/publish/lib/cjs/MultipleCheckboxes/index.js +1717 -0
  91. package/publish/lib/cjs/MultipleSelect/index.d.ts +65 -0
  92. package/publish/lib/cjs/MultipleSelect/index.js +3704 -0
  93. package/publish/lib/cjs/NativeSelect/index.d.ts +37 -0
  94. package/publish/lib/cjs/NativeSelect/index.js +1631 -0
  95. package/publish/lib/cjs/NumberInput/index.d.ts +40 -0
  96. package/publish/lib/cjs/NumberInput/index.js +1188 -0
  97. package/publish/lib/cjs/Pagination/index.d.ts +51 -0
  98. package/publish/lib/cjs/Pagination/index.js +612 -0
  99. package/publish/lib/cjs/Radio/index.d.ts +45 -0
  100. package/publish/lib/cjs/Radio/index.js +1391 -0
  101. package/publish/lib/cjs/RangeSlider/index.d.ts +22 -0
  102. package/publish/lib/cjs/RangeSlider/index.js +2665 -0
  103. package/publish/lib/cjs/RootPortal/index.d.ts +8 -0
  104. package/publish/lib/cjs/RootPortal/index.js +141 -0
  105. package/publish/lib/cjs/ScrollReveal/index.d.ts +21 -0
  106. package/publish/lib/cjs/ScrollReveal/index.js +401 -0
  107. package/publish/lib/cjs/Scrollbar/index.d.ts +17 -0
  108. package/publish/lib/cjs/Scrollbar/index.js +1107 -0
  109. package/publish/lib/cjs/SearchBar/index.d.ts +41 -0
  110. package/publish/lib/cjs/SearchBar/index.js +701 -0
  111. package/publish/lib/cjs/Select/index.d.ts +99 -0
  112. package/publish/lib/cjs/Select/index.js +5697 -0
  113. package/publish/lib/cjs/ShowMoreLess/index.d.ts +36 -0
  114. package/publish/lib/cjs/ShowMoreLess/index.js +387 -0
  115. package/publish/lib/cjs/Switch/index.d.ts +25 -0
  116. package/publish/lib/cjs/Switch/index.js +628 -0
  117. package/publish/lib/cjs/Table/index.d.ts +12 -0
  118. package/publish/lib/cjs/Table/index.js +2062 -0
  119. package/publish/lib/cjs/Tabs/index.d.ts +3 -0
  120. package/publish/lib/cjs/Tabs/index.js +771 -0
  121. package/publish/lib/cjs/TagInput/index.d.ts +31 -0
  122. package/publish/lib/cjs/TagInput/index.js +1144 -0
  123. package/publish/lib/cjs/Textarea/index.d.ts +50 -0
  124. package/publish/lib/cjs/Textarea/index.js +1784 -0
  125. package/publish/lib/cjs/Toast/index.d.ts +34 -0
  126. package/publish/lib/cjs/Toast/index.js +861 -0
  127. package/publish/lib/cjs/Tooltip/index.d.ts +23 -0
  128. package/publish/lib/cjs/Tooltip/index.js +1674 -0
  129. package/publish/lib/cjs/Tree/index.d.ts +62 -0
  130. package/publish/lib/cjs/Tree/index.js +1960 -0
  131. package/publish/lib/cjs/Utils/anim.d.ts +11 -0
  132. package/publish/lib/cjs/Utils/anim.js +400 -0
  133. package/publish/lib/cjs/Utils/bodyScrollLock.d.ts +8 -0
  134. package/publish/lib/cjs/Utils/bodyScrollLock.js +311 -0
  135. package/publish/lib/cjs/Utils/buffer.d.ts +67 -0
  136. package/publish/lib/cjs/Utils/buffer.js +343 -0
  137. package/publish/lib/cjs/Utils/cls.d.ts +15 -0
  138. package/publish/lib/cjs/Utils/cls.js +124 -0
  139. package/publish/lib/cjs/Utils/convert.d.ts +25 -0
  140. package/publish/lib/cjs/Utils/convert.js +109 -0
  141. package/publish/lib/cjs/Utils/date.d.ts +217 -0
  142. package/publish/lib/cjs/Utils/date.js +567 -0
  143. package/publish/lib/cjs/Utils/dom.d.ts +13 -0
  144. package/publish/lib/cjs/Utils/dom.js +215 -0
  145. package/publish/lib/cjs/Utils/easing.d.ts +29 -0
  146. package/publish/lib/cjs/Utils/easing.js +221 -0
  147. package/publish/lib/cjs/Utils/extract.d.ts +28 -0
  148. package/publish/lib/cjs/Utils/extract.js +130 -0
  149. package/publish/lib/cjs/Utils/getElementProperty.d.ts +52 -0
  150. package/publish/lib/cjs/Utils/getElementProperty.js +189 -0
  151. package/publish/lib/cjs/Utils/guid.d.ts +7 -0
  152. package/publish/lib/cjs/Utils/guid.js +67 -0
  153. package/publish/lib/cjs/Utils/initDefaultOptions.d.ts +21 -0
  154. package/publish/lib/cjs/Utils/initDefaultOptions.js +131 -0
  155. package/publish/lib/cjs/Utils/inputsCalculation.d.ts +28 -0
  156. package/publish/lib/cjs/Utils/inputsCalculation.js +188 -0
  157. package/publish/lib/cjs/Utils/math.d.ts +77 -0
  158. package/publish/lib/cjs/Utils/math.js +305 -0
  159. package/publish/lib/cjs/Utils/object.d.ts +18 -0
  160. package/publish/lib/cjs/Utils/object.js +120 -0
  161. package/publish/lib/cjs/Utils/os.d.ts +2 -0
  162. package/publish/lib/cjs/Utils/os.js +104 -0
  163. package/publish/lib/cjs/Utils/performance.d.ts +3 -0
  164. package/publish/lib/cjs/Utils/performance.js +94 -0
  165. package/publish/lib/cjs/Utils/tree.d.ts +40 -0
  166. package/publish/lib/cjs/Utils/tree.js +195 -0
  167. package/publish/lib/cjs/Utils/useAutosizeTextArea.d.ts +10 -0
  168. package/publish/lib/cjs/Utils/useAutosizeTextArea.js +227 -0
  169. package/publish/lib/cjs/Utils/useBoundedDrag.d.ts +125 -0
  170. package/publish/lib/cjs/Utils/useBoundedDrag.js +380 -0
  171. package/publish/lib/cjs/Utils/useClickOutside.d.ts +33 -0
  172. package/publish/lib/cjs/Utils/useClickOutside.js +166 -0
  173. package/publish/lib/cjs/Utils/useComId.d.ts +6 -0
  174. package/publish/lib/cjs/Utils/useComId.js +114 -0
  175. package/publish/lib/cjs/Utils/useDebounce.d.ts +20 -0
  176. package/publish/lib/cjs/Utils/useDebounce.js +138 -0
  177. package/publish/lib/cjs/Utils/useDragDropPosition.d.ts +169 -0
  178. package/publish/lib/cjs/Utils/useDragDropPosition.js +456 -0
  179. package/publish/lib/cjs/Utils/useDraggable.d.ts +62 -0
  180. package/publish/lib/cjs/Utils/useDraggable.js +348 -0
  181. package/publish/lib/cjs/Utils/useInterval.d.ts +5 -0
  182. package/publish/lib/cjs/Utils/useInterval.js +168 -0
  183. package/publish/lib/cjs/Utils/useIsMobile.d.ts +2 -0
  184. package/publish/lib/cjs/Utils/useIsMobile.js +168 -0
  185. package/publish/lib/cjs/Utils/useKeyPress.d.ts +44 -0
  186. package/publish/lib/cjs/Utils/useKeyPress.js +200 -0
  187. package/publish/lib/cjs/Utils/useThrottle.d.ts +2 -0
  188. package/publish/lib/cjs/Utils/useThrottle.js +136 -0
  189. package/publish/lib/cjs/Utils/useWindowScroll.d.ts +12 -0
  190. package/publish/lib/cjs/Utils/useWindowScroll.js +217 -0
  191. package/publish/lib/cjs/Utils/viewport.d.ts +7 -0
  192. package/publish/lib/cjs/Utils/viewport.js +64 -0
  193. package/publish/lib/cjs/index.d.ts +45 -0
  194. package/publish/lib/cjs/index.js +46 -0
  195. package/publish/lib/css/BackToTop/index.css +34 -0
  196. package/publish/lib/css/CascadingSelect/index.css +216 -0
  197. package/publish/lib/css/CascadingSelectE2E/index.css +216 -0
  198. package/publish/lib/css/ColorPicker/index.css +58 -0
  199. package/publish/lib/css/Date/index.css +434 -0
  200. package/publish/lib/css/DragDropList/index.css +188 -0
  201. package/publish/lib/css/DropdownMenu/index.css +151 -0
  202. package/publish/lib/css/EventCalendar/index.css +300 -0
  203. package/publish/lib/css/EventCalendarTimeline/index.css +694 -0
  204. package/publish/lib/css/HorizontalScrollContent/index.css +70 -0
  205. package/publish/lib/css/LiveSearch/index.css +55 -0
  206. package/publish/lib/css/MultilevelDropdownMenu/index.css +38 -0
  207. package/publish/lib/css/MultipleSelect/index.css +313 -0
  208. package/publish/lib/css/RangeSlider/index.css +150 -0
  209. package/publish/lib/css/Scrollbar/index.css +176 -0
  210. package/publish/lib/css/Select/index.css +368 -0
  211. package/publish/lib/css/ShowMoreLess/index.css +23 -0
  212. package/publish/lib/css/Table/index.css +584 -0
  213. package/publish/lib/css/TagInput/index.css +91 -0
  214. package/publish/lib/css/Toast/index.css +201 -0
  215. package/publish/lib/css/Tooltip/index.css +197 -0
  216. package/publish/lib/css/Tree/index.css +232 -0
  217. package/publish/lib/esm/Accordion/Accordion.tsx +184 -0
  218. package/publish/lib/esm/Accordion/AccordionItem.tsx +143 -0
  219. package/publish/lib/esm/Accordion/index.tsx +2 -0
  220. package/publish/lib/esm/BackToTop/index.scss +47 -0
  221. package/publish/lib/esm/BackToTop/index.tsx +177 -0
  222. package/publish/lib/esm/CascadingSelect/Group.tsx +82 -0
  223. package/publish/lib/esm/CascadingSelect/index.scss +291 -0
  224. package/publish/lib/esm/CascadingSelect/index.tsx +1203 -0
  225. package/publish/lib/esm/CascadingSelectE2E/Group.tsx +83 -0
  226. package/publish/lib/esm/CascadingSelectE2E/index.scss +293 -0
  227. package/publish/lib/esm/CascadingSelectE2E/index.tsx +1471 -0
  228. package/publish/lib/esm/Checkbox/index.tsx +193 -0
  229. package/publish/lib/esm/ColorPicker/index.scss +91 -0
  230. package/publish/lib/esm/ColorPicker/index.tsx +204 -0
  231. package/publish/lib/esm/Date/Calendar.tsx +723 -0
  232. package/publish/lib/esm/Date/index.scss +567 -0
  233. package/publish/lib/esm/Date/index.tsx +1683 -0
  234. package/publish/lib/esm/Date/localization/en_US.js +13 -0
  235. package/publish/lib/esm/Date/localization/zh_CN.js +12 -0
  236. package/publish/lib/esm/DigitalClock/index.tsx +74 -0
  237. package/publish/lib/esm/DragDropList/index.scss +245 -0
  238. package/publish/lib/esm/DragDropList/index.tsx +494 -0
  239. package/publish/lib/esm/DropdownMenu/Option.tsx +55 -0
  240. package/publish/lib/esm/DropdownMenu/index.scss +205 -0
  241. package/publish/lib/esm/DropdownMenu/index.tsx +377 -0
  242. package/publish/lib/esm/DynamicFields/index.tsx +404 -0
  243. package/publish/lib/esm/EventCalendar/index.scss +407 -0
  244. package/publish/lib/esm/EventCalendar/index.tsx +1004 -0
  245. package/publish/lib/esm/EventCalendarTimeline/index.scss +926 -0
  246. package/publish/lib/esm/EventCalendarTimeline/index.tsx +2683 -0
  247. package/publish/lib/esm/File/index.tsx +477 -0
  248. package/publish/lib/esm/HorizontalScrollContent/index.scss +87 -0
  249. package/publish/lib/esm/HorizontalScrollContent/index.tsx +171 -0
  250. package/publish/lib/esm/Input/index.tsx +614 -0
  251. package/publish/lib/esm/LiveSearch/index.scss +82 -0
  252. package/publish/lib/esm/LiveSearch/index.tsx +960 -0
  253. package/publish/lib/esm/MasonryLayout/index.tsx +326 -0
  254. package/publish/lib/esm/ModalDialog/index.tsx +552 -0
  255. package/publish/lib/esm/ModeSwitch/index.tsx +82 -0
  256. package/publish/lib/esm/MultilevelDropdownMenu/ItemList.tsx +265 -0
  257. package/publish/lib/esm/MultilevelDropdownMenu/index.scss +79 -0
  258. package/publish/lib/esm/MultilevelDropdownMenu/index.tsx +77 -0
  259. package/publish/lib/esm/MultipleCheckboxes/index.tsx +669 -0
  260. package/publish/lib/esm/MultipleSelect/index.scss +398 -0
  261. package/publish/lib/esm/MultipleSelect/index.tsx +766 -0
  262. package/publish/lib/esm/MultipleSelect/utils/func.ts +61 -0
  263. package/publish/lib/esm/NativeSelect/index.tsx +396 -0
  264. package/publish/lib/esm/NativeSelect/utils/func.ts +49 -0
  265. package/publish/lib/esm/NumberInput/index.tsx +385 -0
  266. package/publish/lib/esm/Pagination/index.tsx +286 -0
  267. package/publish/lib/esm/Pagination/pagination-navigators.tsx +60 -0
  268. package/publish/lib/esm/Radio/index.tsx +670 -0
  269. package/publish/lib/esm/RangeSlider/index.scss +186 -0
  270. package/publish/lib/esm/RangeSlider/index.tsx +241 -0
  271. package/publish/lib/esm/RootPortal/index.tsx +53 -0
  272. package/publish/lib/esm/ScrollReveal/index.tsx +148 -0
  273. package/publish/lib/esm/Scrollbar/index.scss +221 -0
  274. package/publish/lib/esm/Scrollbar/index.tsx +561 -0
  275. package/publish/lib/esm/SearchBar/index.tsx +253 -0
  276. package/publish/lib/esm/Select/index.scss +553 -0
  277. package/publish/lib/esm/Select/index.tsx +2816 -0
  278. package/publish/lib/esm/Select/utils/func.ts +106 -0
  279. package/publish/lib/esm/ShowMoreLess/index.scss +27 -0
  280. package/publish/lib/esm/ShowMoreLess/index.tsx +145 -0
  281. package/publish/lib/esm/Switch/index.tsx +147 -0
  282. package/publish/lib/esm/Table/Table.tsx +257 -0
  283. package/publish/lib/esm/Table/TableBody.tsx +41 -0
  284. package/publish/lib/esm/Table/TableCaption.tsx +34 -0
  285. package/publish/lib/esm/Table/TableCell.tsx +123 -0
  286. package/publish/lib/esm/Table/TableColgroup.tsx +38 -0
  287. package/publish/lib/esm/Table/TableContext.tsx +26 -0
  288. package/publish/lib/esm/Table/TableFoot.tsx +28 -0
  289. package/publish/lib/esm/Table/TableHead.tsx +28 -0
  290. package/publish/lib/esm/Table/TableRow.tsx +76 -0
  291. package/publish/lib/esm/Table/index.scss +418 -0
  292. package/publish/lib/esm/Table/index.tsx +14 -0
  293. package/publish/lib/esm/Table/utils/DragHandleSprite.tsx +46 -0
  294. package/publish/lib/esm/Table/utils/SortSprite.tsx +57 -0
  295. package/publish/lib/esm/Table/utils/TableFilter.tsx +56 -0
  296. package/publish/lib/esm/Table/utils/ToggleSelection.tsx +225 -0
  297. package/publish/lib/esm/Table/utils/func.ts +171 -0
  298. package/publish/lib/esm/Table/utils/hooks/useTableDraggable.tsx +342 -0
  299. package/publish/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +154 -0
  300. package/publish/lib/esm/Table/utils/hooks/useTableResponsive.tsx +92 -0
  301. package/publish/lib/esm/Table/utils/hooks/useTableSort.tsx +143 -0
  302. package/publish/lib/esm/Tabs/TabList.tsx +50 -0
  303. package/publish/lib/esm/Tabs/TabPanel.tsx +44 -0
  304. package/publish/lib/esm/Tabs/Tabs.tsx +282 -0
  305. package/publish/lib/esm/Tabs/index.tsx +3 -0
  306. package/publish/lib/esm/TagInput/index.scss +126 -0
  307. package/publish/lib/esm/TagInput/index.tsx +352 -0
  308. package/publish/lib/esm/Textarea/index.tsx +608 -0
  309. package/publish/lib/esm/Toast/Item.tsx +124 -0
  310. package/publish/lib/esm/Toast/index.scss +269 -0
  311. package/publish/lib/esm/Toast/index.tsx +374 -0
  312. package/publish/lib/esm/Tooltip/index.scss +269 -0
  313. package/publish/lib/esm/Tooltip/index.tsx +312 -0
  314. package/publish/lib/esm/Tree/TreeList.tsx +616 -0
  315. package/publish/lib/esm/Tree/index.scss +386 -0
  316. package/publish/lib/esm/Tree/index.tsx +396 -0
  317. package/publish/lib/esm/Tree/init-height.tsx +27 -0
  318. package/publish/lib/esm/Tree/utils/func.ts +15 -0
  319. package/publish/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +125 -0
  320. package/publish/lib/esm/Utils/hooks/useBoundedDrag.tsx +301 -0
  321. package/publish/lib/esm/Utils/hooks/useClickOutside.tsx +69 -0
  322. package/publish/lib/esm/Utils/hooks/useComId.tsx +13 -0
  323. package/publish/lib/esm/Utils/hooks/useDebounce.tsx +40 -0
  324. package/publish/lib/esm/Utils/hooks/useDragDropPosition.tsx +420 -0
  325. package/publish/lib/esm/Utils/hooks/useDraggable.tsx +265 -0
  326. package/publish/lib/esm/Utils/hooks/useInterval.tsx +74 -0
  327. package/publish/lib/esm/Utils/hooks/useIsMobile.tsx +56 -0
  328. package/publish/lib/esm/Utils/hooks/useKeyPress.tsx +104 -0
  329. package/publish/lib/esm/Utils/hooks/useThrottle.tsx +39 -0
  330. package/publish/lib/esm/Utils/hooks/useWindowScroll.tsx +83 -0
  331. package/publish/lib/esm/Utils/libs/anim.ts +96 -0
  332. package/publish/lib/esm/Utils/libs/buffer.ts +262 -0
  333. package/publish/lib/esm/Utils/libs/cls.ts +64 -0
  334. package/publish/lib/esm/Utils/libs/convert.ts +59 -0
  335. package/publish/lib/esm/Utils/libs/date.ts +578 -0
  336. package/publish/lib/esm/Utils/libs/dom.ts +150 -0
  337. package/publish/lib/esm/Utils/libs/easing.ts +201 -0
  338. package/publish/lib/esm/Utils/libs/extract.ts +86 -0
  339. package/publish/lib/esm/Utils/libs/getElementProperty.ts +150 -0
  340. package/publish/lib/esm/Utils/libs/guid.ts +16 -0
  341. package/publish/lib/esm/Utils/libs/initDefaultOptions.ts +104 -0
  342. package/publish/lib/esm/Utils/libs/inputsCalculation.ts +160 -0
  343. package/publish/lib/esm/Utils/libs/math.ts +276 -0
  344. package/publish/lib/esm/Utils/libs/object.ts +68 -0
  345. package/publish/lib/esm/Utils/libs/os.ts +63 -0
  346. package/publish/lib/esm/Utils/libs/performance.ts +47 -0
  347. package/publish/lib/esm/Utils/libs/tree.ts +119 -0
  348. package/publish/lib/esm/Utils/libs/viewport.ts +20 -0
  349. package/publish/lib/esm/Utils/plugins/bodyScrollLock.ts +286 -0
  350. package/publish/lib/esm/index.js +43 -0
  351. package/publish/package.json +1 -0
  352. /package/{Accordion → publish/Accordion}/index.d.ts +0 -0
  353. /package/{Accordion → publish/Accordion}/index.js +0 -0
  354. /package/{BackToTop → publish/BackToTop}/index.css +0 -0
  355. /package/{BackToTop → publish/BackToTop}/index.d.ts +0 -0
  356. /package/{BackToTop → publish/BackToTop}/index.js +0 -0
  357. /package/{CascadingSelect → publish/CascadingSelect}/index.css +0 -0
  358. /package/{CascadingSelect → publish/CascadingSelect}/index.d.ts +0 -0
  359. /package/{CascadingSelect → publish/CascadingSelect}/index.js +0 -0
  360. /package/{CascadingSelectE2E → publish/CascadingSelectE2E}/index.css +0 -0
  361. /package/{CascadingSelectE2E → publish/CascadingSelectE2E}/index.d.ts +0 -0
  362. /package/{CascadingSelectE2E → publish/CascadingSelectE2E}/index.js +0 -0
  363. /package/{Checkbox → publish/Checkbox}/index.d.ts +0 -0
  364. /package/{Checkbox → publish/Checkbox}/index.js +0 -0
  365. /package/{ColorPicker → publish/ColorPicker}/index.css +0 -0
  366. /package/{ColorPicker → publish/ColorPicker}/index.d.ts +0 -0
  367. /package/{ColorPicker → publish/ColorPicker}/index.js +0 -0
  368. /package/{Date → publish/Date}/index.css +0 -0
  369. /package/{Date → publish/Date}/index.d.ts +0 -0
  370. /package/{Date → publish/Date}/index.js +0 -0
  371. /package/{DigitalClock → publish/DigitalClock}/index.d.ts +0 -0
  372. /package/{DigitalClock → publish/DigitalClock}/index.js +0 -0
  373. /package/{DragDropList → publish/DragDropList}/index.css +0 -0
  374. /package/{DropdownMenu → publish/DropdownMenu}/index.css +0 -0
  375. /package/{DropdownMenu → publish/DropdownMenu}/index.d.ts +0 -0
  376. /package/{DropdownMenu → publish/DropdownMenu}/index.js +0 -0
  377. /package/{DynamicFields → publish/DynamicFields}/index.d.ts +0 -0
  378. /package/{DynamicFields → publish/DynamicFields}/index.js +0 -0
  379. /package/{EventCalendar → publish/EventCalendar}/index.css +0 -0
  380. /package/{EventCalendar → publish/EventCalendar}/index.d.ts +0 -0
  381. /package/{EventCalendar → publish/EventCalendar}/index.js +0 -0
  382. /package/{EventCalendarTimeline → publish/EventCalendarTimeline}/index.css +0 -0
  383. /package/{EventCalendarTimeline → publish/EventCalendarTimeline}/index.d.ts +0 -0
  384. /package/{EventCalendarTimeline → publish/EventCalendarTimeline}/index.js +0 -0
  385. /package/{File → publish/File}/index.d.ts +0 -0
  386. /package/{File → publish/File}/index.js +0 -0
  387. /package/{HorizontalScrollContent → publish/HorizontalScrollContent}/index.css +0 -0
  388. /package/{HorizontalScrollContent → publish/HorizontalScrollContent}/index.d.ts +0 -0
  389. /package/{HorizontalScrollContent → publish/HorizontalScrollContent}/index.js +0 -0
  390. /package/{Input → publish/Input}/index.d.ts +0 -0
  391. /package/{Input → publish/Input}/index.js +0 -0
  392. /package/{LiveSearch → publish/LiveSearch}/index.css +0 -0
  393. /package/{LiveSearch → publish/LiveSearch}/index.d.ts +0 -0
  394. /package/{LiveSearch → publish/LiveSearch}/index.js +0 -0
  395. /package/{MasonryLayout → publish/MasonryLayout}/index.d.ts +0 -0
  396. /package/{MasonryLayout → publish/MasonryLayout}/index.js +0 -0
  397. /package/{ModalDialog → publish/ModalDialog}/index.d.ts +0 -0
  398. /package/{ModalDialog → publish/ModalDialog}/index.js +0 -0
  399. /package/{ModeSwitch → publish/ModeSwitch}/index.d.ts +0 -0
  400. /package/{ModeSwitch → publish/ModeSwitch}/index.js +0 -0
  401. /package/{MultilevelDropdownMenu → publish/MultilevelDropdownMenu}/index.css +0 -0
  402. /package/{MultilevelDropdownMenu → publish/MultilevelDropdownMenu}/index.d.ts +0 -0
  403. /package/{MultilevelDropdownMenu → publish/MultilevelDropdownMenu}/index.js +0 -0
  404. /package/{MultipleCheckboxes → publish/MultipleCheckboxes}/index.d.ts +0 -0
  405. /package/{MultipleCheckboxes → publish/MultipleCheckboxes}/index.js +0 -0
  406. /package/{MultipleSelect → publish/MultipleSelect}/index.css +0 -0
  407. /package/{NativeSelect → publish/NativeSelect}/index.d.ts +0 -0
  408. /package/{NativeSelect → publish/NativeSelect}/index.js +0 -0
  409. /package/{NumberInput → publish/NumberInput}/index.d.ts +0 -0
  410. /package/{NumberInput → publish/NumberInput}/index.js +0 -0
  411. /package/{Pagination → publish/Pagination}/index.d.ts +0 -0
  412. /package/{Pagination → publish/Pagination}/index.js +0 -0
  413. /package/{Radio → publish/Radio}/index.d.ts +0 -0
  414. /package/{Radio → publish/Radio}/index.js +0 -0
  415. /package/{RangeSlider → publish/RangeSlider}/index.css +0 -0
  416. /package/{RangeSlider → publish/RangeSlider}/index.d.ts +0 -0
  417. /package/{RangeSlider → publish/RangeSlider}/index.js +0 -0
  418. /package/{RootPortal → publish/RootPortal}/index.d.ts +0 -0
  419. /package/{RootPortal → publish/RootPortal}/index.js +0 -0
  420. /package/{ScrollReveal → publish/ScrollReveal}/index.d.ts +0 -0
  421. /package/{ScrollReveal → publish/ScrollReveal}/index.js +0 -0
  422. /package/{Scrollbar → publish/Scrollbar}/index.css +0 -0
  423. /package/{Scrollbar → publish/Scrollbar}/index.d.ts +0 -0
  424. /package/{Scrollbar → publish/Scrollbar}/index.js +0 -0
  425. /package/{SearchBar → publish/SearchBar}/index.d.ts +0 -0
  426. /package/{SearchBar → publish/SearchBar}/index.js +0 -0
  427. /package/{Select → publish/Select}/index.css +0 -0
  428. /package/{Select → publish/Select}/index.d.ts +0 -0
  429. /package/{Select → publish/Select}/index.js +0 -0
  430. /package/{ShowMoreLess → publish/ShowMoreLess}/index.css +0 -0
  431. /package/{ShowMoreLess → publish/ShowMoreLess}/index.d.ts +0 -0
  432. /package/{ShowMoreLess → publish/ShowMoreLess}/index.js +0 -0
  433. /package/{Switch → publish/Switch}/index.d.ts +0 -0
  434. /package/{Switch → publish/Switch}/index.js +0 -0
  435. /package/{Table → publish/Table}/index.css +0 -0
  436. /package/{Table → publish/Table}/index.d.ts +0 -0
  437. /package/{Table → publish/Table}/index.js +0 -0
  438. /package/{Tabs → publish/Tabs}/index.d.ts +0 -0
  439. /package/{Tabs → publish/Tabs}/index.js +0 -0
  440. /package/{TagInput → publish/TagInput}/index.css +0 -0
  441. /package/{TagInput → publish/TagInput}/index.d.ts +0 -0
  442. /package/{TagInput → publish/TagInput}/index.js +0 -0
  443. /package/{Toast → publish/Toast}/index.css +0 -0
  444. /package/{Toast → publish/Toast}/index.d.ts +0 -0
  445. /package/{Toast → publish/Toast}/index.js +0 -0
  446. /package/{Tooltip → publish/Tooltip}/index.css +0 -0
  447. /package/{Tooltip → publish/Tooltip}/index.d.ts +0 -0
  448. /package/{Tooltip → publish/Tooltip}/index.js +0 -0
  449. /package/{Tree → publish/Tree}/index.css +0 -0
  450. /package/{Utils → publish/Utils}/anim.d.ts +0 -0
  451. /package/{Utils → publish/Utils}/anim.js +0 -0
  452. /package/{Utils → publish/Utils}/bodyScrollLock.d.ts +0 -0
  453. /package/{Utils → publish/Utils}/bodyScrollLock.js +0 -0
  454. /package/{Utils → publish/Utils}/buffer.d.ts +0 -0
  455. /package/{Utils → publish/Utils}/buffer.js +0 -0
  456. /package/{Utils → publish/Utils}/cls.d.ts +0 -0
  457. /package/{Utils → publish/Utils}/cls.js +0 -0
  458. /package/{Utils → publish/Utils}/convert.d.ts +0 -0
  459. /package/{Utils → publish/Utils}/convert.js +0 -0
  460. /package/{Utils → publish/Utils}/date.d.ts +0 -0
  461. /package/{Utils → publish/Utils}/date.js +0 -0
  462. /package/{Utils → publish/Utils}/dom.d.ts +0 -0
  463. /package/{Utils → publish/Utils}/dom.js +0 -0
  464. /package/{Utils → publish/Utils}/easing.d.ts +0 -0
  465. /package/{Utils → publish/Utils}/easing.js +0 -0
  466. /package/{Utils → publish/Utils}/extract.d.ts +0 -0
  467. /package/{Utils → publish/Utils}/extract.js +0 -0
  468. /package/{Utils → publish/Utils}/getElementProperty.d.ts +0 -0
  469. /package/{Utils → publish/Utils}/getElementProperty.js +0 -0
  470. /package/{Utils → publish/Utils}/guid.d.ts +0 -0
  471. /package/{Utils → publish/Utils}/guid.js +0 -0
  472. /package/{Utils → publish/Utils}/initDefaultOptions.d.ts +0 -0
  473. /package/{Utils → publish/Utils}/initDefaultOptions.js +0 -0
  474. /package/{Utils → publish/Utils}/inputsCalculation.d.ts +0 -0
  475. /package/{Utils → publish/Utils}/inputsCalculation.js +0 -0
  476. /package/{Utils → publish/Utils}/math.d.ts +0 -0
  477. /package/{Utils → publish/Utils}/math.js +0 -0
  478. /package/{Utils → publish/Utils}/object.d.ts +0 -0
  479. /package/{Utils → publish/Utils}/object.js +0 -0
  480. /package/{Utils → publish/Utils}/os.d.ts +0 -0
  481. /package/{Utils → publish/Utils}/os.js +0 -0
  482. /package/{Utils → publish/Utils}/performance.d.ts +0 -0
  483. /package/{Utils → publish/Utils}/performance.js +0 -0
  484. /package/{Utils → publish/Utils}/tree.d.ts +0 -0
  485. /package/{Utils → publish/Utils}/tree.js +0 -0
  486. /package/{Utils → publish/Utils}/useClickOutside.d.ts +0 -0
  487. /package/{Utils → publish/Utils}/useClickOutside.js +0 -0
  488. /package/{Utils → publish/Utils}/useComId.d.ts +0 -0
  489. /package/{Utils → publish/Utils}/useComId.js +0 -0
  490. /package/{Utils → publish/Utils}/useDebounce.d.ts +0 -0
  491. /package/{Utils → publish/Utils}/useDebounce.js +0 -0
  492. /package/{Utils → publish/Utils}/useDragDropPosition.d.ts +0 -0
  493. /package/{Utils → publish/Utils}/useDragDropPosition.js +0 -0
  494. /package/{Utils → publish/Utils}/useDraggable.d.ts +0 -0
  495. /package/{Utils → publish/Utils}/useDraggable.js +0 -0
  496. /package/{Utils → publish/Utils}/useInterval.d.ts +0 -0
  497. /package/{Utils → publish/Utils}/useInterval.js +0 -0
  498. /package/{Utils → publish/Utils}/useKeyPress.d.ts +0 -0
  499. /package/{Utils → publish/Utils}/useKeyPress.js +0 -0
  500. /package/{Utils → publish/Utils}/useThrottle.d.ts +0 -0
  501. /package/{Utils → publish/Utils}/useThrottle.js +0 -0
  502. /package/{Utils → publish/Utils}/useWindowScroll.d.ts +0 -0
  503. /package/{Utils → publish/Utils}/useWindowScroll.js +0 -0
  504. /package/{Utils → publish/Utils}/viewport.d.ts +0 -0
  505. /package/{Utils → publish/Utils}/viewport.js +0 -0
  506. /package/{all.d.ts → publish/all.d.ts} +0 -0
@@ -0,0 +1,1004 @@
1
+ import React, { useState, useRef, useEffect, useMemo, useImperativeHandle } from 'react';
2
+
3
+ import { getTodayDate, getCalendarDate, isValidDate, padZero } from 'funda-utils/dist/cjs/date';
4
+ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
5
+ import ModalDialog from 'funda-modaldialog';
6
+
7
+
8
+
9
+ export interface EventsValueConfig {
10
+ id: string | number;
11
+ date: string,
12
+ time: string,
13
+ data: string,
14
+ eventStyles?: React.CSSProperties;
15
+ callback?: () => void;
16
+ }
17
+
18
+ export interface TimelineCellListConfig {
19
+ date: string;
20
+ list: EventsValueConfig[];
21
+ }
22
+
23
+ export type EventCalendarProps = {
24
+ contentRef?: React.ForwardedRef<any>;
25
+ calendarWrapperClassName?: string;
26
+ customTodayDate?: string;
27
+ eventsValue?: any[];
28
+ langWeek?: string[];
29
+ langWeekFull?: string[];
30
+ langMonths?: string[];
31
+ langMonthsFull?: string[];
32
+ langToday?: string;
33
+ iconRemove?: React.ReactNode | string;
34
+ iconAdd?: React.ReactNode | string;
35
+ cellCloseBtnClassName?: string;
36
+ cellCloseBtnLabel?: string | React.ReactNode;
37
+ cellAddBtnClassName?: string;
38
+ cellAddBtnLabel?: string | React.ReactNode;
39
+ onChangeDate?: (e: any, currentData: any) => void;
40
+ onChangeMonth?: (currentData: any) => void;
41
+ onChangeYear?: (currentData: any) => void;
42
+ onChangeToday?: (currentData: any) => void;
43
+ onListRenderComplete?: () => void;
44
+
45
+ // modal dialog
46
+ modalMaskOpacity?: string;
47
+ modalMaxWidth?: number | string;
48
+ modalMinHeight?: number | string;
49
+ modalHeading?: React.ReactNode;
50
+ modalContent?: React.ReactNode;
51
+ modalDeleteContent?: React.ReactNode;
52
+ modalCloseBtnClassName?: string;
53
+ modalCloseBtnLabel?: string | React.ReactNode;
54
+ modalSubmitBtnClassName?: string;
55
+ modalSubmitBtnLabel?: string | React.ReactNode;
56
+ modalSubmitDeleteBtnClassName?: string;
57
+ modalSubmitDeleteBtnLabel?: string | React.ReactNode;
58
+ onModalEditOpen?: (currentData: any, openwin: any, type: 'normal' | 'new') => void;
59
+ onModalEditClose?: (currentData: any) => void;
60
+ onModalDeleteOpen?: (currentData: any, openwin: any) => void;
61
+ onModalDeleteClose?: (currentData: any) => void;
62
+ onModalEditEvent?: (currentData: any, closewin: any) => void;
63
+ onModalDeleteEvent?: (currentData: any, closewin: any) => void;
64
+ //
65
+ onCellMouseEnter?: (el: any) => void;
66
+ onCellMouseLeave?: (el: any) => void;
67
+ onCellClick?: (el: any) => void;
68
+ onCellDoubleClick?: (el: any) => void;
69
+ onCellMouseUp?: (el: any) => void;
70
+ onKeyPressed?: (el: any) => void;
71
+
72
+ }
73
+
74
+
75
+ const EventCalendar = (props: EventCalendarProps) => {
76
+ const {
77
+ contentRef,
78
+ calendarWrapperClassName,
79
+ customTodayDate,
80
+ eventsValue,
81
+ langWeek,
82
+ langWeekFull,
83
+ langMonths,
84
+ langMonthsFull,
85
+ langToday,
86
+ onChangeDate,
87
+ onChangeMonth,
88
+ onChangeYear,
89
+ onChangeToday,
90
+ onListRenderComplete,
91
+
92
+ //
93
+ iconRemove,
94
+ iconAdd,
95
+ cellCloseBtnClassName,
96
+ cellCloseBtnLabel,
97
+ cellAddBtnClassName,
98
+ cellAddBtnLabel,
99
+
100
+ //
101
+ modalMaskOpacity,
102
+ modalMaxWidth,
103
+ modalMinHeight,
104
+ modalHeading,
105
+ modalContent,
106
+ modalDeleteContent,
107
+ modalCloseBtnClassName,
108
+ modalCloseBtnLabel,
109
+ modalSubmitBtnClassName,
110
+ modalSubmitBtnLabel,
111
+ modalSubmitDeleteBtnClassName,
112
+ modalSubmitDeleteBtnLabel,
113
+ onModalEditOpen,
114
+ onModalEditClose,
115
+ onModalDeleteOpen,
116
+ onModalDeleteClose,
117
+ onModalEditEvent,
118
+ onModalDeleteEvent,
119
+
120
+ //
121
+ onCellMouseEnter,
122
+ onCellMouseLeave,
123
+ onCellClick,
124
+ onCellDoubleClick,
125
+ onCellMouseUp,
126
+ onKeyPressed
127
+ } = props;
128
+
129
+ const DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
130
+ const DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
131
+ const WEEK = langWeek || ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'];
132
+ const WEEK_FULL = langWeekFull || ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY'];
133
+ const MONTHS = langMonths || ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
134
+ const MONTHS_FULL = langMonthsFull || ['January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
135
+ const START_WEEK_ON = 1; // represents "Monday/1" in JavaScript
136
+
137
+ // orginal data
138
+ const [orginalData, setOrginalData] = useState<TimelineCellListConfig[]>([]);
139
+
140
+ const now = useMemo(() => new Date(), []);
141
+ const [date, setDate] = useState<Date>(now);
142
+ const [day, setDay] = useState<number>(date.getDate());
143
+ const [month, setMonth] = useState<number>(date.getMonth());
144
+ const [year, setYear] = useState<number>(date.getFullYear());
145
+ const [startDay, setStartDay] = useState<number>(getStartDayOfMonth(date));
146
+
147
+
148
+ // selection tab
149
+ // gets the today date time object
150
+ const [selectedMonth, setSelectedMonth] = useState<number>(now.getMonth());
151
+ const [selectedYear, setSelectedYear] = useState<number>(now.getFullYear());
152
+ const [yearsArray, setYearsCollection] = useState<number[]>([]);
153
+
154
+ //
155
+ const [winYear, setWinYear] = useState<boolean>(false);
156
+ const [winMonth, setWinMonth] = useState<boolean>(false);
157
+
158
+ // modal dialog
159
+ const modalEditHandleRef = useRef<any>();
160
+ const modalDeleteHandleRef = useRef<any>();
161
+ const EVENTS_ENABLED = typeof modalContent !== 'undefined';
162
+ const EVENTS_DELETE_ENABLED = typeof modalDeleteContent !== 'undefined';
163
+ const [showEdit, setShowEdit] = useState<boolean>(false);
164
+ const [showDelete, setShowDelete] = useState<boolean>(false);
165
+
166
+ // Open temporary storage for pop-ups
167
+ const [tableCellId, setTableCellId] = useState<number>(-1);
168
+
169
+
170
+ const findMondayAndTruncate = (dates: string[]) => {
171
+ const _res = dates.map((s: string) => new Date(s));
172
+ // Find the first Monday in the sequence
173
+ for (let i = 0; i < _res.length; i++) {
174
+ const date = _res[i];
175
+ if (date.getDay() === START_WEEK_ON) {
176
+ // Return dates starting from Monday onwards
177
+ return dates.slice(i);
178
+ }
179
+ }
180
+
181
+ return []; // Return empty array if no Monday found
182
+ }
183
+
184
+
185
+
186
+ // exposes the following methods
187
+ useImperativeHandle(
188
+ contentRef,
189
+ () => ({
190
+ today: () => {
191
+ handleTodayChange();
192
+ },
193
+ next: () => {
194
+ handleNextChange();
195
+ },
196
+ prev: () => {
197
+ handlePrevChange();
198
+ },
199
+ closeModal: () => {
200
+ if (modalEditHandleRef.current) modalEditHandleRef.current.close();
201
+ if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
202
+ }
203
+ }),
204
+ [contentRef],
205
+ );
206
+
207
+
208
+ // helper buttons
209
+ const _delBtn = () => <>
210
+ {iconRemove ? <>{iconRemove}</> : <><svg width="20px" height="20px" viewBox="0 0 24 24" fill="none"><path fillRule="evenodd" clipRule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z" fill="#000" /></svg></>}
211
+ {cellCloseBtnLabel || ''}
212
+ </>;
213
+
214
+ const _addBtn = () => <>
215
+ {iconAdd ? <>{iconAdd}</> : <><svg width="20px" height="20px" viewBox="0 0 32 32"><g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd"><g transform="translate(-102.000000, -1037.000000)" fill="#000000"><path d="M124,1054 L119,1054 L119,1059 C119,1059.55 118.552,1060 118,1060 C117.448,1060 117,1059.55 117,1059 L117,1054 L112,1054 C111.448,1054 111,1053.55 111,1053 C111,1052.45 111.448,1052 112,1052 L117,1052 L117,1047 C117,1046.45 117.448,1046 118,1046 C118.552,1046 119,1046.45 119,1047 L119,1052 L124,1052 C124.552,1052 125,1052.45 125,1053 C125,1053.55 124.552,1054 124,1054 L124,1054 Z M130,1037 L106,1037 C103.791,1037 102,1038.79 102,1041 L102,1065 C102,1067.21 103.791,1069 106,1069 L130,1069 C132.209,1069 134,1067.21 134,1065 L134,1041 C134,1038.79 132.209,1037 130,1037 L130,1037 Z"></path></g></g></svg></>}
216
+ {cellAddBtnLabel || ''}
217
+ </>;
218
+
219
+
220
+
221
+ const queryItemObj = () => {
222
+ const _perData = orginalData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(`${year}-${month + 1}-${day}`));
223
+
224
+ let _currentData: any = undefined;
225
+ if (_perData[0]) {
226
+ const _items = _perData[0].list;
227
+
228
+
229
+ if (tableCellId === -1) {
230
+ // add new
231
+ _currentData = {
232
+ id: 0,
233
+ date: getCalendarDate(`${year}-${month + 1}-${day}`)
234
+ };
235
+ } else {
236
+ // edit or delete
237
+ _currentData = _items.filter((item: any) => item.id == tableCellId)[0];
238
+ }
239
+
240
+ }
241
+
242
+ return _perData[0] ? _currentData : {
243
+ id: 0,
244
+ date: getCalendarDate(`${year}-${month + 1}-${day}`)
245
+ };
246
+ };
247
+
248
+
249
+
250
+
251
+ // cell
252
+ const getCells = (type: 'none' | 'forward' | 'back' = 'none') => {
253
+
254
+ let currentMonth: any = month;
255
+ let currentStartDay: any = startDay;
256
+
257
+ // previous month
258
+ if (type === 'forward') {
259
+ const _date = new Date(year, currentMonth - 1, day);
260
+ currentMonth = _date.getMonth();
261
+ currentStartDay = getStartDayOfMonth(_date);
262
+ }
263
+
264
+ // next month
265
+ if (type === 'back') {
266
+ const _date = new Date(year, currentMonth + 1, day);
267
+ currentMonth = _date.getMonth();
268
+ currentStartDay = getStartDayOfMonth(_date);
269
+ }
270
+
271
+
272
+ //
273
+ const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i); // [0,1,..,30,31]
274
+ const rows = Math.ceil(allDays.length / 7); // 5
275
+
276
+ //
277
+ const _tempCells: any[] = Array.from({ length: rows }).fill(null);
278
+
279
+
280
+ const _getForwardFill = (_year: number, _month: number) => {
281
+ // Get the last day of the previous month
282
+ const lastDayOfLastMonth = new Date(_year, _month - 1, 0);
283
+ const last7Days: Date[] = [];
284
+
285
+ // Rewind 7 days forward from the last day
286
+ for (let i = 0; i < 7; i++) {
287
+ last7Days.unshift(new Date(lastDayOfLastMonth));
288
+ lastDayOfLastMonth.setDate(lastDayOfLastMonth.getDate() - 1);
289
+ }
290
+ return last7Days.map((v: Date) => getCalendarDate(v));
291
+ };
292
+
293
+ const _getBackFill = (_year: number, _month: number) => {
294
+ // Get the first day of the next month
295
+ const firstDayOfNextMonth = new Date(_year, _month, 1);
296
+ const first7Days: Date[] = [];
297
+
298
+ // Rewind 7 days forward from the first day of the next month
299
+ for (let i = 0; i < 7; i++) {
300
+ first7Days.push(new Date(firstDayOfNextMonth));
301
+ firstDayOfNextMonth.setDate(firstDayOfNextMonth.getDate() + 1);
302
+ }
303
+
304
+ return first7Days.map((v: Date) => getCalendarDate(v));
305
+ };
306
+
307
+
308
+
309
+ // The remaining date of the previous month
310
+ // If the number is 7, the calendar does not include the date of the previous month
311
+ const remainPrevDate = findMondayAndTruncate(_getForwardFill(year, month+1));
312
+ const remainPrevDateTotal = remainPrevDate.length === 7 ? 0 : remainPrevDate.length;
313
+
314
+
315
+ return {
316
+ rowsTotal: orginalData.length,
317
+ colsTotal: allDays.length,
318
+ forwardFillTotal: remainPrevDateTotal,
319
+ list: _tempCells.map((_: any, j: number) => {
320
+ const _col = allDays.slice(j * 7, (j + 1) * 7);
321
+
322
+
323
+ // back fill
324
+ const backFillArr: null[] = [];
325
+ for (let k = 0; k < 7 - _col.length; k++) {
326
+ backFillArr.push(null);
327
+ }
328
+ _col.splice(_col.length, 0, ...backFillArr as any);
329
+
330
+
331
+ //
332
+ const isFirstGroup = j === 0;
333
+ const isLastGroup = j === _tempCells.length - 1;
334
+
335
+
336
+ // forward fill
337
+ const __forwardFillDate: string[] = _getForwardFill(year, month + 1);
338
+
339
+ // back fill
340
+ const __backFillDate: string[] = _getBackFill(year, month + 1);
341
+
342
+
343
+ const _getDateShow = (_dayIndex: number, _m: number, _startDay: number, _month: number) => {
344
+ const currentDay = typeof _dayIndex === 'number' ? _dayIndex - (_startDay - 2) : 0; // ..., -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ...
345
+
346
+ // date
347
+ let _dateShow: any = currentDay > 0 ? `${year}-${_month + 1}-${currentDay}` : '';
348
+
349
+ // forward & back
350
+ if (isFirstGroup && _dateShow === '') {
351
+ _dateShow = __forwardFillDate.at(currentDay - 1);
352
+ }
353
+
354
+ if (isLastGroup && _dateShow === '') {
355
+ _dateShow = __backFillDate.at(_m);
356
+ }
357
+
358
+
359
+ return {
360
+ date: getCalendarDate(_dateShow),
361
+ firstGroup: isFirstGroup,
362
+ lastGroup: isLastGroup,
363
+ validDisplayDate: currentDay > 0 && currentDay <= days[month]
364
+ };
365
+
366
+ }
367
+
368
+ //
369
+ return {
370
+ month: currentMonth,
371
+ startDay: currentStartDay,
372
+ row: j,
373
+ col: _col,
374
+ dateInfo: _col.map((k: number, m: number) => {
375
+ const _lastWeekDays: number = _col.filter(Boolean).length;
376
+ return _getDateShow(k, m - _lastWeekDays, currentStartDay, currentMonth);
377
+ }),
378
+ weekDisplay: _col.map((k: number, m: number) => {
379
+ return WEEK[m]
380
+ }),
381
+ week: _col.map((k: number, m: number) => {
382
+ return m
383
+ }),
384
+
385
+ }
386
+ })
387
+ }
388
+
389
+ };
390
+
391
+
392
+ function updateTodayDate(inputDate: Date) {
393
+ setDay(inputDate.getDate());
394
+ setMonth(inputDate.getMonth());
395
+ setYear(inputDate.getFullYear());
396
+ setStartDay(getStartDayOfMonth(inputDate));
397
+
398
+ // update selector
399
+ setSelectedMonth(inputDate.getMonth());
400
+ setSelectedYear(inputDate.getFullYear());
401
+
402
+ }
403
+
404
+
405
+ function getStartDayOfMonth(date: Date) {
406
+ const startDate = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
407
+ return startDate === 0 ? 7 : startDate;
408
+ }
409
+
410
+ function isLeapYear(year: number) {
411
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
412
+ }
413
+
414
+ const days = isLeapYear(year) ? DAYS_LEAP : DAYS;
415
+
416
+
417
+
418
+ function handlePrevChange() {
419
+ setDate((prevState) => {
420
+ const _date = new Date(year, month - 1, day);
421
+
422
+ // update
423
+ setSelectedMonth(_date.getMonth());
424
+ setSelectedYear(_date.getFullYear());
425
+
426
+ //
427
+ onChangeMonth?.({
428
+ day: padZero(day),
429
+ month: padZero(_date.getMonth() + 1),
430
+ year: _date.getFullYear().toString()
431
+ });
432
+
433
+
434
+ return _date;
435
+ });
436
+
437
+
438
+ }
439
+
440
+ function handleNextChange() {
441
+ setDate((prevState) => {
442
+ const _date = new Date(year, month + 1, day);
443
+
444
+ // update
445
+ setSelectedMonth(_date.getMonth());
446
+ setSelectedYear(_date.getFullYear());
447
+
448
+ //
449
+ onChangeMonth?.({
450
+ day: padZero(day),
451
+ month: padZero(_date.getMonth() + 1),
452
+ year: _date.getFullYear().toString()
453
+ });
454
+
455
+ return _date;
456
+ });
457
+ }
458
+ function handleDayChange(e: React.MouseEvent, currentDay: number) {
459
+ setDate(new Date(year, month, currentDay));
460
+ }
461
+
462
+
463
+ function handleYearChange(currentValue: number) {
464
+ setSelectedYear(currentValue);
465
+ setYear(currentValue);
466
+ setDate(new Date(currentValue, month, day));
467
+
468
+ // close win
469
+ setWinYear(false);
470
+
471
+ }
472
+
473
+
474
+ function handleMonthChange(currentIndex: number) {
475
+ setSelectedMonth(currentIndex);
476
+ setMonth(currentIndex);
477
+ setDate(new Date(year, currentIndex, day));
478
+
479
+ // close win
480
+ setWinMonth(false);
481
+
482
+
483
+ //
484
+ onChangeMonth?.({
485
+ day: padZero(day),
486
+ month: padZero(currentIndex + 1),
487
+ year: year.toString()
488
+ });
489
+
490
+ }
491
+
492
+
493
+ function handleTodayChange() {
494
+ setSelectedMonth(now.getMonth());
495
+ setSelectedYear(now.getFullYear());
496
+ updateTodayDate(now);
497
+
498
+ //
499
+ const _now = getTodayDate().split('-');
500
+ onChangeToday?.({
501
+ day: _now[2],
502
+ month: _now[1],
503
+ year: _now[0]
504
+ });
505
+
506
+ }
507
+
508
+
509
+ function handleShowWinYear() {
510
+ setWinYear((prevState: boolean) => !prevState);
511
+ }
512
+
513
+ function handleShowWinMonth() {
514
+ setWinMonth((prevState: boolean) => !prevState);
515
+ }
516
+
517
+
518
+
519
+ //if user change the selectedYear, then udate the years array that is displayed on year tab view
520
+ useEffect(() => {
521
+ const years: number[] = [];
522
+ for (let y = selectedYear - 10; y < selectedYear + 10; y++) {
523
+ years.push(y as never)
524
+ }
525
+ setYearsCollection(years);
526
+ }, [selectedYear]);
527
+
528
+
529
+ useEffect(() => {
530
+ // Guaranteed year change triggered by the front and rear buttons
531
+ onChangeYear?.({
532
+ day: padZero(day),
533
+ month: padZero(month + 1),
534
+ year: year.toString()
535
+ });
536
+ }, [year]);
537
+
538
+
539
+
540
+ useEffect(() => {
541
+ updateTodayDate(date);
542
+ }, [date]);
543
+
544
+
545
+ useEffect(() => {
546
+
547
+ // update events value
548
+ if (Array.isArray(eventsValue)) setOrginalData(eventsValue);
549
+
550
+ // update current today
551
+ if (typeof customTodayDate === 'string' && customTodayDate !== '' && isValidDate(customTodayDate)) {
552
+ const _customNow = new Date(customTodayDate);
553
+ updateTodayDate(_customNow);
554
+ }
555
+
556
+ // Call a function when the list has been rendered completely
557
+ onListRenderComplete?.();
558
+
559
+ }, [eventsValue, customTodayDate]);
560
+
561
+
562
+ return (
563
+ <>
564
+
565
+ <div
566
+ className={combinedCls(
567
+ "custom-event-cal__wrapper",
568
+ calendarWrapperClassName
569
+ )}
570
+ onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
571
+ onKeyPressed?.(e);
572
+ }}
573
+ tabIndex={-1}
574
+ >
575
+
576
+
577
+ {/*++++++++++++++++ MAIN ++++++++++++++++*/}
578
+ <div className="custom-event-cal__header bg-body-tertiary">
579
+ <button tabIndex={-1} type="button" className="custom-event-cal__btn custom-event-cal__btn--prev" onClick={handlePrevChange}>
580
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
581
+ <path d="M14.2893 5.70708C13.8988 5.31655 13.2657 5.31655 12.8751 5.70708L7.98768 10.5993C7.20729 11.3805 7.2076 12.6463 7.98837 13.427L12.8787 18.3174C13.2693 18.7079 13.9024 18.7079 14.293 18.3174C14.6835 17.9269 14.6835 17.2937 14.293 16.9032L10.1073 12.7175C9.71678 12.327 9.71678 11.6939 10.1073 11.3033L14.2893 7.12129C14.6799 6.73077 14.6799 6.0976 14.2893 5.70708Z" fill="#000" />
582
+ </svg>
583
+ </button>
584
+ <div className="custom-event-cal__header__btns">
585
+ <button tabIndex={-1} type="button" className={`custom-event-cal__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
586
+ {MONTHS[month]}
587
+ <svg width="12px" height="12px" viewBox="0 0 24 24"><path d="M11.178 19.569a.998.998 0 0 0 1.644 0l9-13A.999.999 0 0 0 21 5H3a1.002 1.002 0 0 0-.822 1.569l9 13z" fill="#000000" /></svg>
588
+ </button>
589
+ <button tabIndex={-1} type="button" className={`custom-event-cal__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
590
+ {year}
591
+ <svg width="12px" height="12px" viewBox="0 0 24 24"><path d="M11.178 19.569a.998.998 0 0 0 1.644 0l9-13A.999.999 0 0 0 21 5H3a1.002 1.002 0 0 0-.822 1.569l9 13z" fill="#000000" /></svg>
592
+ </button>
593
+ </div>
594
+ <button tabIndex={-1} type="button" className="custom-event-cal__btn custom-event-cal__btn--next" onClick={handleNextChange}>
595
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
596
+ <path d="M9.71069 18.2929C10.1012 18.6834 10.7344 18.6834 11.1249 18.2929L16.0123 13.4006C16.7927 12.6195 16.7924 11.3537 16.0117 10.5729L11.1213 5.68254C10.7308 5.29202 10.0976 5.29202 9.70708 5.68254C9.31655 6.07307 9.31655 6.70623 9.70708 7.09676L13.8927 11.2824C14.2833 11.6729 14.2833 12.3061 13.8927 12.6966L9.71069 16.8787C9.32016 17.2692 9.32016 17.9023 9.71069 18.2929Z" fill="#000" />
597
+ </svg>
598
+ </button>
599
+ </div>
600
+ <div className="custom-event-cal__body">
601
+
602
+ {/* week */}
603
+ <div className="custom-event-cal__row">
604
+ {WEEK.map((s: string, i: number) => (
605
+ <div
606
+ className={combinedCls(
607
+ 'custom-event-cal__cell custom-event-cal__day custom-event-cal__day--week custom-event-cal__day--disabled bg-secondary-subtle empty',
608
+ {
609
+ 'last-cell': i === WEEK.length - 1
610
+ }
611
+ )}
612
+ key={i}
613
+ data-week={i}
614
+ dangerouslySetInnerHTML={{
615
+ __html: s
616
+ }}
617
+ />
618
+ ))}
619
+ </div>
620
+ {/* /week */}
621
+
622
+ {/* day */}
623
+ {getCells().list.map((item: any, j: number) => {
624
+
625
+ const isLastRow = j === getCells().list.length - 1;
626
+
627
+ return <div key={'row' + item.row} className="custom-event-cal__row">
628
+ {item.col.map((dayIndex: number | null, i: number) => {
629
+
630
+ const isLastCell = i === item.col.length - 1;
631
+
632
+ // date
633
+ const _dateShow = item.dateInfo[i].date;
634
+ const _dateDayShow = _dateShow.split('-').at(-1);
635
+
636
+ // week day
637
+ const weekDay = item.week[i];
638
+
639
+ // helper
640
+ const d = parseFloat(_dateDayShow);
641
+ const _currentData = orginalData.filter((item: any) => getCalendarDate(item.date as string) === _dateShow);
642
+ const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
643
+ const isForward = item.dateInfo[i].firstGroup && !isInteractive;
644
+ const isBack = item.dateInfo[i].lastGroup && !isInteractive;
645
+
646
+
647
+ const _eventContent = () => {
648
+
649
+ if (
650
+ _currentData.length === 0 ||
651
+ !Array.isArray(_currentData) ||
652
+ typeof _currentData[0].list === 'undefined'
653
+ ) {
654
+ return null;
655
+ }
656
+
657
+ //
658
+ const _items = _currentData[0].list;
659
+
660
+ return _items.map((cellItem: any, cellItemIndex: number) => {
661
+
662
+ return <div
663
+ className={combinedCls(
664
+ `custom-event-cal__cell-item custom-event-cal__cell-item-${cellItemIndex}`,
665
+ {
666
+ 'first': cellItemIndex === 0,
667
+ 'last': cellItemIndex === _items.length - 1
668
+ }
669
+ )}
670
+ key={`cell-item-${cellItemIndex}}`}
671
+ data-date={_dateShow}
672
+ data-day={_dateDayShow}
673
+ data-week={weekDay}
674
+ onClick={(e: React.MouseEvent) => {
675
+ e.stopPropagation();
676
+
677
+ // update cell data
678
+ setTableCellId(cellItem.id);
679
+
680
+ // Callback
681
+ cellItem.callback?.();
682
+
683
+
684
+ if (isInteractive) {
685
+ handleDayChange(e, d); // update current day
686
+
687
+ //
688
+ const _now = cellItem.date.split('-');
689
+ onChangeDate?.(e, {
690
+ ...cellItem,
691
+ day: _now[2],
692
+ month: _now[1],
693
+ year: _now[0]
694
+ });
695
+
696
+ if (EVENTS_ENABLED) {
697
+ onModalEditOpen?.(cellItem, () => setShowEdit(true), 'normal');
698
+ }
699
+ }
700
+ }}
701
+ >
702
+
703
+ {/* ITEM */}
704
+ <div
705
+ className="custom-event-cal__day__event"
706
+ style={typeof cellItem !== 'undefined' && (cellItem as any).eventStyles !== 'undefined' ? cellItem.eventStyles : {}}
707
+ dangerouslySetInnerHTML={typeof cellItem.data === 'string' ? {
708
+ __html: cellItem.data
709
+ } : undefined}
710
+ >
711
+ {React.isValidElement(cellItem.data) ? <>{cellItem.data}</> : null}
712
+ </div>
713
+ {/* /ITEM */}
714
+
715
+ {/* DELETE BUTTON */}
716
+ <div
717
+ className={`custom-event-cal__day__eventdel ${cellCloseBtnClassName || ''}`}
718
+ >
719
+ <a
720
+ href="#"
721
+ tabIndex={-1}
722
+ className="align-middle"
723
+ data-date={getCalendarDate(_dateShow)}
724
+ data-day={padZero(d)}
725
+ data-week={i}
726
+ onClick={(e: React.MouseEvent) => {
727
+ e.preventDefault();
728
+ e.stopPropagation();
729
+
730
+ // update cell data
731
+ setTableCellId(cellItem.id);
732
+
733
+
734
+ const _existsContent = cellItem;
735
+
736
+ //
737
+ if (isInteractive) {
738
+ handleDayChange(e, d); // update current day
739
+
740
+
741
+ //
742
+ const _now = getCalendarDate(`${year}-${month + 1}-${d}`).split('-');
743
+ onChangeDate?.(e, {
744
+ id: 0,
745
+ date: getCalendarDate(`${year}-${month + 1}-${d}`),
746
+ day: _now[2],
747
+ month: _now[1],
748
+ year: _now[0]
749
+ });
750
+
751
+ if (EVENTS_DELETE_ENABLED) {
752
+ onModalDeleteOpen?.(_existsContent, () => setShowDelete(true));
753
+ }
754
+ }
755
+
756
+ }}
757
+ >
758
+ {_delBtn()}
759
+ </a>
760
+
761
+ </div>
762
+ {/* /DELETE BUTTON */}
763
+ </div>
764
+ });
765
+ };
766
+
767
+
768
+ return (
769
+ <div
770
+ className={combinedCls(
771
+ 'custom-event-cal__cell custom-event-cal__day',
772
+ {
773
+ 'empty': !isInteractive,
774
+ 'today': d === now.getDate(),
775
+ 'selected': d === day,
776
+ 'last-cell': isLastCell,
777
+ 'last-row': isLastRow,
778
+ }
779
+ )}
780
+ key={"col" + i}
781
+ data-date={getCalendarDate(_dateShow)}
782
+ data-day={padZero(d)}
783
+ data-week={i}
784
+ onMouseEnter={(e: React.MouseEvent) => {
785
+ onCellMouseEnter?.(e);
786
+ }}
787
+ onMouseDown={(e: React.MouseEvent) => {
788
+ //
789
+ onCellClick?.(e);
790
+
791
+ if (isInteractive) {
792
+ handleDayChange(e, d); // update current day
793
+ onChangeDate?.(e, null);
794
+ }
795
+ }}
796
+ onDoubleClick={(e: React.MouseEvent) => {
797
+ //
798
+ onCellDoubleClick?.(e);
799
+ }}
800
+ onMouseLeave={(e: React.MouseEvent) => {
801
+ onCellMouseLeave?.(e);
802
+ }}
803
+ onMouseUp={(e: React.MouseEvent) => {
804
+ onCellMouseUp?.(e);
805
+ }}
806
+
807
+ >
808
+
809
+ {/* forward fill & day & back fill */}
810
+ <span
811
+ className={combinedCls(
812
+ {
813
+ 'disabled': !isInteractive
814
+ }
815
+ )}
816
+ >
817
+ {d}
818
+ </span>
819
+
820
+ {/*++++++++++++++++ EVENT ++++++++++++++++*/}
821
+ {_eventContent()}
822
+ {/*++++++++++++++++ /EVENT ++++++++++++++++*/}
823
+
824
+ {/* ADD BUTTON */}
825
+ {isForward || isBack ? null : <>
826
+ <div
827
+ className={`custom-event-cal__day__eventadd ${cellAddBtnClassName || ''}`}
828
+ >
829
+ <a
830
+ href="#"
831
+ tabIndex={-1}
832
+ className="align-middle"
833
+ data-date={getCalendarDate(_dateShow)}
834
+ data-day={padZero(d)}
835
+ data-week={i}
836
+ onClick={(e: React.MouseEvent) => {
837
+ e.preventDefault();
838
+ e.stopPropagation();
839
+
840
+ // update cell data
841
+ setTableCellId(-1);
842
+
843
+ //
844
+ if (isInteractive) {
845
+ handleDayChange(e, d); // update current day
846
+
847
+
848
+ //
849
+ const _now = getCalendarDate(`${year}-${month + 1}-${d}`).split('-');
850
+ onChangeDate?.(e, {
851
+ id: 0,
852
+ date: getCalendarDate(`${year}-${month + 1}-${d}`),
853
+ day: _now[2],
854
+ month: _now[1],
855
+ year: _now[0]
856
+ });
857
+
858
+ if (EVENTS_ENABLED) {
859
+ onModalEditOpen?.({
860
+ id: 0,
861
+ date: getCalendarDate(`${year}-${month + 1}-${d}`)
862
+ }, () => setShowEdit(true), 'new');
863
+ }
864
+ }
865
+ }}
866
+ >
867
+ {_addBtn()}
868
+ </a>
869
+
870
+ </div>
871
+ </>}
872
+ {/* /ADD BUTTON */}
873
+
874
+ </div>
875
+ );
876
+ })}
877
+ </div>;
878
+
879
+ })}
880
+
881
+ {/* /day */}
882
+
883
+ </div>
884
+ {/*++++++++++++++++ /MAIN ++++++++++++++++*/}
885
+
886
+
887
+ {/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
888
+ <div className={`custom-event-cal__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
889
+ <div className="custom-event-cal__month-container">
890
+ {MONTHS_FULL.map((month, index) => {
891
+ return <div
892
+ data-month={padZero(index + 1)}
893
+ className={`custom-event-cal__month ${selectedMonth === index ? ' selected' : ''}`}
894
+ key={month + index}
895
+ onClick={() => { handleMonthChange(index) }}
896
+ >{month}</div>
897
+ })}
898
+ </div>
899
+ </div>
900
+ {/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
901
+
902
+ {/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
903
+ <div className={`custom-event-cal__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
904
+ <div className="custom-event-cal__year-container bg-body-tertiary">
905
+ {yearsArray.map((year, index) => {
906
+ return <div
907
+ data-year={year}
908
+ className={`custom-event-cal__year ${selectedYear === year ? ' selected' : ''}`}
909
+ key={year + index}
910
+ onClick={() => { handleYearChange(year) }}
911
+ >{year}</div>
912
+ })}
913
+ </div>
914
+
915
+ </div>
916
+ {/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
917
+
918
+
919
+
920
+ {/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
921
+ <div className="custom-event-cal__today-wrapper p-2 bg-body-tertiary">
922
+ <button tabIndex={-1} type="button" className="custom-event-cal__btn custom-event-cal__btn--today" onClick={handleTodayChange}>
923
+ {langToday || 'Today'}
924
+ </button>
925
+ </div>
926
+ {/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
927
+
928
+
929
+ </div>
930
+
931
+
932
+ {/*++++++++++++++++ MODAL ++++++++++++++++*/}
933
+ {EVENTS_ENABLED ? <>
934
+
935
+ {/*<!-- DELETE -->*/}
936
+ <ModalDialog
937
+ ref={modalDeleteHandleRef}
938
+ show={showDelete}
939
+ maskOpacity={modalMaskOpacity}
940
+ triggerClassName=""
941
+ triggerContent=""
942
+ closeBtnClassName={modalCloseBtnClassName || 'btn btn-secondary'}
943
+ closeBtnLabel={modalCloseBtnLabel || 'Close'}
944
+ submitBtnClassName={modalSubmitDeleteBtnClassName || 'btn btn-danger'}
945
+ submitBtnLabel={modalSubmitDeleteBtnLabel || <>Delete</>}
946
+ onClose={(e) => {
947
+
948
+ setTimeout(() => {
949
+ setShowDelete(false);
950
+ onModalDeleteClose?.(queryItemObj());
951
+ }, 350);
952
+ }}
953
+ onSubmit={async (e: any, closewin: Function, data: any) => {
954
+ onModalDeleteEvent?.(queryItemObj(), closewin);
955
+
956
+ }}
957
+ >
958
+ {modalDeleteContent || 'Are you sure?'}
959
+
960
+ </ModalDialog>
961
+ {/*<!-- /DELETE -->*/}
962
+
963
+
964
+ {/*<!-- EDIT -->*/}
965
+ <ModalDialog
966
+ ref={modalEditHandleRef}
967
+ show={showEdit}
968
+ maskOpacity={modalMaskOpacity}
969
+ heading={modalHeading}
970
+ maxWidth={modalMaxWidth}
971
+ minHeight={modalMinHeight}
972
+ triggerClassName=""
973
+ triggerContent=""
974
+ closeBtnClassName={modalCloseBtnClassName || 'btn btn-secondary'}
975
+ closeBtnLabel={modalCloseBtnLabel || 'Close'}
976
+ submitBtnClassName={modalSubmitBtnClassName || 'btn btn-primary'}
977
+ submitBtnLabel={modalSubmitBtnLabel || <>Save</>}
978
+ onClose={(e) => {
979
+ setTimeout(() => {
980
+ setShowEdit(false);
981
+ onModalEditClose?.(queryItemObj());
982
+ }, 350);
983
+ }}
984
+ onSubmit={async (e: any, closewin: Function, data: any) => {
985
+ onModalEditEvent?.(queryItemObj(), closewin);
986
+
987
+ }}
988
+ >
989
+ {modalContent}
990
+
991
+ </ModalDialog>
992
+ {/*<!-- /EDIT -->*/}
993
+
994
+
995
+ </> : null}
996
+ {/*++++++++++++++++ /MODAL ++++++++++++++++*/}
997
+
998
+
999
+ </>
1000
+ )
1001
+ };
1002
+
1003
+
1004
+ export default EventCalendar;