funda-ui 4.7.624 → 4.7.625
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.
- package/README.md +2 -116
- package/package.json +1 -591
- package/.gitattributes +0 -2
- package/README_PUBLISH.md +0 -328
- package/logo.png +0 -0
- package/preview.png +0 -0
- package/publish/LICENSE +0 -21
- package/publish/README.md +0 -328
- package/publish/lib/cjs/Accordion/index.d.ts +0 -2
- package/publish/lib/cjs/Accordion/index.js +0 -667
- package/publish/lib/cjs/BackToTop/index.d.ts +0 -17
- package/publish/lib/cjs/BackToTop/index.js +0 -904
- package/publish/lib/cjs/CascadingSelect/index.d.ts +0 -80
- package/publish/lib/cjs/CascadingSelect/index.js +0 -3383
- package/publish/lib/cjs/CascadingSelectE2E/index.d.ts +0 -91
- package/publish/lib/cjs/CascadingSelectE2E/index.js +0 -3988
- package/publish/lib/cjs/Chatbox/index.d.ts +0 -101
- package/publish/lib/cjs/Chatbox/index.js +0 -7037
- package/publish/lib/cjs/Checkbox/index.d.ts +0 -28
- package/publish/lib/cjs/Checkbox/index.js +0 -673
- package/publish/lib/cjs/ColorPicker/index.d.ts +0 -27
- package/publish/lib/cjs/ColorPicker/index.js +0 -662
- package/publish/lib/cjs/Date/index.d.ts +0 -70
- package/publish/lib/cjs/Date/index.js +0 -6368
- package/publish/lib/cjs/DigitalClock/index.d.ts +0 -7
- package/publish/lib/cjs/DigitalClock/index.js +0 -402
- package/publish/lib/cjs/DragDropList/index.d.ts +0 -45
- package/publish/lib/cjs/DragDropList/index.js +0 -1586
- package/publish/lib/cjs/DropdownMenu/index.d.ts +0 -38
- package/publish/lib/cjs/DropdownMenu/index.js +0 -1507
- package/publish/lib/cjs/DynamicFields/index.d.ts +0 -40
- package/publish/lib/cjs/DynamicFields/index.js +0 -818
- package/publish/lib/cjs/EventCalendar/index.d.ts +0 -61
- package/publish/lib/cjs/EventCalendar/index.js +0 -3789
- package/publish/lib/cjs/EventCalendarTimeline/index.d.ts +0 -100
- package/publish/lib/cjs/EventCalendarTimeline/index.js +0 -6141
- package/publish/lib/cjs/File/index.d.ts +0 -40
- package/publish/lib/cjs/File/index.js +0 -1751
- package/publish/lib/cjs/HorizontalScrollContent/index.d.ts +0 -14
- package/publish/lib/cjs/HorizontalScrollContent/index.js +0 -426
- package/publish/lib/cjs/Input/index.d.ts +0 -59
- package/publish/lib/cjs/Input/index.js +0 -1486
- package/publish/lib/cjs/LiveSearch/index.d.ts +0 -70
- package/publish/lib/cjs/LiveSearch/index.js +0 -4180
- package/publish/lib/cjs/MasonryLayout/index.d.ts +0 -14
- package/publish/lib/cjs/MasonryLayout/index.js +0 -689
- package/publish/lib/cjs/ModalDialog/index.d.ts +0 -83
- package/publish/lib/cjs/ModalDialog/index.js +0 -1719
- package/publish/lib/cjs/ModeSwitch/index.d.ts +0 -17
- package/publish/lib/cjs/ModeSwitch/index.js +0 -202
- package/publish/lib/cjs/MultilevelDropdownMenu/index.d.ts +0 -20
- package/publish/lib/cjs/MultilevelDropdownMenu/index.js +0 -930
- package/publish/lib/cjs/MultipleCheckboxes/index.d.ts +0 -66
- package/publish/lib/cjs/MultipleCheckboxes/index.js +0 -2337
- package/publish/lib/cjs/MultipleSelect/index.d.ts +0 -65
- package/publish/lib/cjs/MultipleSelect/index.js +0 -4197
- package/publish/lib/cjs/NativeSelect/index.d.ts +0 -37
- package/publish/lib/cjs/NativeSelect/index.js +0 -2052
- package/publish/lib/cjs/NumberInput/index.d.ts +0 -40
- package/publish/lib/cjs/NumberInput/index.js +0 -1191
- package/publish/lib/cjs/Pagination/index.d.ts +0 -51
- package/publish/lib/cjs/Pagination/index.js +0 -612
- package/publish/lib/cjs/Radio/index.d.ts +0 -45
- package/publish/lib/cjs/Radio/index.js +0 -1838
- package/publish/lib/cjs/RangeSlider/index.d.ts +0 -22
- package/publish/lib/cjs/RangeSlider/index.js +0 -2696
- package/publish/lib/cjs/Refresher/index.d.ts +0 -22
- package/publish/lib/cjs/Refresher/index.js +0 -564
- package/publish/lib/cjs/RootPortal/index.d.ts +0 -9
- package/publish/lib/cjs/RootPortal/index.js +0 -148
- package/publish/lib/cjs/ScrollReveal/index.d.ts +0 -21
- package/publish/lib/cjs/ScrollReveal/index.js +0 -401
- package/publish/lib/cjs/Scrollbar/index.d.ts +0 -17
- package/publish/lib/cjs/Scrollbar/index.js +0 -1107
- package/publish/lib/cjs/SearchBar/index.d.ts +0 -41
- package/publish/lib/cjs/SearchBar/index.js +0 -701
- package/publish/lib/cjs/Select/index.d.ts +0 -107
- package/publish/lib/cjs/Select/index.js +0 -6540
- package/publish/lib/cjs/ShowMoreLess/index.d.ts +0 -36
- package/publish/lib/cjs/ShowMoreLess/index.js +0 -387
- package/publish/lib/cjs/SplitterPanel/index.d.ts +0 -20
- package/publish/lib/cjs/SplitterPanel/index.js +0 -800
- package/publish/lib/cjs/Stepper/index.d.ts +0 -26
- package/publish/lib/cjs/Stepper/index.js +0 -568
- package/publish/lib/cjs/Switch/index.d.ts +0 -25
- package/publish/lib/cjs/Switch/index.js +0 -630
- package/publish/lib/cjs/Table/index.d.ts +0 -12
- package/publish/lib/cjs/Table/index.js +0 -2311
- package/publish/lib/cjs/Tabs/index.d.ts +0 -3
- package/publish/lib/cjs/Tabs/index.js +0 -771
- package/publish/lib/cjs/TagInput/index.d.ts +0 -37
- package/publish/lib/cjs/TagInput/index.js +0 -1227
- package/publish/lib/cjs/Textarea/index.d.ts +0 -50
- package/publish/lib/cjs/Textarea/index.js +0 -1795
- package/publish/lib/cjs/Toast/index.d.ts +0 -3
- package/publish/lib/cjs/Toast/index.js +0 -1345
- package/publish/lib/cjs/Tooltip/index.d.ts +0 -38
- package/publish/lib/cjs/Tooltip/index.js +0 -1778
- package/publish/lib/cjs/Tree/index.d.ts +0 -78
- package/publish/lib/cjs/Tree/index.js +0 -2330
- package/publish/lib/cjs/Utils/anim.d.ts +0 -11
- package/publish/lib/cjs/Utils/anim.js +0 -846
- package/publish/lib/cjs/Utils/bodyScrollLock.d.ts +0 -8
- package/publish/lib/cjs/Utils/bodyScrollLock.js +0 -311
- package/publish/lib/cjs/Utils/buffer.d.ts +0 -67
- package/publish/lib/cjs/Utils/buffer.js +0 -343
- package/publish/lib/cjs/Utils/cls.d.ts +0 -15
- package/publish/lib/cjs/Utils/cls.js +0 -124
- package/publish/lib/cjs/Utils/convert.d.ts +0 -25
- package/publish/lib/cjs/Utils/convert.js +0 -109
- package/publish/lib/cjs/Utils/date.d.ts +0 -227
- package/publish/lib/cjs/Utils/date.js +0 -587
- package/publish/lib/cjs/Utils/dom.d.ts +0 -13
- package/publish/lib/cjs/Utils/dom.js +0 -215
- package/publish/lib/cjs/Utils/easing.d.ts +0 -29
- package/publish/lib/cjs/Utils/easing.js +0 -221
- package/publish/lib/cjs/Utils/extract.d.ts +0 -66
- package/publish/lib/cjs/Utils/extract.js +0 -195
- package/publish/lib/cjs/Utils/format-string.d.ts +0 -65
- package/publish/lib/cjs/Utils/format-string.js +0 -167
- package/publish/lib/cjs/Utils/formdata.d.ts +0 -13
- package/publish/lib/cjs/Utils/formdata.js +0 -131
- package/publish/lib/cjs/Utils/getElementProperty.d.ts +0 -52
- package/publish/lib/cjs/Utils/getElementProperty.js +0 -189
- package/publish/lib/cjs/Utils/guid.d.ts +0 -7
- package/publish/lib/cjs/Utils/guid.js +0 -67
- package/publish/lib/cjs/Utils/initDefaultOptions.d.ts +0 -10
- package/publish/lib/cjs/Utils/initDefaultOptions.js +0 -607
- package/publish/lib/cjs/Utils/inputsCalculation.d.ts +0 -28
- package/publish/lib/cjs/Utils/inputsCalculation.js +0 -188
- package/publish/lib/cjs/Utils/math.d.ts +0 -77
- package/publish/lib/cjs/Utils/math.js +0 -305
- package/publish/lib/cjs/Utils/object.d.ts +0 -18
- package/publish/lib/cjs/Utils/object.js +0 -120
- package/publish/lib/cjs/Utils/os.d.ts +0 -2
- package/publish/lib/cjs/Utils/os.js +0 -104
- package/publish/lib/cjs/Utils/performance.d.ts +0 -3
- package/publish/lib/cjs/Utils/performance.js +0 -94
- package/publish/lib/cjs/Utils/sanitize.d.ts +0 -14
- package/publish/lib/cjs/Utils/sanitize.js +0 -87
- package/publish/lib/cjs/Utils/time.d.ts +0 -40
- package/publish/lib/cjs/Utils/time.js +0 -177
- package/publish/lib/cjs/Utils/tree.d.ts +0 -40
- package/publish/lib/cjs/Utils/tree.js +0 -195
- package/publish/lib/cjs/Utils/useAutosizeTextArea.d.ts +0 -10
- package/publish/lib/cjs/Utils/useAutosizeTextArea.js +0 -231
- package/publish/lib/cjs/Utils/useBoundedDrag.d.ts +0 -125
- package/publish/lib/cjs/Utils/useBoundedDrag.js +0 -380
- package/publish/lib/cjs/Utils/useClickOutside.d.ts +0 -33
- package/publish/lib/cjs/Utils/useClickOutside.js +0 -166
- package/publish/lib/cjs/Utils/useComId.d.ts +0 -6
- package/publish/lib/cjs/Utils/useComId.js +0 -114
- package/publish/lib/cjs/Utils/useDebounce.d.ts +0 -20
- package/publish/lib/cjs/Utils/useDebounce.js +0 -138
- package/publish/lib/cjs/Utils/useDragDropPosition.d.ts +0 -166
- package/publish/lib/cjs/Utils/useDragDropPosition.js +0 -453
- package/publish/lib/cjs/Utils/useDraggable.d.ts +0 -62
- package/publish/lib/cjs/Utils/useDraggable.js +0 -348
- package/publish/lib/cjs/Utils/useHistoryTracker.d.ts +0 -166
- package/publish/lib/cjs/Utils/useHistoryTracker.js +0 -649
- package/publish/lib/cjs/Utils/useInterval.d.ts +0 -5
- package/publish/lib/cjs/Utils/useInterval.js +0 -168
- package/publish/lib/cjs/Utils/useIsMobile.d.ts +0 -2
- package/publish/lib/cjs/Utils/useIsMobile.js +0 -232
- package/publish/lib/cjs/Utils/useKeyPress.d.ts +0 -44
- package/publish/lib/cjs/Utils/useKeyPress.js +0 -200
- package/publish/lib/cjs/Utils/useSessionStorageListener.d.ts +0 -2
- package/publish/lib/cjs/Utils/useSessionStorageListener.js +0 -157
- package/publish/lib/cjs/Utils/useStreamController.d.ts +0 -71
- package/publish/lib/cjs/Utils/useStreamController.js +0 -494
- package/publish/lib/cjs/Utils/useThrottle.d.ts +0 -2
- package/publish/lib/cjs/Utils/useThrottle.js +0 -136
- package/publish/lib/cjs/Utils/useWindowScroll.d.ts +0 -12
- package/publish/lib/cjs/Utils/useWindowScroll.js +0 -217
- package/publish/lib/cjs/Utils/validate.d.ts +0 -53
- package/publish/lib/cjs/Utils/validate.js +0 -536
- package/publish/lib/cjs/Utils/viewport.d.ts +0 -7
- package/publish/lib/cjs/Utils/viewport.js +0 -64
- package/publish/lib/cjs/index.d.ts +0 -49
- package/publish/lib/cjs/index.js +0 -50
- package/publish/lib/css/BackToTop/index.css +0 -34
- package/publish/lib/css/CascadingSelect/index.css +0 -245
- package/publish/lib/css/CascadingSelectE2E/index.css +0 -245
- package/publish/lib/css/Chatbox/index.css +0 -774
- package/publish/lib/css/ColorPicker/index.css +0 -58
- package/publish/lib/css/Date/index.css +0 -434
- package/publish/lib/css/DragDropList/index.css +0 -188
- package/publish/lib/css/DropdownMenu/index.css +0 -151
- package/publish/lib/css/EventCalendar/index.css +0 -300
- package/publish/lib/css/EventCalendarTimeline/index.css +0 -694
- package/publish/lib/css/HorizontalScrollContent/index.css +0 -70
- package/publish/lib/css/LiveSearch/index.css +0 -88
- package/publish/lib/css/MultilevelDropdownMenu/index.css +0 -38
- package/publish/lib/css/MultipleSelect/index.css +0 -313
- package/publish/lib/css/RangeSlider/index.css +0 -150
- package/publish/lib/css/Scrollbar/index.css +0 -176
- package/publish/lib/css/Select/index.css +0 -434
- package/publish/lib/css/ShowMoreLess/index.css +0 -23
- package/publish/lib/css/SplitterPanel/index.css +0 -63
- package/publish/lib/css/Stepper/index.css +0 -250
- package/publish/lib/css/Table/index.css +0 -584
- package/publish/lib/css/TagInput/index.css +0 -91
- package/publish/lib/css/Toast/index.css +0 -149
- package/publish/lib/css/Tooltip/index.css +0 -198
- package/publish/lib/css/Tree/index.css +0 -237
- package/publish/lib/esm/Accordion/Accordion.tsx +0 -185
- package/publish/lib/esm/Accordion/AccordionItem.tsx +0 -248
- package/publish/lib/esm/Accordion/index.tsx +0 -2
- package/publish/lib/esm/BackToTop/index.scss +0 -47
- package/publish/lib/esm/BackToTop/index.tsx +0 -177
- package/publish/lib/esm/CascadingSelect/Group.tsx +0 -83
- package/publish/lib/esm/CascadingSelect/index.scss +0 -330
- package/publish/lib/esm/CascadingSelect/index.tsx +0 -1397
- package/publish/lib/esm/CascadingSelectE2E/Group.tsx +0 -87
- package/publish/lib/esm/CascadingSelectE2E/index.scss +0 -333
- package/publish/lib/esm/CascadingSelectE2E/index.tsx +0 -1684
- package/publish/lib/esm/Chatbox/PureLoader.tsx +0 -47
- package/publish/lib/esm/Chatbox/TypingEffect.tsx +0 -56
- package/publish/lib/esm/Chatbox/index.scss +0 -966
- package/publish/lib/esm/Chatbox/index.tsx +0 -1742
- package/publish/lib/esm/Chatbox/utils/func.ts +0 -180
- package/publish/lib/esm/Checkbox/index.tsx +0 -206
- package/publish/lib/esm/ColorPicker/index.scss +0 -91
- package/publish/lib/esm/ColorPicker/index.tsx +0 -204
- package/publish/lib/esm/Date/Calendar.tsx +0 -723
- package/publish/lib/esm/Date/index.scss +0 -567
- package/publish/lib/esm/Date/index.tsx +0 -1797
- package/publish/lib/esm/Date/localization/en_US.js +0 -13
- package/publish/lib/esm/Date/localization/zh_CN.js +0 -12
- package/publish/lib/esm/DigitalClock/index.tsx +0 -74
- package/publish/lib/esm/DragDropList/index.scss +0 -245
- package/publish/lib/esm/DragDropList/index.tsx +0 -504
- package/publish/lib/esm/DropdownMenu/Option.tsx +0 -55
- package/publish/lib/esm/DropdownMenu/index.scss +0 -205
- package/publish/lib/esm/DropdownMenu/index.tsx +0 -378
- package/publish/lib/esm/DynamicFields/index.tsx +0 -409
- package/publish/lib/esm/EventCalendar/index.scss +0 -407
- package/publish/lib/esm/EventCalendar/index.tsx +0 -1005
- package/publish/lib/esm/EventCalendarTimeline/index.scss +0 -926
- package/publish/lib/esm/EventCalendarTimeline/index.tsx +0 -2686
- package/publish/lib/esm/File/index.tsx +0 -477
- package/publish/lib/esm/HorizontalScrollContent/index.scss +0 -87
- package/publish/lib/esm/HorizontalScrollContent/index.tsx +0 -171
- package/publish/lib/esm/Input/index.tsx +0 -641
- package/publish/lib/esm/LiveSearch/index.scss +0 -129
- package/publish/lib/esm/LiveSearch/index.tsx +0 -1058
- package/publish/lib/esm/MasonryLayout/index.tsx +0 -326
- package/publish/lib/esm/ModalDialog/index.tsx +0 -572
- package/publish/lib/esm/ModeSwitch/index.tsx +0 -82
- package/publish/lib/esm/MultilevelDropdownMenu/ItemList.tsx +0 -265
- package/publish/lib/esm/MultilevelDropdownMenu/index.scss +0 -79
- package/publish/lib/esm/MultilevelDropdownMenu/index.tsx +0 -77
- package/publish/lib/esm/MultipleCheckboxes/index.tsx +0 -849
- package/publish/lib/esm/MultipleSelect/index.scss +0 -398
- package/publish/lib/esm/MultipleSelect/index.tsx +0 -769
- package/publish/lib/esm/MultipleSelect/utils/func.ts +0 -63
- package/publish/lib/esm/NativeSelect/index.tsx +0 -396
- package/publish/lib/esm/NativeSelect/utils/func.ts +0 -51
- package/publish/lib/esm/NumberInput/index.tsx +0 -425
- package/publish/lib/esm/Pagination/index.tsx +0 -286
- package/publish/lib/esm/Pagination/pagination-navigators.tsx +0 -60
- package/publish/lib/esm/Radio/index.tsx +0 -694
- package/publish/lib/esm/RangeSlider/index.scss +0 -186
- package/publish/lib/esm/RangeSlider/index.tsx +0 -241
- package/publish/lib/esm/Refresher/index.tsx +0 -121
- package/publish/lib/esm/RootPortal/index.tsx +0 -59
- package/publish/lib/esm/ScrollReveal/index.tsx +0 -148
- package/publish/lib/esm/Scrollbar/index.scss +0 -221
- package/publish/lib/esm/Scrollbar/index.tsx +0 -561
- package/publish/lib/esm/SearchBar/index.tsx +0 -252
- package/publish/lib/esm/Select/index.scss +0 -639
- package/publish/lib/esm/Select/index.tsx +0 -3104
- package/publish/lib/esm/Select/utils/func.ts +0 -98
- package/publish/lib/esm/ShowMoreLess/index.scss +0 -27
- package/publish/lib/esm/ShowMoreLess/index.tsx +0 -145
- package/publish/lib/esm/SplitterPanel/index.scss +0 -82
- package/publish/lib/esm/SplitterPanel/index.tsx +0 -174
- package/publish/lib/esm/Stepper/index.scss +0 -315
- package/publish/lib/esm/Stepper/index.tsx +0 -325
- package/publish/lib/esm/Switch/index.tsx +0 -149
- package/publish/lib/esm/Table/Table.tsx +0 -351
- package/publish/lib/esm/Table/TableBody.tsx +0 -41
- package/publish/lib/esm/Table/TableCaption.tsx +0 -34
- package/publish/lib/esm/Table/TableCell.tsx +0 -126
- package/publish/lib/esm/Table/TableColgroup.tsx +0 -38
- package/publish/lib/esm/Table/TableContext.tsx +0 -26
- package/publish/lib/esm/Table/TableFoot.tsx +0 -28
- package/publish/lib/esm/Table/TableHead.tsx +0 -28
- package/publish/lib/esm/Table/TableRow.tsx +0 -76
- package/publish/lib/esm/Table/index.scss +0 -418
- package/publish/lib/esm/Table/index.tsx +0 -14
- package/publish/lib/esm/Table/utils/DragHandleSprite.tsx +0 -46
- package/publish/lib/esm/Table/utils/SortSprite.tsx +0 -63
- package/publish/lib/esm/Table/utils/TableFilter.tsx +0 -56
- package/publish/lib/esm/Table/utils/ToggleSelection.tsx +0 -255
- package/publish/lib/esm/Table/utils/func.ts +0 -182
- package/publish/lib/esm/Table/utils/hooks/useTableDraggable.tsx +0 -342
- package/publish/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +0 -255
- package/publish/lib/esm/Table/utils/hooks/useTableResponsive.tsx +0 -92
- package/publish/lib/esm/Table/utils/hooks/useTableSort.tsx +0 -187
- package/publish/lib/esm/Tabs/TabList.tsx +0 -50
- package/publish/lib/esm/Tabs/TabPanel.tsx +0 -44
- package/publish/lib/esm/Tabs/Tabs.tsx +0 -282
- package/publish/lib/esm/Tabs/index.tsx +0 -3
- package/publish/lib/esm/TagInput/index.scss +0 -126
- package/publish/lib/esm/TagInput/index.tsx +0 -379
- package/publish/lib/esm/Textarea/index.tsx +0 -621
- package/publish/lib/esm/Toast/Item.tsx +0 -165
- package/publish/lib/esm/Toast/Toast.tsx +0 -391
- package/publish/lib/esm/Toast/ToastContext.tsx +0 -104
- package/publish/lib/esm/Toast/__toast.vanilla.js +0 -422
- package/publish/lib/esm/Toast/index.scss +0 -197
- package/publish/lib/esm/Toast/index.tsx +0 -3
- package/publish/lib/esm/Toast/types.ts +0 -60
- package/publish/lib/esm/Toast/useToast.tsx +0 -72
- package/publish/lib/esm/Tooltip/index.scss +0 -272
- package/publish/lib/esm/Tooltip/index.tsx +0 -416
- package/publish/lib/esm/Tree/TreeList.tsx +0 -600
- package/publish/lib/esm/Tree/index.scss +0 -384
- package/publish/lib/esm/Tree/index.tsx +0 -661
- package/publish/lib/esm/Tree/init-height.tsx +0 -40
- package/publish/lib/esm/Tree/utils/func.ts +0 -15
- package/publish/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +0 -131
- package/publish/lib/esm/Utils/hooks/useBoundedDrag.tsx +0 -301
- package/publish/lib/esm/Utils/hooks/useClickOutside.tsx +0 -69
- package/publish/lib/esm/Utils/hooks/useComId.tsx +0 -13
- package/publish/lib/esm/Utils/hooks/useDebounce.tsx +0 -40
- package/publish/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -417
- package/publish/lib/esm/Utils/hooks/useDraggable.tsx +0 -265
- package/publish/lib/esm/Utils/hooks/useHistoryTracker.tsx +0 -554
- package/publish/lib/esm/Utils/hooks/useInterval.tsx +0 -74
- package/publish/lib/esm/Utils/hooks/useIsMobile.tsx +0 -139
- package/publish/lib/esm/Utils/hooks/useKeyPress.tsx +0 -104
- package/publish/lib/esm/Utils/hooks/useSessionStorageListener.tsx +0 -45
- package/publish/lib/esm/Utils/hooks/useStreamController.tsx +0 -277
- package/publish/lib/esm/Utils/hooks/useThrottle.tsx +0 -39
- package/publish/lib/esm/Utils/hooks/useWindowScroll.tsx +0 -83
- package/publish/lib/esm/Utils/libs/anim.ts +0 -96
- package/publish/lib/esm/Utils/libs/buffer.ts +0 -262
- package/publish/lib/esm/Utils/libs/cls.ts +0 -64
- package/publish/lib/esm/Utils/libs/convert.ts +0 -59
- package/publish/lib/esm/Utils/libs/date.ts +0 -598
- package/publish/lib/esm/Utils/libs/dom.ts +0 -150
- package/publish/lib/esm/Utils/libs/easing.ts +0 -201
- package/publish/lib/esm/Utils/libs/extract.ts +0 -160
- package/publish/lib/esm/Utils/libs/format-string.ts +0 -116
- package/publish/lib/esm/Utils/libs/formdata.ts +0 -93
- package/publish/lib/esm/Utils/libs/getElementProperty.ts +0 -150
- package/publish/lib/esm/Utils/libs/guid.ts +0 -16
- package/publish/lib/esm/Utils/libs/initDefaultOptions.ts +0 -43
- package/publish/lib/esm/Utils/libs/inputsCalculation.ts +0 -160
- package/publish/lib/esm/Utils/libs/math.ts +0 -276
- package/publish/lib/esm/Utils/libs/object.ts +0 -68
- package/publish/lib/esm/Utils/libs/os.ts +0 -63
- package/publish/lib/esm/Utils/libs/performance.ts +0 -47
- package/publish/lib/esm/Utils/libs/sanitize.ts +0 -55
- package/publish/lib/esm/Utils/libs/time.ts +0 -139
- package/publish/lib/esm/Utils/libs/tree.ts +0 -119
- package/publish/lib/esm/Utils/libs/validate.ts +0 -434
- package/publish/lib/esm/Utils/libs/viewport.ts +0 -20
- package/publish/lib/esm/Utils/plugins/bodyScrollLock.ts +0 -286
- package/publish/lib/esm/index.js +0 -47
- package/publish/package.json +0 -1
- /package/{publish/Accordion → Accordion}/index.d.ts +0 -0
- /package/{publish/Accordion → Accordion}/index.js +0 -0
- /package/{publish/BackToTop → BackToTop}/index.css +0 -0
- /package/{publish/BackToTop → BackToTop}/index.d.ts +0 -0
- /package/{publish/BackToTop → BackToTop}/index.js +0 -0
- /package/{publish/CascadingSelect → CascadingSelect}/index.css +0 -0
- /package/{publish/CascadingSelect → CascadingSelect}/index.d.ts +0 -0
- /package/{publish/CascadingSelect → CascadingSelect}/index.js +0 -0
- /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.css +0 -0
- /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.d.ts +0 -0
- /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.js +0 -0
- /package/{publish/Chatbox → Chatbox}/index.css +0 -0
- /package/{publish/Chatbox → Chatbox}/index.d.ts +0 -0
- /package/{publish/Chatbox → Chatbox}/index.js +0 -0
- /package/{publish/Checkbox → Checkbox}/index.d.ts +0 -0
- /package/{publish/Checkbox → Checkbox}/index.js +0 -0
- /package/{publish/ColorPicker → ColorPicker}/index.css +0 -0
- /package/{publish/ColorPicker → ColorPicker}/index.d.ts +0 -0
- /package/{publish/ColorPicker → ColorPicker}/index.js +0 -0
- /package/{publish/Date → Date}/index.css +0 -0
- /package/{publish/Date → Date}/index.d.ts +0 -0
- /package/{publish/Date → Date}/index.js +0 -0
- /package/{publish/DigitalClock → DigitalClock}/index.d.ts +0 -0
- /package/{publish/DigitalClock → DigitalClock}/index.js +0 -0
- /package/{publish/DragDropList → DragDropList}/index.css +0 -0
- /package/{publish/DragDropList → DragDropList}/index.d.ts +0 -0
- /package/{publish/DragDropList → DragDropList}/index.js +0 -0
- /package/{publish/DropdownMenu → DropdownMenu}/index.css +0 -0
- /package/{publish/DropdownMenu → DropdownMenu}/index.d.ts +0 -0
- /package/{publish/DropdownMenu → DropdownMenu}/index.js +0 -0
- /package/{publish/DynamicFields → DynamicFields}/index.d.ts +0 -0
- /package/{publish/DynamicFields → DynamicFields}/index.js +0 -0
- /package/{publish/EventCalendar → EventCalendar}/index.css +0 -0
- /package/{publish/EventCalendar → EventCalendar}/index.d.ts +0 -0
- /package/{publish/EventCalendar → EventCalendar}/index.js +0 -0
- /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.css +0 -0
- /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.d.ts +0 -0
- /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.js +0 -0
- /package/{publish/File → File}/index.d.ts +0 -0
- /package/{publish/File → File}/index.js +0 -0
- /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.css +0 -0
- /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.d.ts +0 -0
- /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.js +0 -0
- /package/{publish/Input → Input}/index.d.ts +0 -0
- /package/{publish/Input → Input}/index.js +0 -0
- /package/{publish/LiveSearch → LiveSearch}/index.css +0 -0
- /package/{publish/LiveSearch → LiveSearch}/index.d.ts +0 -0
- /package/{publish/LiveSearch → LiveSearch}/index.js +0 -0
- /package/{publish/MasonryLayout → MasonryLayout}/index.d.ts +0 -0
- /package/{publish/MasonryLayout → MasonryLayout}/index.js +0 -0
- /package/{publish/ModalDialog → ModalDialog}/index.d.ts +0 -0
- /package/{publish/ModalDialog → ModalDialog}/index.js +0 -0
- /package/{publish/ModeSwitch → ModeSwitch}/index.d.ts +0 -0
- /package/{publish/ModeSwitch → ModeSwitch}/index.js +0 -0
- /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.css +0 -0
- /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.d.ts +0 -0
- /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.js +0 -0
- /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.d.ts +0 -0
- /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.js +0 -0
- /package/{publish/MultipleSelect → MultipleSelect}/index.css +0 -0
- /package/{publish/MultipleSelect → MultipleSelect}/index.d.ts +0 -0
- /package/{publish/MultipleSelect → MultipleSelect}/index.js +0 -0
- /package/{publish/NativeSelect → NativeSelect}/index.d.ts +0 -0
- /package/{publish/NativeSelect → NativeSelect}/index.js +0 -0
- /package/{publish/NumberInput → NumberInput}/index.d.ts +0 -0
- /package/{publish/NumberInput → NumberInput}/index.js +0 -0
- /package/{publish/Pagination → Pagination}/index.d.ts +0 -0
- /package/{publish/Pagination → Pagination}/index.js +0 -0
- /package/{publish/Radio → Radio}/index.d.ts +0 -0
- /package/{publish/Radio → Radio}/index.js +0 -0
- /package/{publish/RangeSlider → RangeSlider}/index.css +0 -0
- /package/{publish/RangeSlider → RangeSlider}/index.d.ts +0 -0
- /package/{publish/RangeSlider → RangeSlider}/index.js +0 -0
- /package/{publish/Refresher → Refresher}/index.d.ts +0 -0
- /package/{publish/Refresher → Refresher}/index.js +0 -0
- /package/{publish/RootPortal → RootPortal}/index.d.ts +0 -0
- /package/{publish/RootPortal → RootPortal}/index.js +0 -0
- /package/{publish/ScrollReveal → ScrollReveal}/index.d.ts +0 -0
- /package/{publish/ScrollReveal → ScrollReveal}/index.js +0 -0
- /package/{publish/Scrollbar → Scrollbar}/index.css +0 -0
- /package/{publish/Scrollbar → Scrollbar}/index.d.ts +0 -0
- /package/{publish/Scrollbar → Scrollbar}/index.js +0 -0
- /package/{publish/SearchBar → SearchBar}/index.d.ts +0 -0
- /package/{publish/SearchBar → SearchBar}/index.js +0 -0
- /package/{publish/Select → Select}/index.css +0 -0
- /package/{publish/Select → Select}/index.d.ts +0 -0
- /package/{publish/Select → Select}/index.js +0 -0
- /package/{publish/ShowMoreLess → ShowMoreLess}/index.css +0 -0
- /package/{publish/ShowMoreLess → ShowMoreLess}/index.d.ts +0 -0
- /package/{publish/ShowMoreLess → ShowMoreLess}/index.js +0 -0
- /package/{publish/SplitterPanel → SplitterPanel}/index.css +0 -0
- /package/{publish/SplitterPanel → SplitterPanel}/index.d.ts +0 -0
- /package/{publish/SplitterPanel → SplitterPanel}/index.js +0 -0
- /package/{publish/Stepper → Stepper}/index.css +0 -0
- /package/{publish/Stepper → Stepper}/index.d.ts +0 -0
- /package/{publish/Stepper → Stepper}/index.js +0 -0
- /package/{publish/Switch → Switch}/index.d.ts +0 -0
- /package/{publish/Switch → Switch}/index.js +0 -0
- /package/{publish/Table → Table}/index.css +0 -0
- /package/{publish/Table → Table}/index.d.ts +0 -0
- /package/{publish/Table → Table}/index.js +0 -0
- /package/{publish/Tabs → Tabs}/index.d.ts +0 -0
- /package/{publish/Tabs → Tabs}/index.js +0 -0
- /package/{publish/TagInput → TagInput}/index.css +0 -0
- /package/{publish/TagInput → TagInput}/index.d.ts +0 -0
- /package/{publish/TagInput → TagInput}/index.js +0 -0
- /package/{publish/Textarea → Textarea}/index.d.ts +0 -0
- /package/{publish/Textarea → Textarea}/index.js +0 -0
- /package/{publish/Toast → Toast}/index.css +0 -0
- /package/{publish/Toast → Toast}/index.d.ts +0 -0
- /package/{publish/Toast → Toast}/index.js +0 -0
- /package/{publish/Tooltip → Tooltip}/index.css +0 -0
- /package/{publish/Tooltip → Tooltip}/index.d.ts +0 -0
- /package/{publish/Tooltip → Tooltip}/index.js +0 -0
- /package/{publish/Tree → Tree}/index.css +0 -0
- /package/{publish/Tree → Tree}/index.d.ts +0 -0
- /package/{publish/Tree → Tree}/index.js +0 -0
- /package/{publish/Utils → Utils}/anim.d.ts +0 -0
- /package/{publish/Utils → Utils}/anim.js +0 -0
- /package/{publish/Utils → Utils}/bodyScrollLock.d.ts +0 -0
- /package/{publish/Utils → Utils}/bodyScrollLock.js +0 -0
- /package/{publish/Utils → Utils}/buffer.d.ts +0 -0
- /package/{publish/Utils → Utils}/buffer.js +0 -0
- /package/{publish/Utils → Utils}/cls.d.ts +0 -0
- /package/{publish/Utils → Utils}/cls.js +0 -0
- /package/{publish/Utils → Utils}/convert.d.ts +0 -0
- /package/{publish/Utils → Utils}/convert.js +0 -0
- /package/{publish/Utils → Utils}/date.d.ts +0 -0
- /package/{publish/Utils → Utils}/date.js +0 -0
- /package/{publish/Utils → Utils}/dom.d.ts +0 -0
- /package/{publish/Utils → Utils}/dom.js +0 -0
- /package/{publish/Utils → Utils}/easing.d.ts +0 -0
- /package/{publish/Utils → Utils}/easing.js +0 -0
- /package/{publish/Utils → Utils}/extract.d.ts +0 -0
- /package/{publish/Utils → Utils}/extract.js +0 -0
- /package/{publish/Utils → Utils}/format-string.d.ts +0 -0
- /package/{publish/Utils → Utils}/format-string.js +0 -0
- /package/{publish/Utils → Utils}/formdata.d.ts +0 -0
- /package/{publish/Utils → Utils}/formdata.js +0 -0
- /package/{publish/Utils → Utils}/getElementProperty.d.ts +0 -0
- /package/{publish/Utils → Utils}/getElementProperty.js +0 -0
- /package/{publish/Utils → Utils}/guid.d.ts +0 -0
- /package/{publish/Utils → Utils}/guid.js +0 -0
- /package/{publish/Utils → Utils}/initDefaultOptions.d.ts +0 -0
- /package/{publish/Utils → Utils}/initDefaultOptions.js +0 -0
- /package/{publish/Utils → Utils}/inputsCalculation.d.ts +0 -0
- /package/{publish/Utils → Utils}/inputsCalculation.js +0 -0
- /package/{publish/Utils → Utils}/math.d.ts +0 -0
- /package/{publish/Utils → Utils}/math.js +0 -0
- /package/{publish/Utils → Utils}/object.d.ts +0 -0
- /package/{publish/Utils → Utils}/object.js +0 -0
- /package/{publish/Utils → Utils}/os.d.ts +0 -0
- /package/{publish/Utils → Utils}/os.js +0 -0
- /package/{publish/Utils → Utils}/performance.d.ts +0 -0
- /package/{publish/Utils → Utils}/performance.js +0 -0
- /package/{publish/Utils → Utils}/sanitize.d.ts +0 -0
- /package/{publish/Utils → Utils}/sanitize.js +0 -0
- /package/{publish/Utils → Utils}/time.d.ts +0 -0
- /package/{publish/Utils → Utils}/time.js +0 -0
- /package/{publish/Utils → Utils}/tree.d.ts +0 -0
- /package/{publish/Utils → Utils}/tree.js +0 -0
- /package/{publish/Utils → Utils}/useAutosizeTextArea.d.ts +0 -0
- /package/{publish/Utils → Utils}/useAutosizeTextArea.js +0 -0
- /package/{publish/Utils → Utils}/useBoundedDrag.d.ts +0 -0
- /package/{publish/Utils → Utils}/useBoundedDrag.js +0 -0
- /package/{publish/Utils → Utils}/useClickOutside.d.ts +0 -0
- /package/{publish/Utils → Utils}/useClickOutside.js +0 -0
- /package/{publish/Utils → Utils}/useComId.d.ts +0 -0
- /package/{publish/Utils → Utils}/useComId.js +0 -0
- /package/{publish/Utils → Utils}/useDebounce.d.ts +0 -0
- /package/{publish/Utils → Utils}/useDebounce.js +0 -0
- /package/{publish/Utils → Utils}/useDragDropPosition.d.ts +0 -0
- /package/{publish/Utils → Utils}/useDragDropPosition.js +0 -0
- /package/{publish/Utils → Utils}/useDraggable.d.ts +0 -0
- /package/{publish/Utils → Utils}/useDraggable.js +0 -0
- /package/{publish/Utils → Utils}/useHistoryTracker.d.ts +0 -0
- /package/{publish/Utils → Utils}/useHistoryTracker.js +0 -0
- /package/{publish/Utils → Utils}/useInterval.d.ts +0 -0
- /package/{publish/Utils → Utils}/useInterval.js +0 -0
- /package/{publish/Utils → Utils}/useIsMobile.d.ts +0 -0
- /package/{publish/Utils → Utils}/useIsMobile.js +0 -0
- /package/{publish/Utils → Utils}/useKeyPress.d.ts +0 -0
- /package/{publish/Utils → Utils}/useKeyPress.js +0 -0
- /package/{publish/Utils → Utils}/useSessionStorageListener.d.ts +0 -0
- /package/{publish/Utils → Utils}/useSessionStorageListener.js +0 -0
- /package/{publish/Utils → Utils}/useStreamController.d.ts +0 -0
- /package/{publish/Utils → Utils}/useStreamController.js +0 -0
- /package/{publish/Utils → Utils}/useThrottle.d.ts +0 -0
- /package/{publish/Utils → Utils}/useThrottle.js +0 -0
- /package/{publish/Utils → Utils}/useWindowScroll.d.ts +0 -0
- /package/{publish/Utils → Utils}/useWindowScroll.js +0 -0
- /package/{publish/Utils → Utils}/validate.d.ts +0 -0
- /package/{publish/Utils → Utils}/validate.js +0 -0
- /package/{publish/Utils → Utils}/viewport.d.ts +0 -0
- /package/{publish/Utils → Utils}/viewport.js +0 -0
- /package/{publish/all.d.ts → all.d.ts} +0 -0
- /package/{publish/all.js → all.js} +0 -0
|
@@ -1,2686 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo, useRef, useCallback, useImperativeHandle } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import RootPortal from 'funda-root-portal';
|
|
5
|
-
import ModalDialog from 'funda-modaldialog';
|
|
6
|
-
|
|
7
|
-
import useComId from 'funda-utils/dist/cjs/useComId';
|
|
8
|
-
import useClickOutside from 'funda-utils/dist/cjs/useClickOutside';
|
|
9
|
-
import {
|
|
10
|
-
getAbsolutePositionOfStage
|
|
11
|
-
} from 'funda-utils/dist/cjs/getElementProperty';
|
|
12
|
-
import { getTodayDate, getCalendarDate, isValidDate, padZero, getDateDetails, getMonthDates, getWeekDatesFromMon } from 'funda-utils/dist/cjs/date';
|
|
13
|
-
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
14
|
-
import getOs from 'funda-utils//dist/cjs/os';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export interface EventsValueConfig {
|
|
19
|
-
id: string | number;
|
|
20
|
-
date: string,
|
|
21
|
-
time: string,
|
|
22
|
-
data: string,
|
|
23
|
-
dataTooltip?: string,
|
|
24
|
-
eventStyles?: React.CSSProperties;
|
|
25
|
-
callback?: () => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface TimelineRowSectionConfig {
|
|
29
|
-
id: string | number;
|
|
30
|
-
title: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface TimelineCellListConfig {
|
|
34
|
-
date: string;
|
|
35
|
-
list: EventsValueConfig[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface TimelineRowListConfig {
|
|
39
|
-
listSection: TimelineRowSectionConfig;
|
|
40
|
-
eventSources: TimelineCellListConfig[];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type EventCalendarTimelineProps = {
|
|
44
|
-
contentRef?: React.ForwardedRef<any>;
|
|
45
|
-
calendarWrapperClassName?: string;
|
|
46
|
-
tableWrapperClassName?: string;
|
|
47
|
-
tableClassName?: string;
|
|
48
|
-
tableHeadClassName?: string;
|
|
49
|
-
tableBodyClassName?: string;
|
|
50
|
-
tableListStartClassName?: string;
|
|
51
|
-
tableListEndClassName?: string;
|
|
52
|
-
tableListDividerClassName?: string;
|
|
53
|
-
customTodayDate?: string;
|
|
54
|
-
multipleCells?: boolean;
|
|
55
|
-
appearance?: 'week' | 'month';
|
|
56
|
-
appearanceToggle?: boolean;
|
|
57
|
-
appearanceWeekTmpl?: (startDate: string, endDate: string) => void;
|
|
58
|
-
eventsValue?: TimelineRowListConfig[];
|
|
59
|
-
langWeek?: string[];
|
|
60
|
-
langWeekFull?: string[];
|
|
61
|
-
langMonths?: string[];
|
|
62
|
-
langMonthsFull?: string[];
|
|
63
|
-
langToday?: string;
|
|
64
|
-
langAppearanceLabelMonth?: string;
|
|
65
|
-
langAppearanceLabelWeek?: string
|
|
66
|
-
iconRemove?: React.ReactNode | string;
|
|
67
|
-
iconAdd?: React.ReactNode | string;
|
|
68
|
-
cellCloseBtnClassName?: string;
|
|
69
|
-
cellCloseBtnLabel?: string | React.ReactNode;
|
|
70
|
-
cellAddBtnClassName?: string;
|
|
71
|
-
cellAddBtnLabel?: string | React.ReactNode;
|
|
72
|
-
forwardAndBackFillDisabled?: boolean;
|
|
73
|
-
draggable?: boolean;
|
|
74
|
-
showWeek?: boolean;
|
|
75
|
-
autoScroll?: boolean;
|
|
76
|
-
onChangeDate?: (e: any, currentData: any) => void;
|
|
77
|
-
onChangeMonth?: (currentData: any) => void;
|
|
78
|
-
onChangeYear?: (currentData: any) => void;
|
|
79
|
-
onChangeToday?: (currentData: any) => void;
|
|
80
|
-
onChangeWeek?: (startDate: string, endDate: string) => void;
|
|
81
|
-
onListRenderComplete?: () => void;
|
|
82
|
-
onChangeAppearanceMode?: (mode: string) => void;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// modal dialog
|
|
87
|
-
modalMaskOpacity?: string;
|
|
88
|
-
modalMaxWidth?: number | string;
|
|
89
|
-
modalMinHeight?: number | string;
|
|
90
|
-
modalHeading?: React.ReactNode;
|
|
91
|
-
modalContent?: React.ReactNode;
|
|
92
|
-
modalDeleteContent?: React.ReactNode;
|
|
93
|
-
modalCloseBtnClassName?: string;
|
|
94
|
-
modalCloseBtnLabel?: string | React.ReactNode;
|
|
95
|
-
modalSubmitBtnClassName?: string;
|
|
96
|
-
modalSubmitBtnLabel?: string | React.ReactNode;
|
|
97
|
-
modalSubmitDeleteBtnClassName?: string;
|
|
98
|
-
modalSubmitDeleteBtnLabel?: string | React.ReactNode;
|
|
99
|
-
onModalEditOpen?: (currentData: any, openwin: any, type: 'normal' | 'new') => void;
|
|
100
|
-
onModalEditClose?: (currentData: any) => void;
|
|
101
|
-
onModalDeleteOpen?: (currentData: any, openwin: any) => void;
|
|
102
|
-
onModalDeleteClose?: (currentData: any) => void;
|
|
103
|
-
onModalEditEvent?: (currentData: any, closewin: any, gridInit: Function) => void;
|
|
104
|
-
onModalDeleteEvent?: (currentData: any, closewin: any, gridInit: Function) => void;
|
|
105
|
-
|
|
106
|
-
//
|
|
107
|
-
onCellMouseEnter?: (el: any) => void;
|
|
108
|
-
onCellMouseLeave?: (el: any) => void;
|
|
109
|
-
onCellMouseUp?: (el: any, selectedCellsData: any[]) => void;
|
|
110
|
-
onCellClick?: (el: any, cellData: any) => void;
|
|
111
|
-
onCellDoubleClick?: (el: any, cellData: any) => void;
|
|
112
|
-
onKeyPressed?: (el: any, selectedCellsData: any[]) => void;
|
|
113
|
-
onKeyCopy?: (el: any, selectedCellsData: any[]) => void;
|
|
114
|
-
onKeyPaste?: (el: any, selectedCellsData: any[]) => void;
|
|
115
|
-
|
|
116
|
-
// table
|
|
117
|
-
tableListSectionTitle?: string | React.ReactNode;
|
|
118
|
-
tableCellMinWidth?: number;
|
|
119
|
-
|
|
120
|
-
// tooltip
|
|
121
|
-
tableTooltipDirection?: string;
|
|
122
|
-
tableTooltipOffset?: number;
|
|
123
|
-
tableTooltipExceededSidePosOffset?: number;
|
|
124
|
-
tableTooltipSize?: string;
|
|
125
|
-
tableTooltipDisabled?: boolean;
|
|
126
|
-
|
|
127
|
-
/** -- */
|
|
128
|
-
id?: string;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
|
|
133
|
-
const {
|
|
134
|
-
contentRef,
|
|
135
|
-
calendarWrapperClassName,
|
|
136
|
-
tableWrapperClassName,
|
|
137
|
-
tableClassName,
|
|
138
|
-
tableHeadClassName,
|
|
139
|
-
tableBodyClassName,
|
|
140
|
-
tableListStartClassName,
|
|
141
|
-
tableListEndClassName,
|
|
142
|
-
tableListDividerClassName,
|
|
143
|
-
multipleCells = false,
|
|
144
|
-
customTodayDate,
|
|
145
|
-
appearance = 'month',
|
|
146
|
-
appearanceToggle = true,
|
|
147
|
-
appearanceWeekTmpl,
|
|
148
|
-
eventsValue,
|
|
149
|
-
langWeek,
|
|
150
|
-
langWeekFull,
|
|
151
|
-
langMonths,
|
|
152
|
-
langMonthsFull,
|
|
153
|
-
langToday,
|
|
154
|
-
langAppearanceLabelMonth,
|
|
155
|
-
langAppearanceLabelWeek,
|
|
156
|
-
iconRemove,
|
|
157
|
-
iconAdd,
|
|
158
|
-
cellCloseBtnClassName,
|
|
159
|
-
cellCloseBtnLabel,
|
|
160
|
-
cellAddBtnClassName,
|
|
161
|
-
cellAddBtnLabel,
|
|
162
|
-
forwardAndBackFillDisabled,
|
|
163
|
-
draggable,
|
|
164
|
-
showWeek,
|
|
165
|
-
autoScroll,
|
|
166
|
-
onChangeDate,
|
|
167
|
-
onChangeMonth,
|
|
168
|
-
onChangeYear,
|
|
169
|
-
onChangeToday,
|
|
170
|
-
onChangeWeek,
|
|
171
|
-
onListRenderComplete,
|
|
172
|
-
onChangeAppearanceMode,
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
modalMaskOpacity,
|
|
176
|
-
modalMaxWidth,
|
|
177
|
-
modalMinHeight,
|
|
178
|
-
modalHeading,
|
|
179
|
-
modalContent,
|
|
180
|
-
modalDeleteContent,
|
|
181
|
-
modalCloseBtnClassName,
|
|
182
|
-
modalCloseBtnLabel,
|
|
183
|
-
modalSubmitBtnClassName,
|
|
184
|
-
modalSubmitBtnLabel,
|
|
185
|
-
modalSubmitDeleteBtnClassName,
|
|
186
|
-
modalSubmitDeleteBtnLabel,
|
|
187
|
-
onModalEditOpen,
|
|
188
|
-
onModalEditClose,
|
|
189
|
-
onModalDeleteOpen,
|
|
190
|
-
onModalDeleteClose,
|
|
191
|
-
onModalEditEvent,
|
|
192
|
-
onModalDeleteEvent,
|
|
193
|
-
|
|
194
|
-
//
|
|
195
|
-
onCellMouseEnter,
|
|
196
|
-
onCellMouseLeave,
|
|
197
|
-
onCellMouseUp,
|
|
198
|
-
onCellClick,
|
|
199
|
-
onCellDoubleClick,
|
|
200
|
-
onKeyPressed,
|
|
201
|
-
onKeyCopy,
|
|
202
|
-
onKeyPaste,
|
|
203
|
-
|
|
204
|
-
//
|
|
205
|
-
tableListSectionTitle,
|
|
206
|
-
tableCellMinWidth,
|
|
207
|
-
|
|
208
|
-
//
|
|
209
|
-
tableTooltipDirection,
|
|
210
|
-
tableTooltipOffset,
|
|
211
|
-
tableTooltipExceededSidePosOffset,
|
|
212
|
-
tableTooltipSize,
|
|
213
|
-
tableTooltipDisabled,
|
|
214
|
-
|
|
215
|
-
//
|
|
216
|
-
id
|
|
217
|
-
} = props;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
//================================================================
|
|
221
|
-
// General
|
|
222
|
-
//================================================================
|
|
223
|
-
const uniqueID = useComId();
|
|
224
|
-
const idRes = id || uniqueID;
|
|
225
|
-
const DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
226
|
-
const DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
227
|
-
const WEEK = langWeek || ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'];
|
|
228
|
-
const WEEK_FULL = langWeekFull || ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY'];
|
|
229
|
-
const MONTHS = langMonths || ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
|
|
230
|
-
const MONTHS_FULL = langMonthsFull || ['January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
231
|
-
const formatToEnglishMonthDay = (inputDate: string) => {
|
|
232
|
-
const date = new Date(inputDate);
|
|
233
|
-
const month = MONTHS[date.getMonth()];
|
|
234
|
-
const day = date.getDate();
|
|
235
|
-
return month + ' ' + day;
|
|
236
|
-
};
|
|
237
|
-
const START_WEEK_ON = 1; // represents "Monday/1" in JavaScript
|
|
238
|
-
|
|
239
|
-
// orginal data
|
|
240
|
-
const [orginalData, setOrginalData] = useState<TimelineRowListConfig[]>([]);
|
|
241
|
-
|
|
242
|
-
//
|
|
243
|
-
const FILL_BLANK_DATE_DISABLD = typeof forwardAndBackFillDisabled === 'undefined' ? true : forwardAndBackFillDisabled;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//
|
|
247
|
-
const now = useMemo(() => new Date(), []);
|
|
248
|
-
const [date, setDate] = useState<Date>(now);
|
|
249
|
-
const [day, setDay] = useState<number>(date.getDate());
|
|
250
|
-
const [month, setMonth] = useState<number>(date.getMonth());
|
|
251
|
-
const [year, setYear] = useState<number>(date.getFullYear());
|
|
252
|
-
const [startDay, setStartDay] = useState<number>(getStartDayOfMonth(date));
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
// selection tab
|
|
256
|
-
// gets the today date time object
|
|
257
|
-
const [selectedMonth, setSelectedMonth] = useState<number>(now.getMonth());
|
|
258
|
-
const [selectedYear, setSelectedYear] = useState<number>(now.getFullYear());
|
|
259
|
-
const [yearsArray, setYearsCollection] = useState<number[]>([]);
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
const [winYear, setWinYear] = useState<boolean>(false);
|
|
263
|
-
const [winMonth, setWinMonth] = useState<boolean>(false);
|
|
264
|
-
|
|
265
|
-
// modal dialog
|
|
266
|
-
const modalEditHandleRef = useRef<any>();
|
|
267
|
-
const modalDeleteHandleRef = useRef<any>();
|
|
268
|
-
const EVENTS_ENABLED = typeof modalContent !== 'undefined';
|
|
269
|
-
const EVENTS_DELETE_ENABLED = typeof modalDeleteContent !== 'undefined';
|
|
270
|
-
const [showEdit, setShowEdit] = useState<boolean>(false);
|
|
271
|
-
const [showDelete, setShowDelete] = useState<boolean>(false);
|
|
272
|
-
|
|
273
|
-
// table grid
|
|
274
|
-
const AUTO_SCROLL = autoScroll || false;
|
|
275
|
-
const SHOW_WEEK = showWeek || false;
|
|
276
|
-
const BODY_DRAG = draggable || false;
|
|
277
|
-
const CELL_MIN_W = typeof tableCellMinWidth === 'undefined' ? (SHOW_WEEK ? 100 : 50) : tableCellMinWidth;
|
|
278
|
-
const tableGridRef = useRef<any>(null);
|
|
279
|
-
const tableGridHeaderRef = useRef<any>(null);
|
|
280
|
-
const scrollHeaderRef = useRef(null);
|
|
281
|
-
const scrollBodyRef = useRef(null);
|
|
282
|
-
const scrollListRef = useRef(null);
|
|
283
|
-
|
|
284
|
-
// Temporary date
|
|
285
|
-
const [tempDate, setTempDate] = useState<string>('');
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
// Open temporary storage for pop-ups
|
|
290
|
-
const [tableRowNum, setTableRowNum] = useState<number>(-1);
|
|
291
|
-
const [tableCellId, setTableCellId] = useState<number>(-1);
|
|
292
|
-
|
|
293
|
-
// table grid tooltip
|
|
294
|
-
const CELL_TOOLTIP_EXCEEDED_SIDE_POS_OFFSET = Number(tableTooltipExceededSidePosOffset) || 15;
|
|
295
|
-
const CELL_TOOLTIP_POS_OFFSET = typeof tableTooltipOffset === 'undefined' ? 10 : tableTooltipOffset;
|
|
296
|
-
const tableTooltipModalRef = useRef<any>(null);
|
|
297
|
-
const [isShowTableTooltip, setIsShowTableTooltip] = useState<boolean>(false);
|
|
298
|
-
const [tableTooltipContent, setTableTooltipContent] = useState<any>(null);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
// appearance mode
|
|
302
|
-
const [appearanceMode, setAppearanceMode] = useState<string>(appearance);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const findMondayAndTruncate = (dates: string[]) => {
|
|
306
|
-
const _res = dates.map((s: string) => new Date(s));
|
|
307
|
-
// Find the first Monday in the sequence
|
|
308
|
-
for (let i = 0; i < _res.length; i++) {
|
|
309
|
-
const date = _res[i];
|
|
310
|
-
if (date.getDay() === START_WEEK_ON) {
|
|
311
|
-
// Return dates starting from Monday onwards
|
|
312
|
-
return dates.slice(i);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return []; // Return empty array if no Monday found
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
// exposes the following methods
|
|
322
|
-
useImperativeHandle(
|
|
323
|
-
contentRef,
|
|
324
|
-
() => ({
|
|
325
|
-
today: () => {
|
|
326
|
-
handleTodayChange();
|
|
327
|
-
},
|
|
328
|
-
next: () => {
|
|
329
|
-
handleNextChange();
|
|
330
|
-
},
|
|
331
|
-
prev: () => {
|
|
332
|
-
handlePrevChange();
|
|
333
|
-
},
|
|
334
|
-
bodyScrollbarInit: () => {
|
|
335
|
-
bodyScrollbarInit();
|
|
336
|
-
},
|
|
337
|
-
gridInit: () => {
|
|
338
|
-
tableGridInit();
|
|
339
|
-
},
|
|
340
|
-
gridInitHeadertitle: () => {
|
|
341
|
-
tableGridInitHeadertitle();
|
|
342
|
-
},
|
|
343
|
-
gridReset: (cb?: any) => {
|
|
344
|
-
tableGridReset();
|
|
345
|
-
},
|
|
346
|
-
resetSelectedCells: () => {
|
|
347
|
-
// reset selection area
|
|
348
|
-
setSelectedCells([]);
|
|
349
|
-
setCopiedCells(null);
|
|
350
|
-
},
|
|
351
|
-
closeModal: () => {
|
|
352
|
-
if (modalEditHandleRef.current) modalEditHandleRef.current.close();
|
|
353
|
-
if (modalDeleteHandleRef.current) modalDeleteHandleRef.current.close();
|
|
354
|
-
}
|
|
355
|
-
}),
|
|
356
|
-
[contentRef],
|
|
357
|
-
);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
//================================================================
|
|
362
|
-
// Monthly calendar
|
|
363
|
-
//================================================================
|
|
364
|
-
//
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
//================================================================
|
|
368
|
-
// Weekly calendar
|
|
369
|
-
//================================================================
|
|
370
|
-
const [weekOffset, setWeekOffset] = useState<number>(0);
|
|
371
|
-
const handleNextWeek = () => {
|
|
372
|
-
setWeekOffset(weekOffset + 1);
|
|
373
|
-
return weekOffset + 1;
|
|
374
|
-
};
|
|
375
|
-
const handlePreviousWeek = () => {
|
|
376
|
-
setWeekOffset(weekOffset - 1)
|
|
377
|
-
return weekOffset - 1;
|
|
378
|
-
};
|
|
379
|
-
const weekDates = getWeekDatesFromMon(weekOffset);
|
|
380
|
-
const [displayWeekForHeader, setDisplayWeekForHeader] = useState<string[]>([]);
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
//================================================================
|
|
387
|
-
// Drag to activate the selection area
|
|
388
|
-
//================================================================
|
|
389
|
-
const [isSelecting, setIsSelecting] = useState<boolean>(false);
|
|
390
|
-
const [selectedCells, setSelectedCells] = useState<any[]>([]);
|
|
391
|
-
const [startCell, setStartCell] = useState<any>(null);
|
|
392
|
-
|
|
393
|
-
// Determine whether it is a selected cell
|
|
394
|
-
const isCellSelected = (row: number, col: number) => {
|
|
395
|
-
return selectedCells.map((item: any) => [item.row, item.col]).some(([r, c]) => r === row && c === col);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// Start selecting
|
|
400
|
-
const handleTableMainCellMouseDown = (e: React.MouseEvent, row: number, col: number, colsOffset: number) => {
|
|
401
|
-
const isMultiSelect = e.ctrlKey || e.metaKey; // Check whether the Ctrl or Command key is pressed
|
|
402
|
-
|
|
403
|
-
setIsSelecting(true);
|
|
404
|
-
setStartCell({ row, col });
|
|
405
|
-
|
|
406
|
-
const _el: any = e.currentTarget;
|
|
407
|
-
|
|
408
|
-
setIsSelecting(true);
|
|
409
|
-
setStartCell({ row, col });
|
|
410
|
-
|
|
411
|
-
setSelectedCells((prevSelectedCells: any[]) => {
|
|
412
|
-
if (isMultiSelect) {
|
|
413
|
-
// Multi-select mode: Add or remove cells
|
|
414
|
-
//++++++++++
|
|
415
|
-
const cellExists = prevSelectedCells.some(({ row: r, col: c }) => r === row && c === col);
|
|
416
|
-
if (cellExists) {
|
|
417
|
-
return prevSelectedCells.filter(({ row: r, col: c }) => !(r === row && c === col));
|
|
418
|
-
} else {
|
|
419
|
-
return [...prevSelectedCells, {
|
|
420
|
-
rowData: JSON.parse(_el.dataset.rowinfo),
|
|
421
|
-
date: _el.dataset.date,
|
|
422
|
-
row: row,
|
|
423
|
-
col: col
|
|
424
|
-
}];
|
|
425
|
-
}
|
|
426
|
-
} else {
|
|
427
|
-
// Radio Mode: Clear the previous selection, select only the current cell
|
|
428
|
-
//++++++++++
|
|
429
|
-
return [{
|
|
430
|
-
rowData: JSON.parse(_el.dataset.rowinfo),
|
|
431
|
-
date: _el.dataset.date,
|
|
432
|
-
row: row,
|
|
433
|
-
col: col
|
|
434
|
-
}];
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
// Selecting now
|
|
441
|
-
const handleTableMainCellMouseEnter = (e: React.MouseEvent, row: number, col: number, colsOffset: number) => {
|
|
442
|
-
|
|
443
|
-
if (isSelecting && startCell) {
|
|
444
|
-
|
|
445
|
-
//########## MODE: WEEK #############
|
|
446
|
-
let curDateList: any[] = [];
|
|
447
|
-
if (appearanceMode === 'week') {
|
|
448
|
-
curDateList = weekDates.map((v: Date) => getCalendarDate(v));
|
|
449
|
-
}
|
|
450
|
-
//########## /MODE: WEEK #############
|
|
451
|
-
|
|
452
|
-
//########## MODE: MONTH #############
|
|
453
|
-
if (appearanceMode === 'month') {
|
|
454
|
-
curDateList = getMonthDates(year, month + 1);
|
|
455
|
-
}
|
|
456
|
-
//########## /MODE: MONTH #############
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
const newSelectedCells: any[] = [];
|
|
460
|
-
const [minRow, maxRow] = [startCell.row, row].sort((a, b) => a - b);
|
|
461
|
-
const [minCol, maxCol] = [startCell.col, col].sort((a, b) => a - b);
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
for (let r = minRow; r <= maxRow; r++) {
|
|
465
|
-
for (let c = minCol; c <= maxCol; c++) {
|
|
466
|
-
|
|
467
|
-
// query date and row data
|
|
468
|
-
const curRowData: any = orginalData[r];
|
|
469
|
-
newSelectedCells.push({
|
|
470
|
-
rowData: curRowData?.listSection,
|
|
471
|
-
date: curDateList[c - colsOffset],
|
|
472
|
-
row: r,
|
|
473
|
-
col: c
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
setSelectedCells(newSelectedCells);
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// Stop selecting
|
|
482
|
-
const handleTableMainMouseUp = (e: React.MouseEvent) => {
|
|
483
|
-
setIsSelecting(false);
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
//================================================================
|
|
487
|
-
// Copy & Paste
|
|
488
|
-
//================================================================
|
|
489
|
-
const [copiedCells, setCopiedCells] = useState<{
|
|
490
|
-
structure: {
|
|
491
|
-
rows: number,
|
|
492
|
-
cols: number
|
|
493
|
-
},
|
|
494
|
-
offset: { row: number, col: number },
|
|
495
|
-
cells: any[]
|
|
496
|
-
} | null>(null);
|
|
497
|
-
|
|
498
|
-
const handleWrapperKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
499
|
-
const isMac = getOs().isOSX;
|
|
500
|
-
|
|
501
|
-
//########## MODE: WEEK #############
|
|
502
|
-
let curDateList: any[] = [];
|
|
503
|
-
if (appearanceMode === 'week') {
|
|
504
|
-
curDateList = weekDates.map((v: Date) => getCalendarDate(v));
|
|
505
|
-
}
|
|
506
|
-
//########## /MODE: WEEK #############
|
|
507
|
-
|
|
508
|
-
//########## MODE: MONTH #############
|
|
509
|
-
if (appearanceMode === 'month') {
|
|
510
|
-
curDateList = getMonthDates(year, month + 1);
|
|
511
|
-
}
|
|
512
|
-
//########## /MODE: MONTH #############
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
// Listen for copy
|
|
516
|
-
if ((isMac && e.metaKey && e.key === 'c') || (!isMac && e.ctrlKey && e.key === 'c')) {
|
|
517
|
-
|
|
518
|
-
if (selectedCells.length > 0) {
|
|
519
|
-
// Gets the structure of the selected area
|
|
520
|
-
const _selectedCellsCoordinates = selectedCells.map(({ row: r, col: c }) => {
|
|
521
|
-
return [r, c];
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
const [minRow, maxRow] = _selectedCellsCoordinates.reduce(
|
|
525
|
-
([min, max], [r]) => [Math.min(min, r), Math.max(max, r)],
|
|
526
|
-
[Infinity, -Infinity]
|
|
527
|
-
);
|
|
528
|
-
const [minCol, maxCol] = _selectedCellsCoordinates.reduce(
|
|
529
|
-
([min, max], [_, c]) => [Math.min(min, c), Math.max(max, c)],
|
|
530
|
-
[Infinity, -Infinity]
|
|
531
|
-
);
|
|
532
|
-
|
|
533
|
-
/*
|
|
534
|
-
[Be equal to:]
|
|
535
|
-
|
|
536
|
-
// Suppose _selectedCellsCoordinates is an array of selected cells, each of which is in the form of [row, col].
|
|
537
|
-
let minRow = Infinity;
|
|
538
|
-
let maxRow = -Infinity;
|
|
539
|
-
let minCol = Infinity;
|
|
540
|
-
let maxCol = -Infinity;
|
|
541
|
-
|
|
542
|
-
for (const [row, col] of _selectedCellsCoordinates) {
|
|
543
|
-
if (row < minRow) minRow = row;
|
|
544
|
-
if (row > maxRow) maxRow = row;
|
|
545
|
-
if (col < minCol) minCol = col;
|
|
546
|
-
if (col > maxCol) maxCol = col;
|
|
547
|
-
}
|
|
548
|
-
*/
|
|
549
|
-
|
|
550
|
-
// Calculate the offset and adjust the cell coordinates
|
|
551
|
-
const adjustedCells = _selectedCellsCoordinates.map(([r, c]) => [r - minRow, c - minCol]);
|
|
552
|
-
|
|
553
|
-
// The copy result is independent of the data
|
|
554
|
-
setCopiedCells({
|
|
555
|
-
structure: {
|
|
556
|
-
rows: maxRow - minRow + 1,
|
|
557
|
-
cols: maxCol - minCol + 1
|
|
558
|
-
},
|
|
559
|
-
offset: { row: minRow, col: minCol },
|
|
560
|
-
cells: adjustedCells
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
//
|
|
565
|
-
onKeyCopy?.(e, selectedCells);
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// Listen for paste
|
|
572
|
-
if ((isMac && e.metaKey && e.key === 'v') || (!isMac && e.ctrlKey && e.key === 'v')) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (copiedCells && selectedCells.length > 0) {
|
|
576
|
-
const { rowsTotal, colsTotal, forwardFillTotal } = getCells();
|
|
577
|
-
const { row: targetRow, col: targetCol } = selectedCells[0]; // the first position
|
|
578
|
-
const newSelectedCellsCoordinates = copiedCells.cells.map(([r, c]) => [
|
|
579
|
-
targetRow + r,
|
|
580
|
-
targetCol + c
|
|
581
|
-
]).filter(([r, c]) => r < rowsTotal && c < colsTotal); // Make sure you don't go beyond the scope of the table
|
|
582
|
-
|
|
583
|
-
// query date and row data
|
|
584
|
-
const newSelectedCells: any[] = [];
|
|
585
|
-
newSelectedCellsCoordinates.forEach((item: any[]) => {
|
|
586
|
-
const [r, c] = item;
|
|
587
|
-
const curRowData: any = orginalData[r];
|
|
588
|
-
newSelectedCells.push({
|
|
589
|
-
rowData: curRowData?.listSection,
|
|
590
|
-
date: curDateList[c - forwardFillTotal],
|
|
591
|
-
row: r,
|
|
592
|
-
col: c
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
setSelectedCells(newSelectedCells);
|
|
598
|
-
|
|
599
|
-
//
|
|
600
|
-
onKeyPaste?.(e, newSelectedCells);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
//================================================================
|
|
608
|
-
// Other
|
|
609
|
-
//================================================================
|
|
610
|
-
|
|
611
|
-
// helper buttons
|
|
612
|
-
const _delBtn = () => <>
|
|
613
|
-
{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></>}
|
|
614
|
-
{cellCloseBtnLabel || ''}
|
|
615
|
-
</>;
|
|
616
|
-
|
|
617
|
-
const _addBtn = () => <>
|
|
618
|
-
{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></>}
|
|
619
|
-
{cellAddBtnLabel || ''}
|
|
620
|
-
</>;
|
|
621
|
-
|
|
622
|
-
// click outside
|
|
623
|
-
useClickOutside({
|
|
624
|
-
enabled: isShowTableTooltip && tableGridRef.current,
|
|
625
|
-
isOutside: (event: any) => {
|
|
626
|
-
// close dropdown when other dropdown is opened
|
|
627
|
-
return (
|
|
628
|
-
(tableGridRef.current !== event.target && !tableGridRef.current.contains(event.target as HTMLElement))
|
|
629
|
-
)
|
|
630
|
-
},
|
|
631
|
-
handle: (event: any) => {
|
|
632
|
-
hideTableTooltip();
|
|
633
|
-
}
|
|
634
|
-
}, [isShowTableTooltip, tableGridRef]);
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
// cell
|
|
640
|
-
const getCells = (type: 'none' | 'forward' | 'back' = 'none') => {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
//########## MODE: WEEK #############
|
|
644
|
-
if (appearanceMode === 'week') {
|
|
645
|
-
const curWeek: any[] = [];
|
|
646
|
-
weekDates.forEach((date: Date, dayIndex: number) => {
|
|
647
|
-
const _dayOfWeek = new Date(date).getDay();
|
|
648
|
-
// ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
|
649
|
-
const _daysIndicator = [7, 1, 2, 3, 4, 5, 6];
|
|
650
|
-
const _detail = getDateDetails(date);
|
|
651
|
-
const {
|
|
652
|
-
year: _temp_year,
|
|
653
|
-
month: _temp_month,
|
|
654
|
-
day: _temp_day
|
|
655
|
-
} = _detail;
|
|
656
|
-
|
|
657
|
-
curWeek.push({
|
|
658
|
-
month: Number(_temp_month) - 1,
|
|
659
|
-
startDay: _daysIndicator[_dayOfWeek],
|
|
660
|
-
row: 0,
|
|
661
|
-
col: [
|
|
662
|
-
dayIndex
|
|
663
|
-
],
|
|
664
|
-
dateInfo: [
|
|
665
|
-
{
|
|
666
|
-
date: getCalendarDate(date),
|
|
667
|
-
firstGroup: false,
|
|
668
|
-
lastGroup: false,
|
|
669
|
-
validDisplayDate: true
|
|
670
|
-
}
|
|
671
|
-
],
|
|
672
|
-
weekDisplay: [
|
|
673
|
-
WEEK[_daysIndicator[_dayOfWeek] - 1]
|
|
674
|
-
],
|
|
675
|
-
week: [
|
|
676
|
-
_daysIndicator[_dayOfWeek] - 1
|
|
677
|
-
]
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
});
|
|
681
|
-
|
|
682
|
-
return {
|
|
683
|
-
rowsTotal: orginalData.length,
|
|
684
|
-
colsTotal: curWeek.length,
|
|
685
|
-
forwardFillTotal: 0,
|
|
686
|
-
list: curWeek
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
//########## /MODE: WEEK #############
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
//########## MODE: MONTH #############
|
|
695
|
-
if (appearanceMode === 'month') {
|
|
696
|
-
let currentMonth: any = month;
|
|
697
|
-
let currentStartDay: any = startDay;
|
|
698
|
-
|
|
699
|
-
// previous month
|
|
700
|
-
if (type === 'forward') {
|
|
701
|
-
const _date = new Date(year, currentMonth - 1, day);
|
|
702
|
-
currentMonth = _date.getMonth();
|
|
703
|
-
currentStartDay = getStartDayOfMonth(_date);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
// next month
|
|
707
|
-
if (type === 'back') {
|
|
708
|
-
const _date = new Date(year, currentMonth + 1, day);
|
|
709
|
-
currentMonth = _date.getMonth();
|
|
710
|
-
currentStartDay = getStartDayOfMonth(_date);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
//
|
|
715
|
-
const allDays = Array(days[currentMonth] + (currentStartDay - 1)).fill(null).map((_: any, i: number) => i); // [0,1,..,30,31]
|
|
716
|
-
const rows = Math.ceil(allDays.length / 7); // 5
|
|
717
|
-
|
|
718
|
-
//
|
|
719
|
-
const _tempCells: any[] = Array.from({ length: rows }).fill(null);
|
|
720
|
-
|
|
721
|
-
const _getForwardFill = (_year: number, _month: number) => {
|
|
722
|
-
// Get the last day of the previous month
|
|
723
|
-
const lastDayOfLastMonth = new Date(_year, _month - 1, 0);
|
|
724
|
-
const last7Days: Date[] = [];
|
|
725
|
-
|
|
726
|
-
// Rewind 7 days forward from the last day
|
|
727
|
-
for (let i = 0; i < 7; i++) {
|
|
728
|
-
last7Days.unshift(new Date(lastDayOfLastMonth));
|
|
729
|
-
lastDayOfLastMonth.setDate(lastDayOfLastMonth.getDate() - 1);
|
|
730
|
-
}
|
|
731
|
-
return last7Days.map((v: Date) => getCalendarDate(v));
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
const _getBackFill = (_year: number, _month: number) => {
|
|
735
|
-
// Get the first day of the next month
|
|
736
|
-
const firstDayOfNextMonth = new Date(_year, _month, 1);
|
|
737
|
-
const first7Days: Date[] = [];
|
|
738
|
-
|
|
739
|
-
// Rewind 7 days forward from the first day of the next month
|
|
740
|
-
for (let i = 0; i < 7; i++) {
|
|
741
|
-
first7Days.push(new Date(firstDayOfNextMonth));
|
|
742
|
-
firstDayOfNextMonth.setDate(firstDayOfNextMonth.getDate() + 1);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
return first7Days.map((v: Date) => getCalendarDate(v));
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
// The remaining date of the previous month
|
|
751
|
-
// If the number is 7, the calendar does not include the date of the previous month
|
|
752
|
-
const remainPrevDate = findMondayAndTruncate(_getForwardFill(year, month + 1));
|
|
753
|
-
const remainPrevDateTotal = remainPrevDate.length === 7 ? 0 : remainPrevDate.length;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
return {
|
|
757
|
-
rowsTotal: orginalData.length,
|
|
758
|
-
colsTotal: allDays.length,
|
|
759
|
-
forwardFillTotal: remainPrevDateTotal,
|
|
760
|
-
list: _tempCells.map((_: any, j: number) => {
|
|
761
|
-
const _col = allDays.slice(j * 7, (j + 1) * 7);
|
|
762
|
-
|
|
763
|
-
// back fill
|
|
764
|
-
const backFillArr: null[] = [];
|
|
765
|
-
for (let k = 0; k < 7 - _col.length; k++) {
|
|
766
|
-
backFillArr.push(null);
|
|
767
|
-
}
|
|
768
|
-
_col.splice(_col.length, 0, ...backFillArr as any);
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
//
|
|
772
|
-
const isFirstGroup = j === 0;
|
|
773
|
-
const isLastGroup = j === _tempCells.length - 1;
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
// forward fill
|
|
777
|
-
const __forwardFillDate: string[] = _getForwardFill(year, month + 1);
|
|
778
|
-
|
|
779
|
-
// back fill
|
|
780
|
-
const __backFillDate: string[] = _getBackFill(year, month + 1);
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
const _getDateShow = (_dayIndex: number, _m: number, _startDay: number, _month: number) => {
|
|
784
|
-
const currentDay = typeof _dayIndex === 'number' ? _dayIndex - (_startDay - 2) : 0; // ..., -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ...
|
|
785
|
-
|
|
786
|
-
// date
|
|
787
|
-
let _dateShow: any = currentDay > 0 ? `${year}-${_month + 1}-${currentDay}` : '';
|
|
788
|
-
|
|
789
|
-
// forward & back
|
|
790
|
-
if (isFirstGroup && _dateShow === '') {
|
|
791
|
-
_dateShow = __forwardFillDate.at(currentDay - 1);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
if (isLastGroup && _dateShow === '') {
|
|
795
|
-
_dateShow = __backFillDate.at(_m);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
return {
|
|
800
|
-
date: getCalendarDate(_dateShow),
|
|
801
|
-
firstGroup: isFirstGroup,
|
|
802
|
-
lastGroup: isLastGroup,
|
|
803
|
-
validDisplayDate: currentDay > 0 && currentDay <= days[month]
|
|
804
|
-
};
|
|
805
|
-
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
//
|
|
809
|
-
return {
|
|
810
|
-
month: currentMonth,
|
|
811
|
-
startDay: currentStartDay,
|
|
812
|
-
row: j,
|
|
813
|
-
col: _col,
|
|
814
|
-
dateInfo: _col.map((k: number, m: number) => {
|
|
815
|
-
const _lastWeekDays: number = _col.filter(Boolean).length;
|
|
816
|
-
return _getDateShow(k, m - _lastWeekDays, currentStartDay, currentMonth);
|
|
817
|
-
}),
|
|
818
|
-
weekDisplay: _col.map((k: number, m: number) => {
|
|
819
|
-
return WEEK[m]
|
|
820
|
-
}),
|
|
821
|
-
week: _col.map((k: number, m: number) => {
|
|
822
|
-
return m
|
|
823
|
-
}),
|
|
824
|
-
|
|
825
|
-
}
|
|
826
|
-
})
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
//########## /MODE: MONTH #############
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
return {
|
|
835
|
-
rowsTotal: 0,
|
|
836
|
-
colsTotal: 0,
|
|
837
|
-
forwardFillTotal: 0,
|
|
838
|
-
list: []
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
const queryItemObj = () => {
|
|
845
|
-
const curRowData: any = orginalData[tableRowNum];
|
|
846
|
-
const curDate: string = tempDate !== '' ? tempDate : `${year}-${month + 1}-${day}`;
|
|
847
|
-
|
|
848
|
-
if (curRowData) {
|
|
849
|
-
const eventSourcesData = curRowData.eventSources;
|
|
850
|
-
|
|
851
|
-
const _rowData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === getCalendarDate(curDate));
|
|
852
|
-
|
|
853
|
-
let _currentData: any = undefined;
|
|
854
|
-
if (_rowData[0]) {
|
|
855
|
-
const _items = _rowData[0].list;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
if (tableCellId === -1) {
|
|
859
|
-
// add new
|
|
860
|
-
_currentData = {
|
|
861
|
-
rowData: curRowData.listSection,
|
|
862
|
-
id: 0,
|
|
863
|
-
date: getCalendarDate(curDate)
|
|
864
|
-
};
|
|
865
|
-
} else {
|
|
866
|
-
// edit or delete
|
|
867
|
-
_currentData = _items.filter((item: any) => item.id == tableCellId)[0];
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
return _rowData[0] ? _currentData : {
|
|
873
|
-
rowData: curRowData.listSection,
|
|
874
|
-
id: 0,
|
|
875
|
-
date: getCalendarDate(curDate)
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
// ================================================================
|
|
882
|
-
// Table Grid drag & drop
|
|
883
|
-
// ================================================================
|
|
884
|
-
let draggedObj: any = null;
|
|
885
|
-
let mouseDown: boolean = false;
|
|
886
|
-
let startX: any = 0;
|
|
887
|
-
let scrollLeft: any = 0;
|
|
888
|
-
|
|
889
|
-
const handleTableDragStart = useCallback((e: any) => {
|
|
890
|
-
draggedObj = e.currentTarget;
|
|
891
|
-
|
|
892
|
-
mouseDown = true;
|
|
893
|
-
draggedObj.classList.add('dragging');
|
|
894
|
-
|
|
895
|
-
//
|
|
896
|
-
startX = e.pageX - draggedObj.offsetLeft;
|
|
897
|
-
scrollLeft = draggedObj.scrollLeft;
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}, []);
|
|
901
|
-
|
|
902
|
-
const handleTableDragEnd = useCallback((e: any) => {
|
|
903
|
-
if (draggedObj === null) return;
|
|
904
|
-
|
|
905
|
-
mouseDown = false;
|
|
906
|
-
draggedObj.classList.remove('dragging');
|
|
907
|
-
}, []);
|
|
908
|
-
|
|
909
|
-
const handleTableMove = useCallback((e: any) => {
|
|
910
|
-
e.preventDefault();
|
|
911
|
-
if (!mouseDown) { return; }
|
|
912
|
-
const x = e.pageX - draggedObj.offsetLeft;
|
|
913
|
-
const scroll = x - startX;
|
|
914
|
-
draggedObj.scrollLeft = scrollLeft - scroll;
|
|
915
|
-
}, []);
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
// ================================================================
|
|
921
|
-
// Table Grid Tooltip
|
|
922
|
-
// ================================================================
|
|
923
|
-
|
|
924
|
-
function handleTableTooltipMouseEnter(e: any, content: any) {
|
|
925
|
-
setIsShowTableTooltip(true);
|
|
926
|
-
|
|
927
|
-
// update tooltip content
|
|
928
|
-
setTableTooltipContent(content);
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
// update modal positiona
|
|
932
|
-
const _tableTooltipModalRef: any = tableTooltipModalRef.current;
|
|
933
|
-
const _triggerRef: any = e.currentTarget;
|
|
934
|
-
|
|
935
|
-
if (_tableTooltipModalRef !== null && _triggerRef !== null) {
|
|
936
|
-
|
|
937
|
-
const { x, y, width, height } = getAbsolutePositionOfStage(_triggerRef);
|
|
938
|
-
|
|
939
|
-
let pos = _tableTooltipModalRef.dataset.microtipPosition;
|
|
940
|
-
if (typeof pos === 'undefined') pos = 'top';
|
|
941
|
-
|
|
942
|
-
// TOP
|
|
943
|
-
//
|
|
944
|
-
if (pos.indexOf('top') >= 0) {
|
|
945
|
-
_tableTooltipModalRef.style.left = x + (width / 2) + 'px';
|
|
946
|
-
_tableTooltipModalRef.style.top = y - height - CELL_TOOLTIP_POS_OFFSET + 'px';
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
// BOTTOM
|
|
951
|
-
//
|
|
952
|
-
if (pos.indexOf('bottom') >= 0) {
|
|
953
|
-
_tableTooltipModalRef.style.left = x + (width / 2) + 'px';
|
|
954
|
-
_tableTooltipModalRef.style.top = y + height + CELL_TOOLTIP_POS_OFFSET + 'px';
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
// Determine whether it exceeds the far right or left side of the screen
|
|
960
|
-
const _modalContent = _tableTooltipModalRef.querySelector('.custom-event-tl-table__cell-tooltipcontent');
|
|
961
|
-
const _modalBox = _modalContent.getBoundingClientRect();
|
|
962
|
-
if (typeof _modalContent.dataset.offset === 'undefined' && _modalBox.left > 0) {
|
|
963
|
-
|
|
964
|
-
// 10 pixels is used to account for some bias in mobile devices
|
|
965
|
-
if ((_modalBox.right + 10) > window.innerWidth) {
|
|
966
|
-
const _modalOffsetPosition = _modalBox.right - window.innerWidth + CELL_TOOLTIP_EXCEEDED_SIDE_POS_OFFSET;
|
|
967
|
-
_modalContent.dataset.offset = _modalOffsetPosition;
|
|
968
|
-
_modalContent.style.marginLeft = `-${_modalOffsetPosition}px`;
|
|
969
|
-
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if ((_modalBox.left - 10) < 0) {
|
|
974
|
-
const _modalOffsetPosition = Math.abs(_modalBox.left) + CELL_TOOLTIP_EXCEEDED_SIDE_POS_OFFSET;
|
|
975
|
-
_modalContent.dataset.offset = _modalOffsetPosition;
|
|
976
|
-
_modalContent.style.marginLeft = `${_modalOffsetPosition}px`;
|
|
977
|
-
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
function handleTableTooltipMouseLeave() {
|
|
993
|
-
hideTableTooltip();
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
function hideTableTooltip() {
|
|
998
|
-
setIsShowTableTooltip(false);
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
// ================================================================
|
|
1004
|
-
// Calendar
|
|
1005
|
-
// ================================================================
|
|
1006
|
-
function updateTodayDate(inputDate: Date) {
|
|
1007
|
-
setDay(inputDate.getDate());
|
|
1008
|
-
setMonth(inputDate.getMonth());
|
|
1009
|
-
setYear(inputDate.getFullYear());
|
|
1010
|
-
setStartDay(getStartDayOfMonth(inputDate));
|
|
1011
|
-
|
|
1012
|
-
// update selector
|
|
1013
|
-
setSelectedMonth(inputDate.getMonth());
|
|
1014
|
-
setSelectedYear(inputDate.getFullYear());
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
setTimeout(() => {
|
|
1018
|
-
// initialize table grid
|
|
1019
|
-
tableGridInit();
|
|
1020
|
-
|
|
1021
|
-
// The scrollbar position is horizontal
|
|
1022
|
-
bodyScrollbarInit();
|
|
1023
|
-
}, 500);
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
function getStartDayOfMonth(date: Date) {
|
|
1029
|
-
const startDate = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
|
|
1030
|
-
return startDate === 0 ? 7 : startDate;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
function isLeapYear(year: number) {
|
|
1034
|
-
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
const days = isLeapYear(year) ? DAYS_LEAP : DAYS;
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
function handlePrevChange() {
|
|
1042
|
-
|
|
1043
|
-
//########## MODE: WEEK #############
|
|
1044
|
-
if (appearanceMode === 'week') {
|
|
1045
|
-
const _latestWeekOffset = handlePreviousWeek();
|
|
1046
|
-
const weekDates: Date[] = getWeekDatesFromMon(_latestWeekOffset);
|
|
1047
|
-
onChangeWeek?.(getCalendarDate(weekDates.at(0) as Date), getCalendarDate(weekDates.at(-1) as Date));
|
|
1048
|
-
}
|
|
1049
|
-
//########## /MODE: WEEK #############
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
//########## MODE: MONTH #############
|
|
1053
|
-
if (appearanceMode === 'month') {
|
|
1054
|
-
setDate((prevState) => {
|
|
1055
|
-
const _date = new Date(year, month - 1, day);
|
|
1056
|
-
|
|
1057
|
-
// update
|
|
1058
|
-
setSelectedMonth(_date.getMonth());
|
|
1059
|
-
setSelectedYear(_date.getFullYear());
|
|
1060
|
-
|
|
1061
|
-
//
|
|
1062
|
-
onChangeMonth?.({
|
|
1063
|
-
day: padZero(day),
|
|
1064
|
-
month: padZero(_date.getMonth() + 1),
|
|
1065
|
-
year: _date.getFullYear().toString()
|
|
1066
|
-
});
|
|
1067
|
-
|
|
1068
|
-
// restore table grid init status
|
|
1069
|
-
restoreTableGridInitStatus();
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
return _date;
|
|
1074
|
-
});
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1077
|
-
//########## /MODE: MONTH #############
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
function handleNextChange() {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
//########## MODE: WEEK #############
|
|
1086
|
-
if (appearanceMode === 'week') {
|
|
1087
|
-
const _latestWeekOffset = handleNextWeek();
|
|
1088
|
-
const weekDates: Date[] = getWeekDatesFromMon(_latestWeekOffset);
|
|
1089
|
-
onChangeWeek?.(getCalendarDate(weekDates.at(0) as Date), getCalendarDate(weekDates.at(-1) as Date));
|
|
1090
|
-
}
|
|
1091
|
-
//########## /MODE: WEEK #############
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
//########## MODE: MONTH #############
|
|
1095
|
-
if (appearanceMode === 'month') {
|
|
1096
|
-
setDate((prevState) => {
|
|
1097
|
-
const _date = new Date(year, month + 1, day);
|
|
1098
|
-
|
|
1099
|
-
// update
|
|
1100
|
-
setSelectedMonth(_date.getMonth());
|
|
1101
|
-
setSelectedYear(_date.getFullYear());
|
|
1102
|
-
|
|
1103
|
-
//
|
|
1104
|
-
onChangeMonth?.({
|
|
1105
|
-
day: padZero(day),
|
|
1106
|
-
month: padZero(_date.getMonth() + 1),
|
|
1107
|
-
year: _date.getFullYear().toString()
|
|
1108
|
-
});
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
// restore table grid init status
|
|
1112
|
-
restoreTableGridInitStatus();
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
return _date;
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
//########## /MODE: MONTH #############
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1122
|
-
function handleDayChange(e: React.MouseEvent, currentDay: number) {
|
|
1123
|
-
setDate(new Date(year, month, currentDay));
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
function handleYearChange(currentValue: number) {
|
|
1128
|
-
setSelectedYear(currentValue);
|
|
1129
|
-
setYear(currentValue);
|
|
1130
|
-
setDate(new Date(currentValue, month, day));
|
|
1131
|
-
|
|
1132
|
-
// close win
|
|
1133
|
-
setWinYear(false);
|
|
1134
|
-
|
|
1135
|
-
// restore table grid init status
|
|
1136
|
-
restoreTableGridInitStatus();
|
|
1137
|
-
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
function handleMonthChange(currentIndex: number) {
|
|
1142
|
-
setSelectedMonth(currentIndex);
|
|
1143
|
-
setMonth(currentIndex);
|
|
1144
|
-
setDate(new Date(year, currentIndex, day));
|
|
1145
|
-
|
|
1146
|
-
// close win
|
|
1147
|
-
setWinMonth(false);
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
//
|
|
1151
|
-
onChangeMonth?.({
|
|
1152
|
-
day: padZero(day),
|
|
1153
|
-
month: padZero(currentIndex + 1),
|
|
1154
|
-
year: year.toString()
|
|
1155
|
-
});
|
|
1156
|
-
|
|
1157
|
-
// restore table grid init status
|
|
1158
|
-
restoreTableGridInitStatus();
|
|
1159
|
-
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
function handleTodayChange() {
|
|
1164
|
-
setSelectedMonth(now.getMonth());
|
|
1165
|
-
setSelectedYear(now.getFullYear());
|
|
1166
|
-
updateTodayDate(now);
|
|
1167
|
-
|
|
1168
|
-
//
|
|
1169
|
-
const _now = getTodayDate().split('-');
|
|
1170
|
-
onChangeToday?.({
|
|
1171
|
-
day: _now[2],
|
|
1172
|
-
month: _now[1],
|
|
1173
|
-
year: _now[0]
|
|
1174
|
-
});
|
|
1175
|
-
|
|
1176
|
-
//
|
|
1177
|
-
const weekDates: Date[] = getWeekDatesFromMon(0);
|
|
1178
|
-
onChangeWeek?.(getCalendarDate(weekDates.at(0) as Date), getCalendarDate(weekDates.at(-1) as Date));
|
|
1179
|
-
setWeekOffset(0);
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
// restore table grid init status
|
|
1183
|
-
restoreTableGridInitStatus();
|
|
1184
|
-
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
function handleAppearanceChange(e: React.MouseEvent) {
|
|
1188
|
-
const _mode = (e.target as any).dataset.mode;
|
|
1189
|
-
setAppearanceMode(_mode);
|
|
1190
|
-
|
|
1191
|
-
//
|
|
1192
|
-
onChangeAppearanceMode?.(_mode);
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
function handleShowWinYear() {
|
|
1199
|
-
setWinYear((prevState: boolean) => !prevState);
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
function handleShowWinMonth() {
|
|
1203
|
-
setWinMonth((prevState: boolean) => !prevState);
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
// ================================================================
|
|
1208
|
-
// Table Grid
|
|
1209
|
-
// ================================================================
|
|
1210
|
-
|
|
1211
|
-
function generateListSectionUi() {
|
|
1212
|
-
return orginalData.map((item: any, i: number) => {
|
|
1213
|
-
|
|
1214
|
-
return (
|
|
1215
|
-
<tr key={i} role="row" data-index={i}>
|
|
1216
|
-
<td role="gridcell" data-resource-index={i} className="custom-event-tl-table__datagrid-cell">
|
|
1217
|
-
<div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-title" dangerouslySetInnerHTML={{
|
|
1218
|
-
__html: item.listSection.title
|
|
1219
|
-
}} />
|
|
1220
|
-
</td>
|
|
1221
|
-
</tr>
|
|
1222
|
-
)
|
|
1223
|
-
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
function generateDaysUi(eventSourcesData: any[] = [], listSectionData: any = '', rowIndex: number = 0, showEvents: boolean = false) {
|
|
1229
|
-
|
|
1230
|
-
// colIndex
|
|
1231
|
-
let colIndex = 0;
|
|
1232
|
-
|
|
1233
|
-
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1234
|
-
return cellsList.map((item: any, j: number) => {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
return item.col.map((dayIndex: number, i: number) => {
|
|
1239
|
-
|
|
1240
|
-
colIndex++;
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
// date
|
|
1244
|
-
const _dateShow = item.dateInfo[i].date;
|
|
1245
|
-
const _dateDayShow = _dateShow.split('-').at(-1);
|
|
1246
|
-
|
|
1247
|
-
// week day
|
|
1248
|
-
const weekDay = item.week[i];
|
|
1249
|
-
const _weekDayStr = SHOW_WEEK ? <span dangerouslySetInnerHTML={{
|
|
1250
|
-
__html: item.weekDisplay[i]
|
|
1251
|
-
}} /> : null;
|
|
1252
|
-
|
|
1253
|
-
// helper
|
|
1254
|
-
const d = parseFloat(_dateDayShow);
|
|
1255
|
-
const _currentData = eventSourcesData.filter((item: any) => getCalendarDate(item.date as string) === _dateShow);
|
|
1256
|
-
const isLastCol = colIndex === 7 * cellsList.length;
|
|
1257
|
-
const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
|
|
1258
|
-
const isForward = item.dateInfo[i].firstGroup && !isInteractive;
|
|
1259
|
-
const isBack = item.dateInfo[i].lastGroup && !isInteractive;
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
// days
|
|
1263
|
-
//------
|
|
1264
|
-
if (!showEvents) {
|
|
1265
|
-
|
|
1266
|
-
const _thContent = () => {
|
|
1267
|
-
|
|
1268
|
-
return <th
|
|
1269
|
-
className={combinedCls(
|
|
1270
|
-
'custom-event-tl-table__cell-cushion-headercontent__container',
|
|
1271
|
-
{
|
|
1272
|
-
'empty': !isInteractive,
|
|
1273
|
-
'today': d === now.getDate(),
|
|
1274
|
-
'selected': `${year}-${padZero(month + 1)}-${padZero(day)}` === `${year}-${padZero(month + 1)}-${padZero(d)}` && isInteractive,
|
|
1275
|
-
'last-cell': isLastCol,
|
|
1276
|
-
'disabled': !isInteractive
|
|
1277
|
-
}
|
|
1278
|
-
)}
|
|
1279
|
-
key={"col" + i}
|
|
1280
|
-
data-index={colIndex - 1}
|
|
1281
|
-
data-datagrid-col={colIndex - 1}
|
|
1282
|
-
colSpan={1}
|
|
1283
|
-
data-date={_dateShow}
|
|
1284
|
-
data-day={_dateDayShow}
|
|
1285
|
-
data-week={weekDay}
|
|
1286
|
-
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
1287
|
-
onMouseEnter={(e: React.MouseEvent) => {
|
|
1288
|
-
onCellMouseEnter?.(e);
|
|
1289
|
-
}}
|
|
1290
|
-
onMouseDown={(e: React.MouseEvent) => {
|
|
1291
|
-
// update row data
|
|
1292
|
-
setTableRowNum(-1);
|
|
1293
|
-
|
|
1294
|
-
// update cell data
|
|
1295
|
-
setTableCellId(-1);
|
|
1296
|
-
|
|
1297
|
-
if (_currentData.length > 0) {
|
|
1298
|
-
_currentData[0].rowData = listSectionData;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
// reset selection area
|
|
1302
|
-
setSelectedCells([]);
|
|
1303
|
-
setCopiedCells(null);
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
//
|
|
1307
|
-
if (isInteractive) {
|
|
1308
|
-
handleDayChange(e, d); // update current day
|
|
1309
|
-
|
|
1310
|
-
//
|
|
1311
|
-
const _now = _dateShow.split('-');
|
|
1312
|
-
onChangeDate?.(e, _currentData.length === 0 ? {
|
|
1313
|
-
rowData: listSectionData,
|
|
1314
|
-
id: 0,
|
|
1315
|
-
date: _dateShow,
|
|
1316
|
-
day: _now[2],
|
|
1317
|
-
month: _now[1],
|
|
1318
|
-
year: _now[0]
|
|
1319
|
-
} : _currentData[0]);
|
|
1320
|
-
|
|
1321
|
-
if (EVENTS_ENABLED) {
|
|
1322
|
-
onModalEditOpen?.(_currentData.length === 0 ? {
|
|
1323
|
-
rowData: listSectionData,
|
|
1324
|
-
id: 0,
|
|
1325
|
-
date: _dateShow
|
|
1326
|
-
} : _currentData[0], () => setShowEdit(true), 'normal');
|
|
1327
|
-
|
|
1328
|
-
// set temporary date
|
|
1329
|
-
setTempDate(_dateShow);
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
}}
|
|
1334
|
-
onMouseLeave={(e: React.MouseEvent) => {
|
|
1335
|
-
onCellMouseLeave?.(e);
|
|
1336
|
-
}}
|
|
1337
|
-
onMouseUp={(e: React.MouseEvent) => {
|
|
1338
|
-
onCellMouseUp?.(e, selectedCells);
|
|
1339
|
-
}}
|
|
1340
|
-
>
|
|
1341
|
-
{/* forward fill & day & back fill */}
|
|
1342
|
-
<div
|
|
1343
|
-
className={combinedCls(
|
|
1344
|
-
'custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headercontent',
|
|
1345
|
-
{
|
|
1346
|
-
'disabled': !isInteractive
|
|
1347
|
-
}
|
|
1348
|
-
)}
|
|
1349
|
-
style={{ width: (CELL_MIN_W - 1) + 'px' }}
|
|
1350
|
-
>
|
|
1351
|
-
|
|
1352
|
-
{d}
|
|
1353
|
-
{_weekDayStr}
|
|
1354
|
-
</div>
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
</th>;
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
if (!FILL_BLANK_DATE_DISABLD) {
|
|
1361
|
-
return <>{_thContent()}</>;
|
|
1362
|
-
} else {
|
|
1363
|
-
return isInteractive ? (
|
|
1364
|
-
<>{_thContent()}</>
|
|
1365
|
-
) : null;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
// events
|
|
1372
|
-
//------
|
|
1373
|
-
if (showEvents) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
const _eventContent = () => {
|
|
1377
|
-
|
|
1378
|
-
if (
|
|
1379
|
-
_currentData.length === 0 ||
|
|
1380
|
-
!Array.isArray(_currentData) ||
|
|
1381
|
-
typeof _currentData[0].list === 'undefined'
|
|
1382
|
-
) {
|
|
1383
|
-
return null;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
//
|
|
1387
|
-
const _items = _currentData[0].list;
|
|
1388
|
-
|
|
1389
|
-
return _items.map((cellItem: any, cellItemIndex: number) => {
|
|
1390
|
-
|
|
1391
|
-
const _eventContentTooltip = typeof cellItem.dataTooltip === 'undefined' ? '' : <>
|
|
1392
|
-
<div
|
|
1393
|
-
className="custom-event-tl__day__event-tooltipcontent"
|
|
1394
|
-
dangerouslySetInnerHTML={{
|
|
1395
|
-
__html: cellItem.dataTooltip
|
|
1396
|
-
}}
|
|
1397
|
-
></div>
|
|
1398
|
-
</>;
|
|
1399
|
-
|
|
1400
|
-
return <div
|
|
1401
|
-
className={combinedCls(
|
|
1402
|
-
`custom-event-tl-table__cell-cushion-content__item custom-event-tl-table__cell-cushion-content__item-${cellItemIndex}`,
|
|
1403
|
-
{
|
|
1404
|
-
'first': cellItemIndex === 0,
|
|
1405
|
-
'last': cellItemIndex === _items.length - 1
|
|
1406
|
-
}
|
|
1407
|
-
)}
|
|
1408
|
-
key={`cell-item-${rowIndex}-${cellItemIndex}}`}
|
|
1409
|
-
data-overlay-id={`custom-event-tl-table__cell-tooltipwrapper-${idRes}`}
|
|
1410
|
-
data-cell-item-index={cellItemIndex}
|
|
1411
|
-
data-date={_dateShow}
|
|
1412
|
-
data-day={_dateDayShow}
|
|
1413
|
-
data-week={weekDay}
|
|
1414
|
-
data-row={rowIndex}
|
|
1415
|
-
onMouseEnter={(e: React.MouseEvent) => {
|
|
1416
|
-
e.stopPropagation();
|
|
1417
|
-
|
|
1418
|
-
if (_eventContentTooltip !== '') {
|
|
1419
|
-
if (typeof tableTooltipDisabled === 'undefined' || tableTooltipDisabled === false) {
|
|
1420
|
-
handleTableTooltipMouseEnter(e, _eventContentTooltip);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
}}
|
|
1424
|
-
onMouseLeave={(e: React.MouseEvent) => {
|
|
1425
|
-
e.stopPropagation();
|
|
1426
|
-
|
|
1427
|
-
if (_eventContentTooltip !== '') {
|
|
1428
|
-
if (typeof tableTooltipDisabled === 'undefined' || tableTooltipDisabled === false) {
|
|
1429
|
-
handleTableTooltipMouseLeave();
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
}}
|
|
1435
|
-
onClick={(e: React.MouseEvent) => {
|
|
1436
|
-
e.stopPropagation();
|
|
1437
|
-
|
|
1438
|
-
// update row data
|
|
1439
|
-
setTableRowNum(rowIndex);
|
|
1440
|
-
|
|
1441
|
-
// update cell data
|
|
1442
|
-
setTableCellId(cellItem.id);
|
|
1443
|
-
|
|
1444
|
-
cellItem.rowData = listSectionData;
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
// Callback
|
|
1448
|
-
cellItem.callback?.();
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
//
|
|
1452
|
-
if (isInteractive) {
|
|
1453
|
-
handleDayChange(e, d); // update current day
|
|
1454
|
-
|
|
1455
|
-
//
|
|
1456
|
-
const _now = cellItem.date.split('-');
|
|
1457
|
-
onChangeDate?.(e, {
|
|
1458
|
-
...cellItem,
|
|
1459
|
-
day: _now[2],
|
|
1460
|
-
month: _now[1],
|
|
1461
|
-
year: _now[0]
|
|
1462
|
-
});
|
|
1463
|
-
|
|
1464
|
-
if (EVENTS_ENABLED) {
|
|
1465
|
-
onModalEditOpen?.(cellItem, () => setShowEdit(true), 'normal');
|
|
1466
|
-
|
|
1467
|
-
// set temporary date
|
|
1468
|
-
setTempDate(_dateShow);
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
}}
|
|
1472
|
-
>
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
{/* ITEM */}
|
|
1477
|
-
<div
|
|
1478
|
-
className="custom-event-tl__day__event"
|
|
1479
|
-
style={typeof cellItem !== 'undefined' && (cellItem as any).eventStyles !== 'undefined' ? cellItem.eventStyles : {}}
|
|
1480
|
-
dangerouslySetInnerHTML={typeof cellItem.data === 'string' ? {
|
|
1481
|
-
__html: cellItem.data
|
|
1482
|
-
} : undefined}
|
|
1483
|
-
>
|
|
1484
|
-
{React.isValidElement(cellItem.data) ? <>{cellItem.data}</> : null}
|
|
1485
|
-
</div>
|
|
1486
|
-
{/* /ITEM */}
|
|
1487
|
-
|
|
1488
|
-
{/* DELETE BUTTON */}
|
|
1489
|
-
<div
|
|
1490
|
-
className={`custom-event-tl__day__eventdel ${cellCloseBtnClassName || ''}`}
|
|
1491
|
-
>
|
|
1492
|
-
<a
|
|
1493
|
-
href="#"
|
|
1494
|
-
tabIndex={-1}
|
|
1495
|
-
className="align-middle"
|
|
1496
|
-
data-date={_dateShow}
|
|
1497
|
-
data-day={_dateDayShow}
|
|
1498
|
-
data-week={weekDay}
|
|
1499
|
-
data-row={rowIndex}
|
|
1500
|
-
onClick={(e: React.MouseEvent) => {
|
|
1501
|
-
e.preventDefault();
|
|
1502
|
-
e.stopPropagation();
|
|
1503
|
-
|
|
1504
|
-
// update row data
|
|
1505
|
-
setTableRowNum(rowIndex);
|
|
1506
|
-
|
|
1507
|
-
// update cell data
|
|
1508
|
-
setTableCellId(cellItem.id);
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
const _existsContent = cellItem;
|
|
1512
|
-
if (typeof _existsContent !== 'undefined') {
|
|
1513
|
-
_existsContent.rowData = listSectionData;
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
//
|
|
1517
|
-
if (isInteractive) {
|
|
1518
|
-
handleDayChange(e, d); // update current day
|
|
1519
|
-
|
|
1520
|
-
//
|
|
1521
|
-
const _now = _dateShow.split('-');
|
|
1522
|
-
onChangeDate?.(e, {
|
|
1523
|
-
rowData: listSectionData,
|
|
1524
|
-
id: 0,
|
|
1525
|
-
date: _dateShow,
|
|
1526
|
-
day: _now[2],
|
|
1527
|
-
month: _now[1],
|
|
1528
|
-
year: _now[0]
|
|
1529
|
-
});
|
|
1530
|
-
|
|
1531
|
-
if (EVENTS_DELETE_ENABLED) {
|
|
1532
|
-
onModalDeleteOpen?.(_existsContent, () => setShowDelete(true));
|
|
1533
|
-
|
|
1534
|
-
// set temporary date
|
|
1535
|
-
setTempDate(_dateShow);
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
}}
|
|
1542
|
-
>
|
|
1543
|
-
{_delBtn()}
|
|
1544
|
-
</a>
|
|
1545
|
-
|
|
1546
|
-
</div>
|
|
1547
|
-
{/* /DELETE BUTTON */}
|
|
1548
|
-
</div>
|
|
1549
|
-
});
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
const _tdContent = () => {
|
|
1555
|
-
|
|
1556
|
-
return <td
|
|
1557
|
-
className={combinedCls(
|
|
1558
|
-
'custom-event-tl-table__cell-cushion-content__container custom-event-tl-table__cell-tooltiptrigger',
|
|
1559
|
-
{
|
|
1560
|
-
'has-event': eventSourcesData && _currentData.length > 0,
|
|
1561
|
-
'empty': !isInteractive,
|
|
1562
|
-
'today': d === now.getDate(),
|
|
1563
|
-
'selected': isCellSelected(rowIndex, dayIndex) && isInteractive,
|
|
1564
|
-
'last-cell': isLastCol,
|
|
1565
|
-
'disabled': !isInteractive,
|
|
1566
|
-
'has-events': _eventContent() !== null
|
|
1567
|
-
}
|
|
1568
|
-
)}
|
|
1569
|
-
key={"col" + i}
|
|
1570
|
-
data-index={colIndex - 1}
|
|
1571
|
-
colSpan={1}
|
|
1572
|
-
data-rowinfo={JSON.stringify(orginalData[rowIndex]?.listSection)}
|
|
1573
|
-
data-date={_dateShow}
|
|
1574
|
-
data-day={_dateDayShow}
|
|
1575
|
-
data-week={weekDay}
|
|
1576
|
-
data-row={rowIndex}
|
|
1577
|
-
onMouseEnter={(e: React.MouseEvent) => {
|
|
1578
|
-
onCellMouseEnter?.(e);
|
|
1579
|
-
|
|
1580
|
-
//
|
|
1581
|
-
if (multipleCells) handleTableMainCellMouseEnter(e, rowIndex, dayIndex, forwardFillTotal);
|
|
1582
|
-
}}
|
|
1583
|
-
onMouseDown={(e: React.MouseEvent) => {
|
|
1584
|
-
//
|
|
1585
|
-
onCellClick?.(e, {
|
|
1586
|
-
rowData: orginalData[rowIndex]?.listSection,
|
|
1587
|
-
date: _dateShow,
|
|
1588
|
-
row: rowIndex,
|
|
1589
|
-
col: dayIndex
|
|
1590
|
-
});
|
|
1591
|
-
|
|
1592
|
-
if (isInteractive) {
|
|
1593
|
-
handleDayChange(e, d); // update current day
|
|
1594
|
-
onChangeDate?.(e, null);
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
if (multipleCells) handleTableMainCellMouseDown(e, rowIndex, dayIndex, forwardFillTotal);
|
|
1599
|
-
}}
|
|
1600
|
-
|
|
1601
|
-
onDoubleClick={(e: React.MouseEvent) => {
|
|
1602
|
-
//
|
|
1603
|
-
onCellDoubleClick?.(e, {
|
|
1604
|
-
rowData: orginalData[rowIndex]?.listSection,
|
|
1605
|
-
date: _dateShow,
|
|
1606
|
-
row: rowIndex,
|
|
1607
|
-
col: dayIndex
|
|
1608
|
-
});
|
|
1609
|
-
}}
|
|
1610
|
-
onMouseLeave={(e: React.MouseEvent) => {
|
|
1611
|
-
onCellMouseLeave?.(e);
|
|
1612
|
-
}}
|
|
1613
|
-
onMouseUp={(e: React.MouseEvent) => {
|
|
1614
|
-
onCellMouseUp?.(e, selectedCells);
|
|
1615
|
-
}}
|
|
1616
|
-
>
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
{/* forward fill & day & back fill */}
|
|
1620
|
-
<div
|
|
1621
|
-
className={combinedCls(
|
|
1622
|
-
'custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-content',
|
|
1623
|
-
{
|
|
1624
|
-
'disabled': !isInteractive
|
|
1625
|
-
}
|
|
1626
|
-
)}
|
|
1627
|
-
style={{ width: (CELL_MIN_W - 1) + 'px' }}
|
|
1628
|
-
>
|
|
1629
|
-
|
|
1630
|
-
{/*++++++++++++++++ EVENT ++++++++++++++++*/}
|
|
1631
|
-
{_eventContent() || <><i style={{ userSelect: 'none' }}> </i></>}
|
|
1632
|
-
{/*++++++++++++++++ /EVENT ++++++++++++++++*/}
|
|
1633
|
-
|
|
1634
|
-
{/* ADD BUTTON */}
|
|
1635
|
-
{isForward || isBack ? null : <>
|
|
1636
|
-
<div
|
|
1637
|
-
className={`custom-event-tl__day__eventadd ${cellAddBtnClassName || ''}`}
|
|
1638
|
-
>
|
|
1639
|
-
<a
|
|
1640
|
-
href="#"
|
|
1641
|
-
tabIndex={-1}
|
|
1642
|
-
className="align-middle"
|
|
1643
|
-
data-date={_dateShow}
|
|
1644
|
-
data-day={_dateDayShow}
|
|
1645
|
-
data-week={weekDay}
|
|
1646
|
-
data-row={rowIndex}
|
|
1647
|
-
onClick={(e: React.MouseEvent) => {
|
|
1648
|
-
e.preventDefault();
|
|
1649
|
-
e.stopPropagation();
|
|
1650
|
-
|
|
1651
|
-
// update row data
|
|
1652
|
-
setTableRowNum(rowIndex);
|
|
1653
|
-
|
|
1654
|
-
// update cell data
|
|
1655
|
-
setTableCellId(-1);
|
|
1656
|
-
|
|
1657
|
-
//
|
|
1658
|
-
if (isInteractive) {
|
|
1659
|
-
handleDayChange(e, d); // update current day
|
|
1660
|
-
|
|
1661
|
-
//
|
|
1662
|
-
const _now = _dateShow.split('-');
|
|
1663
|
-
onChangeDate?.(e, {
|
|
1664
|
-
rowData: listSectionData,
|
|
1665
|
-
id: 0,
|
|
1666
|
-
date: _dateShow,
|
|
1667
|
-
day: _now[2],
|
|
1668
|
-
month: _now[1],
|
|
1669
|
-
year: _now[0]
|
|
1670
|
-
});
|
|
1671
|
-
|
|
1672
|
-
if (EVENTS_ENABLED) {
|
|
1673
|
-
onModalEditOpen?.({
|
|
1674
|
-
rowData: listSectionData,
|
|
1675
|
-
id: 0,
|
|
1676
|
-
date: _dateShow
|
|
1677
|
-
}, () => setShowEdit(true), 'new');
|
|
1678
|
-
|
|
1679
|
-
// set temporary date
|
|
1680
|
-
setTempDate(_dateShow);
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
}}
|
|
1685
|
-
>
|
|
1686
|
-
{_addBtn()}
|
|
1687
|
-
</a>
|
|
1688
|
-
|
|
1689
|
-
</div>
|
|
1690
|
-
</>}
|
|
1691
|
-
{/* /ADD BUTTON */}
|
|
1692
|
-
</div>
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
</td>;
|
|
1696
|
-
};
|
|
1697
|
-
|
|
1698
|
-
if (!FILL_BLANK_DATE_DISABLD) {
|
|
1699
|
-
return <>{_tdContent()}</>;
|
|
1700
|
-
} else {
|
|
1701
|
-
return isInteractive ? (
|
|
1702
|
-
<>{_tdContent()}</>
|
|
1703
|
-
) : null;
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
});
|
|
1710
|
-
|
|
1711
|
-
})
|
|
1712
|
-
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
function generateColUi() {
|
|
1716
|
-
|
|
1717
|
-
{/* //########## MODE: WEEK ############# */ }
|
|
1718
|
-
if (appearanceMode === 'week') {
|
|
1719
|
-
return Array.from({ length: 7 }).fill(0).map((item: any, i: number) => {
|
|
1720
|
-
return (
|
|
1721
|
-
<col
|
|
1722
|
-
key={"col-placeholder-" + i}
|
|
1723
|
-
data-index={i}
|
|
1724
|
-
data-datagrid-col={i}
|
|
1725
|
-
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
1726
|
-
|
|
1727
|
-
/>
|
|
1728
|
-
);
|
|
1729
|
-
})
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
{/* //########## /MODE: WEEK ############# */ }
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
{/* //########## MODE: MONTH ############# */ }
|
|
1736
|
-
if (appearanceMode === 'month') {
|
|
1737
|
-
if (FILL_BLANK_DATE_DISABLD) {
|
|
1738
|
-
return Array.from({ length: days[month] }).fill(0).map((item: any, i: number) => {
|
|
1739
|
-
return (
|
|
1740
|
-
<col
|
|
1741
|
-
key={"col-placeholder-" + i}
|
|
1742
|
-
data-index={i}
|
|
1743
|
-
data-datagrid-col={i}
|
|
1744
|
-
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
1745
|
-
|
|
1746
|
-
/>
|
|
1747
|
-
);
|
|
1748
|
-
})
|
|
1749
|
-
|
|
1750
|
-
} else {
|
|
1751
|
-
// colIndex
|
|
1752
|
-
let colIndex = 0;
|
|
1753
|
-
|
|
1754
|
-
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1755
|
-
return cellsList.map((item: any, j: number) => {
|
|
1756
|
-
return item.col.map((dayIndex: number | null, i: number) => {
|
|
1757
|
-
|
|
1758
|
-
colIndex++;
|
|
1759
|
-
|
|
1760
|
-
// helper
|
|
1761
|
-
const isInteractive = item.dateInfo[i].validDisplayDate; // The date on which the user interaction can occur, e.g. click, modify
|
|
1762
|
-
|
|
1763
|
-
return (
|
|
1764
|
-
<col
|
|
1765
|
-
className={combinedCls(
|
|
1766
|
-
{
|
|
1767
|
-
'empty': !isInteractive
|
|
1768
|
-
}
|
|
1769
|
-
)}
|
|
1770
|
-
key={"col-placeholder-" + i}
|
|
1771
|
-
data-index={colIndex - 1}
|
|
1772
|
-
data-datagrid-col={colIndex - 1}
|
|
1773
|
-
style={{ minWidth: CELL_MIN_W + 'px' }}
|
|
1774
|
-
|
|
1775
|
-
/>
|
|
1776
|
-
);
|
|
1777
|
-
|
|
1778
|
-
});
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
})
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
{/* //########## /MODE: MONTH ############# */ }
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
function syncTableScrollHeader() {
|
|
1796
|
-
const el: any = scrollHeaderRef.current;
|
|
1797
|
-
if (el === null) return;
|
|
1798
|
-
|
|
1799
|
-
const _latestScrollLeft = el.scrollLeft;
|
|
1800
|
-
|
|
1801
|
-
if (scrollBodyRef.current) (scrollBodyRef.current as any).scrollLeft = _latestScrollLeft;
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
function syncTableScrollBody() {
|
|
1807
|
-
const el: any = scrollBodyRef.current;
|
|
1808
|
-
if (el === null) return;
|
|
1809
|
-
|
|
1810
|
-
const _latestScrollTop = el.scrollTop;
|
|
1811
|
-
const _latestScrollLeft = el.scrollLeft;
|
|
1812
|
-
|
|
1813
|
-
if (scrollListRef.current) (scrollListRef.current as any).scrollTop = _latestScrollTop;
|
|
1814
|
-
if (scrollHeaderRef.current) (scrollHeaderRef.current as any).scrollLeft = _latestScrollLeft;
|
|
1815
|
-
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
function syncTableScrollList() {
|
|
1819
|
-
const el: any = scrollListRef.current;
|
|
1820
|
-
if (el === null) return;
|
|
1821
|
-
|
|
1822
|
-
const _latestScrollTop = el.scrollTop;
|
|
1823
|
-
|
|
1824
|
-
if (scrollBodyRef.current) (scrollBodyRef.current as any).scrollTop = _latestScrollTop;
|
|
1825
|
-
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
function restoreTableGridInitStatus() {
|
|
1831
|
-
|
|
1832
|
-
// restore table grid init status
|
|
1833
|
-
if (scrollListRef.current) (scrollListRef.current as any).scrollTop = 0;
|
|
1834
|
-
if (scrollBodyRef.current) (scrollBodyRef.current as any).scrollLeft = 0;
|
|
1835
|
-
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
function bodyScrollbarInit() {
|
|
1840
|
-
if (scrollBodyRef.current === null || tableGridRef.current === null) return;
|
|
1841
|
-
|
|
1842
|
-
// The scrollbar position is horizontal
|
|
1843
|
-
const targetPos = tableGridRef.current.querySelector('.custom-event-tl-table__datagrid-header__content tbody .today.selected');
|
|
1844
|
-
if (targetPos !== null) {
|
|
1845
|
-
(scrollBodyRef.current as any).scrollLeft = targetPos.offsetLeft;
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
function tableGridInitHeadertitle() {
|
|
1853
|
-
//
|
|
1854
|
-
if (tableGridRef.current === null) return;
|
|
1855
|
-
|
|
1856
|
-
const tableGridEl: any = tableGridRef.current;
|
|
1857
|
-
|
|
1858
|
-
// initialize cell height
|
|
1859
|
-
const headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
|
|
1860
|
-
const trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
|
|
1861
|
-
|
|
1862
|
-
for (let i = 0; i < headerTitleTrElements.length; i++) {
|
|
1863
|
-
|
|
1864
|
-
const targetElement = headerTitleTrElements[i].offsetHeight > trElements[i].offsetHeight ? headerTitleTrElements[i] : trElements[i];
|
|
1865
|
-
const tdOHeight = window.getComputedStyle(targetElement).height;
|
|
1866
|
-
headerTitleTrElements[i].style.height = tdOHeight;
|
|
1867
|
-
trElements[i].style.height = tdOHeight;
|
|
1868
|
-
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
function tableGridInit() {
|
|
1874
|
-
|
|
1875
|
-
//
|
|
1876
|
-
if (tableGridRef.current === null) return;
|
|
1877
|
-
|
|
1878
|
-
const { forwardFillTotal, list: cellsList } = getCells();
|
|
1879
|
-
const tableGridEl: any = tableGridRef.current;
|
|
1880
|
-
let _curCellMinWidth: number = CELL_MIN_W;
|
|
1881
|
-
let _curColCount: number = FILL_BLANK_DATE_DISABLD ? days[month] : 7 * cellsList.length;
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
if (appearanceMode === 'week') {
|
|
1885
|
-
_curColCount = 7;
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
//****************
|
|
1889
|
-
// STEP 1-1:
|
|
1890
|
-
//****************
|
|
1891
|
-
// calculate min width (MODE: WEEK)
|
|
1892
|
-
//--------------
|
|
1893
|
-
if (appearanceMode === 'week') {
|
|
1894
|
-
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1895
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
1896
|
-
const tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
1897
|
-
const tableBorderWidth = 4;
|
|
1898
|
-
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1899
|
-
|
|
1900
|
-
_curCellMinWidth = scrollMaxWidth / 7;
|
|
1901
|
-
_curColCount = 7;
|
|
1902
|
-
|
|
1903
|
-
// header
|
|
1904
|
-
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-content').forEach((node: HTMLDivElement) => {
|
|
1905
|
-
node.style.width = _curCellMinWidth + 'px';
|
|
1906
|
-
});
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
//****************
|
|
1914
|
-
// STEP 1-2:
|
|
1915
|
-
//****************
|
|
1916
|
-
// calculate min width (MODE: MONTH)
|
|
1917
|
-
//--------------
|
|
1918
|
-
const cellMinWidth = _curCellMinWidth;
|
|
1919
|
-
const colCount = _curColCount;
|
|
1920
|
-
const scrollableMinWidth = cellMinWidth * colCount;
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
//****************
|
|
1924
|
-
// STEP 1-3:
|
|
1925
|
-
//****************
|
|
1926
|
-
// initialize "header & main" cells
|
|
1927
|
-
//--------------
|
|
1928
|
-
const headerThContentContainers: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-header__content tbody').getElementsByTagName('th');
|
|
1929
|
-
for (let i = 0; i < headerThContentContainers.length; i++) {
|
|
1930
|
-
const curHeaderThContent = headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
1931
|
-
if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
const mainTdContentContainers: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('td');
|
|
1936
|
-
for (let i = 0; i < mainTdContentContainers.length; i++) {
|
|
1937
|
-
const curHeaderThContent = mainTdContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-content');
|
|
1938
|
-
if (curHeaderThContent !== null) curHeaderThContent.style.width = _curCellMinWidth + 'px';
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
const mainTdContentCols: any = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content colgroup').getElementsByTagName('col')
|
|
1942
|
-
for (let i = 0; i < mainTdContentCols.length; i++) {
|
|
1943
|
-
mainTdContentCols[i].style.minWidth = _curCellMinWidth + 'px';
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
//****************
|
|
1948
|
-
// STEP 2:
|
|
1949
|
-
//****************
|
|
1950
|
-
// initialize scrollable wrapper (width)
|
|
1951
|
-
//--------------
|
|
1952
|
-
const _scrollableWrapper: HTMLElement[] = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
|
|
1953
|
-
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
1954
|
-
const scrollType = el.dataset.scroll;
|
|
1955
|
-
|
|
1956
|
-
if (appearanceMode === 'week') {
|
|
1957
|
-
el.classList.add('custom-event-tl-table__scroller-harness--hideX');
|
|
1958
|
-
}
|
|
1959
|
-
if (appearanceMode === 'month') {
|
|
1960
|
-
el.classList.remove('custom-event-tl-table__scroller-harness--hideX');
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
if (scrollType !== 'list') {
|
|
1964
|
-
const _content = el.querySelector('.custom-event-tl-table__scroller');
|
|
1965
|
-
const tableMaxWidth = tableGridEl.clientWidth;
|
|
1966
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
1967
|
-
const tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
1968
|
-
const tableBorderWidth = 4;
|
|
1969
|
-
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
1970
|
-
|
|
1971
|
-
el.dataset.width = scrollMaxWidth;
|
|
1972
|
-
el.style.maxWidth = el.dataset.width + 'px';
|
|
1973
|
-
_content.style.minWidth = scrollableMinWidth + 'px';
|
|
1974
|
-
|
|
1975
|
-
}
|
|
1976
|
-
});
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
//****************
|
|
1980
|
-
// STEP 3:
|
|
1981
|
-
//****************
|
|
1982
|
-
// initialize cell width
|
|
1983
|
-
//--------------
|
|
1984
|
-
const tdElementMaxWidth: number = typeof mainTdContentContainers[0] === 'undefined' ? 0 : parseFloat(window.getComputedStyle(mainTdContentContainers[0].querySelector('.custom-event-tl-table__cell-cushion-content')).maxWidth);
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
if (Array.isArray(eventsValue) && eventsValue.length > 0) {
|
|
1988
|
-
|
|
1989
|
-
for (let i = 0; i < headerThContentContainers.length; i++) {
|
|
1990
|
-
|
|
1991
|
-
const curHeaderThContent = headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent');
|
|
1992
|
-
const curHeaderThContentMaxWidth = parseFloat(window.getComputedStyle(curHeaderThContent).width);
|
|
1993
|
-
const targetElement = headerThContentContainers[i].offsetWidth > mainTdContentContainers[i].offsetWidth ? headerThContentContainers[i] : mainTdContentContainers[i];
|
|
1994
|
-
let tdOwidth = parseFloat(window.getComputedStyle(targetElement).width);
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
// check td max width
|
|
1998
|
-
if (tdElementMaxWidth > 0 && tdOwidth > tdElementMaxWidth) {
|
|
1999
|
-
tdOwidth = tdElementMaxWidth;
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
// check header th max width
|
|
2003
|
-
if (tdElementMaxWidth > 0 && tdElementMaxWidth < curHeaderThContentMaxWidth) {
|
|
2004
|
-
tdOwidth = curHeaderThContentMaxWidth;
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
// Prevent the width from being +1 each time it is initialized
|
|
2008
|
-
tdOwidth = tdOwidth - 1;
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
headerThContentContainers[i].querySelector('.custom-event-tl-table__cell-cushion-headercontent').style.width = tdOwidth + 'px';
|
|
2012
|
-
mainTdContentCols[i].style.minWidth = tdOwidth + 'px';
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
//****************
|
|
2020
|
-
// STEP 4:
|
|
2021
|
-
//****************
|
|
2022
|
-
// initialize max width of table content
|
|
2023
|
-
//--------------
|
|
2024
|
-
if (scrollBodyRef.current !== null && scrollHeaderRef.current !== null) {
|
|
2025
|
-
const tableContentWidth = window.getComputedStyle(tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content')).width;
|
|
2026
|
-
const scrollBodyEl: any = scrollBodyRef.current;
|
|
2027
|
-
const scrollHeaderEl: any = scrollHeaderRef.current;
|
|
2028
|
-
|
|
2029
|
-
scrollBodyEl.style.width = tableContentWidth;
|
|
2030
|
-
scrollHeaderEl.style.width = tableContentWidth;
|
|
2031
|
-
scrollBodyEl.dataset.width = parseFloat(tableContentWidth);
|
|
2032
|
-
scrollHeaderEl.dataset.width = parseFloat(tableContentWidth);
|
|
2033
|
-
|
|
2034
|
-
//
|
|
2035
|
-
const tableWrapperMaxWidthLatest = tableGridEl.clientWidth;
|
|
2036
|
-
if (tableWrapperMaxWidthLatest > parseFloat(tableContentWidth)) {
|
|
2037
|
-
tableGridEl.querySelector('.custom-event-tl-table__timeline-table').style.width = tableContentWidth;
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
//****************
|
|
2046
|
-
// STEP 5:
|
|
2047
|
-
//****************
|
|
2048
|
-
// initialize cell height
|
|
2049
|
-
//--------------
|
|
2050
|
-
tableGridInitHeadertitle();
|
|
2051
|
-
|
|
2052
|
-
//****************
|
|
2053
|
-
// STEP 6:
|
|
2054
|
-
//****************
|
|
2055
|
-
//initialize scrollable wrapper (height)
|
|
2056
|
-
//--------------
|
|
2057
|
-
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
2058
|
-
const scrollType = el.dataset.scroll;
|
|
2059
|
-
const oldHeight = el.clientHeight;
|
|
2060
|
-
|
|
2061
|
-
if (scrollType !== 'header') {
|
|
2062
|
-
const tableWrapperMaxHeight = window.getComputedStyle(tableGridEl as HTMLElement).height;
|
|
2063
|
-
if (oldHeight > parseFloat(tableWrapperMaxHeight)) {
|
|
2064
|
-
el.style.height = tableWrapperMaxHeight;
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
});
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
//****************
|
|
2073
|
-
// STEP 7:
|
|
2074
|
-
//****************
|
|
2075
|
-
// display wrapper
|
|
2076
|
-
//--------------
|
|
2077
|
-
tableGridEl.classList.remove('invisible');
|
|
2078
|
-
|
|
2079
|
-
//****************
|
|
2080
|
-
// STEP 1-1:
|
|
2081
|
-
//****************
|
|
2082
|
-
// calculate min width (MODE: WEEK)
|
|
2083
|
-
//--------------
|
|
2084
|
-
if (appearanceMode === 'week') {
|
|
2085
|
-
const tableMaxWidth = tableGridEl.clientWidth;
|
|
2086
|
-
const tableHeaderTitleWidth = tableGridEl.querySelector('.custom-event-tl-table__cell-cushion-headertitle').clientWidth;
|
|
2087
|
-
const tableDividerWidth = tableGridEl.querySelector('.custom-event-tl-table__timeline-divider').clientWidth;
|
|
2088
|
-
const tableBorderWidth = 4;
|
|
2089
|
-
const scrollMaxWidth = tableMaxWidth - tableHeaderTitleWidth - tableDividerWidth - tableBorderWidth;
|
|
2090
|
-
|
|
2091
|
-
_curCellMinWidth = scrollMaxWidth / 7;
|
|
2092
|
-
_curColCount = 7;
|
|
2093
|
-
|
|
2094
|
-
// header content
|
|
2095
|
-
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-headercontent__container, .custom-event-tl-table__cell-cushion-headercontent').forEach((node: HTMLDivElement) => {
|
|
2096
|
-
node.style.width = _curCellMinWidth + 'px';
|
|
2097
|
-
});
|
|
2098
|
-
|
|
2099
|
-
// main content
|
|
2100
|
-
tableGridEl.querySelectorAll('.custom-event-tl-table__cell-cushion-content').forEach((node: HTMLDivElement) => {
|
|
2101
|
-
node.style.width = _curCellMinWidth + 'px';
|
|
2102
|
-
});
|
|
2103
|
-
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
function tableGridReset() {
|
|
2110
|
-
if (tableGridRef.current === null) return;
|
|
2111
|
-
|
|
2112
|
-
const tableGridEl: any = tableGridRef.current;
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
// initialize scrollable wrapper (width & height)
|
|
2116
|
-
//--------------
|
|
2117
|
-
const _scrollableWrapper = tableGridEl.querySelectorAll('.custom-event-tl-table__scroller-harness');
|
|
2118
|
-
[].slice.call(_scrollableWrapper).forEach((el: any) => {
|
|
2119
|
-
|
|
2120
|
-
const _content = el.querySelector('.custom-event-tl-table__scroller');
|
|
2121
|
-
el.removeAttribute('data-width');
|
|
2122
|
-
el.removeAttribute('style');
|
|
2123
|
-
_content.removeAttribute('style');
|
|
2124
|
-
});
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
// initialize cell height
|
|
2128
|
-
//--------------
|
|
2129
|
-
const headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
|
|
2130
|
-
const trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
|
|
2131
|
-
|
|
2132
|
-
for (let i = 0; i < headerTitleTrElements.length; i++) {
|
|
2133
|
-
headerTitleTrElements[i].removeAttribute('style');
|
|
2134
|
-
trElements[i].removeAttribute('style');
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
// ================================================================
|
|
2144
|
-
//
|
|
2145
|
-
// ================================================================
|
|
2146
|
-
//if user change the selectedYear, then udate the years array that is displayed on year tab view
|
|
2147
|
-
useEffect(() => {
|
|
2148
|
-
const years: number[] = [];
|
|
2149
|
-
for (let y = selectedYear - 10; y < selectedYear + 10; y++) {
|
|
2150
|
-
years.push(y as never)
|
|
2151
|
-
}
|
|
2152
|
-
setYearsCollection(years);
|
|
2153
|
-
}, [selectedYear]);
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
useEffect(() => {
|
|
2158
|
-
updateTodayDate(date);
|
|
2159
|
-
}, [date]);
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
useEffect(() => {
|
|
2163
|
-
// Guaranteed year change triggered by the front and rear buttons
|
|
2164
|
-
onChangeYear?.({
|
|
2165
|
-
day: padZero(day),
|
|
2166
|
-
month: padZero(month + 1),
|
|
2167
|
-
year: year.toString()
|
|
2168
|
-
});
|
|
2169
|
-
}, [year]);
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
useEffect(() => {
|
|
2173
|
-
|
|
2174
|
-
const { forwardFillTotal, list: cellsList } = getCells();
|
|
2175
|
-
if (typeof appearanceWeekTmpl === 'function') {
|
|
2176
|
-
setDisplayWeekForHeader([cellsList.at(0).dateInfo[0].date, cellsList.at(-1).dateInfo[0].date]);
|
|
2177
|
-
} else {
|
|
2178
|
-
setDisplayWeekForHeader([formatToEnglishMonthDay(cellsList.at(0).dateInfo[0].date), formatToEnglishMonthDay(cellsList.at(-1).dateInfo[0].date)]);
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
}, [weekOffset]);
|
|
2182
|
-
|
|
2183
|
-
useEffect(() => {
|
|
2184
|
-
|
|
2185
|
-
// update events value
|
|
2186
|
-
if (Array.isArray(eventsValue) && eventsValue.length > 0) setOrginalData(eventsValue);
|
|
2187
|
-
|
|
2188
|
-
// update current today
|
|
2189
|
-
if (typeof customTodayDate !== 'undefined' && isValidDate(customTodayDate)) {
|
|
2190
|
-
const _customNow = new Date(customTodayDate);
|
|
2191
|
-
updateTodayDate(_customNow);
|
|
2192
|
-
}
|
|
2193
|
-
|
|
2194
|
-
// Call a function when the list has been rendered completely
|
|
2195
|
-
onListRenderComplete?.();
|
|
2196
|
-
|
|
2197
|
-
}, [eventsValue, customTodayDate, appearanceMode]);
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
useEffect(() => {
|
|
2202
|
-
|
|
2203
|
-
// !!!Please do not use dependencies
|
|
2204
|
-
//--------------
|
|
2205
|
-
return () => {
|
|
2206
|
-
|
|
2207
|
-
// reset table grid
|
|
2208
|
-
tableGridReset();
|
|
2209
|
-
|
|
2210
|
-
// reset selection area
|
|
2211
|
-
setSelectedCells([]);
|
|
2212
|
-
setCopiedCells(null);
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
}, []);
|
|
2216
|
-
return (
|
|
2217
|
-
<>
|
|
2218
|
-
|
|
2219
|
-
{/*/////////////////////////////////////////////////// */}
|
|
2220
|
-
{/*//////////////////// Calendar //////////////////// */}
|
|
2221
|
-
{/*////////////////////////////////////////////////// */}
|
|
2222
|
-
|
|
2223
|
-
<div className={combinedCls(
|
|
2224
|
-
`custom-event-tl__wrapper custom-event-tl__wrapper--${appearanceMode}`,
|
|
2225
|
-
calendarWrapperClassName
|
|
2226
|
-
)}>
|
|
2227
|
-
|
|
2228
|
-
{/*++++++++++++++++ MAIN ++++++++++++++++*/}
|
|
2229
|
-
<div className="custom-event-tl__header bg-body-tertiary">
|
|
2230
|
-
<button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--prev" onClick={handlePrevChange}>
|
|
2231
|
-
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
|
|
2232
|
-
<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" />
|
|
2233
|
-
</svg>
|
|
2234
|
-
</button>
|
|
2235
|
-
|
|
2236
|
-
{/* //########## MODE: WEEK ############# */}
|
|
2237
|
-
{appearanceMode === 'week' ? <>
|
|
2238
|
-
<div className="custom-event-tl__header__info">
|
|
2239
|
-
{typeof appearanceWeekTmpl === 'function' ? <>{appearanceWeekTmpl(displayWeekForHeader[0], displayWeekForHeader[1]) as never}</> : <>{displayWeekForHeader[0]} - {displayWeekForHeader[1]}</>}
|
|
2240
|
-
</div>
|
|
2241
|
-
</> : null}
|
|
2242
|
-
{/* //########## /MODE: WEEK ############# */}
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
{/* //########## MODE: MONTH ############# */}
|
|
2246
|
-
{appearanceMode === 'month' ? <>
|
|
2247
|
-
<div className="custom-event-tl__header__btns">
|
|
2248
|
-
<button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winMonth ? 'active' : ''}`} onClick={handleShowWinMonth}>
|
|
2249
|
-
{MONTHS[month]}
|
|
2250
|
-
<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>
|
|
2251
|
-
</button>
|
|
2252
|
-
<button tabIndex={-1} type="button" className={`custom-event-tl__btn ${winYear ? 'active' : ''}`} onClick={handleShowWinYear}>
|
|
2253
|
-
{year}
|
|
2254
|
-
<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>
|
|
2255
|
-
</button>
|
|
2256
|
-
</div>
|
|
2257
|
-
</> : null}
|
|
2258
|
-
{/* //########## /MODE: MONTH ############# */}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
<button tabIndex={-1} type="button" className="custom-event-tl__btn custom-event-tl__btn--next" onClick={handleNextChange}>
|
|
2263
|
-
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="none">
|
|
2264
|
-
<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" />
|
|
2265
|
-
</svg>
|
|
2266
|
-
</button>
|
|
2267
|
-
</div>
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
<div className="custom-event-tl__body">
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
<div className="custom-event-tl__row">
|
|
2275
|
-
{/* day */}
|
|
2276
|
-
|
|
2277
|
-
{/* /day */}
|
|
2278
|
-
</div>
|
|
2279
|
-
|
|
2280
|
-
</div>
|
|
2281
|
-
{/*++++++++++++++++ /MAIN ++++++++++++++++*/}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
{/*++++++++++++++++ MONTH SELECTION TAB ++++++++++++++++*/}
|
|
2285
|
-
<div className={`custom-event-tl__month-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winMonth ? 'active' : ''}`}>
|
|
2286
|
-
<div className="custom-event-tl__month-container">
|
|
2287
|
-
{MONTHS_FULL.map((month, index) => {
|
|
2288
|
-
return <div
|
|
2289
|
-
data-month={padZero(index + 1)}
|
|
2290
|
-
className={`custom-event-tl__month ${selectedMonth === index ? ' selected' : ''}`}
|
|
2291
|
-
key={month + index}
|
|
2292
|
-
onClick={() => { handleMonthChange(index) }}
|
|
2293
|
-
>{month}</div>
|
|
2294
|
-
})}
|
|
2295
|
-
</div>
|
|
2296
|
-
</div>
|
|
2297
|
-
{/*++++++++++++++++ /MONTH SELECTION TAB ++++++++++++++++*/}
|
|
2298
|
-
|
|
2299
|
-
{/*++++++++++++++++ YEAR SELECTION TAB ++++++++++++++++*/}
|
|
2300
|
-
<div className={`custom-event-tl__year-wrapper shadow p-3 mb-5 bg-body-tertiary rounded ${winYear ? 'active' : ''}`}>
|
|
2301
|
-
<div className="custom-event-tl__year-container bg-body-tertiary">
|
|
2302
|
-
{yearsArray.map((year, index) => {
|
|
2303
|
-
return <div
|
|
2304
|
-
data-year={year}
|
|
2305
|
-
className={`custom-event-tl__year ${selectedYear === year ? ' selected' : ''}`}
|
|
2306
|
-
key={year + index}
|
|
2307
|
-
onClick={() => { handleYearChange(year) }}
|
|
2308
|
-
>{year}</div>
|
|
2309
|
-
})}
|
|
2310
|
-
</div>
|
|
2311
|
-
|
|
2312
|
-
</div>
|
|
2313
|
-
{/*++++++++++++++++ /YEAR SELECTION TAB ++++++++++++++++*/}
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
{/*++++++++++++++++ TODAY SELECTION TAB ++++++++++++++++*/}
|
|
2318
|
-
<div className="custom-event-tl__today-wrapper p-2">
|
|
2319
|
-
<button
|
|
2320
|
-
tabIndex={-1}
|
|
2321
|
-
type="button"
|
|
2322
|
-
className="custom-event-tl__btn custom-event-tl__btn--today"
|
|
2323
|
-
onClick={handleTodayChange}
|
|
2324
|
-
>
|
|
2325
|
-
{langToday || 'Today'}
|
|
2326
|
-
</button>
|
|
2327
|
-
|
|
2328
|
-
{appearanceToggle ? <>
|
|
2329
|
-
<button
|
|
2330
|
-
tabIndex={-1}
|
|
2331
|
-
type="button"
|
|
2332
|
-
className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'month' ? 'active' : ''}`}
|
|
2333
|
-
data-mode="month"
|
|
2334
|
-
onClick={handleAppearanceChange}
|
|
2335
|
-
>
|
|
2336
|
-
{langAppearanceLabelMonth || 'Month'}
|
|
2337
|
-
</button>
|
|
2338
|
-
<button
|
|
2339
|
-
tabIndex={-1}
|
|
2340
|
-
type="button"
|
|
2341
|
-
className={`custom-event-tl__btn custom-event-tl__btn--appearance ${appearanceMode === 'week' ? 'active' : ''}`}
|
|
2342
|
-
data-mode="week"
|
|
2343
|
-
onClick={handleAppearanceChange}
|
|
2344
|
-
>
|
|
2345
|
-
{langAppearanceLabelWeek || 'Week'}
|
|
2346
|
-
</button>
|
|
2347
|
-
</> : null}
|
|
2348
|
-
|
|
2349
|
-
</div>
|
|
2350
|
-
{/*++++++++++++++++ /TODAY SELECTION TAB ++++++++++++++++*/}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
</div>{/* /.custom-event-tl__wrapper */}
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
{/*/////////////////////////////////////////////////// */}
|
|
2358
|
-
{/*//////////////////// Table Grid //////////////////// */}
|
|
2359
|
-
{/*////////////////////////////////////////////////// */}
|
|
2360
|
-
{orginalData.length === 0 ? null : <>
|
|
2361
|
-
<div
|
|
2362
|
-
ref={tableGridRef}
|
|
2363
|
-
className={combinedCls(
|
|
2364
|
-
`custom-event-tl-table__timeline-table__wrapper custom-event-tl-table__timeline-table__wrapper--${appearanceMode} invisible`,
|
|
2365
|
-
tableWrapperClassName
|
|
2366
|
-
)}
|
|
2367
|
-
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
2368
|
-
onKeyPressed?.(e, selectedCells);
|
|
2369
|
-
|
|
2370
|
-
// Copy & Paste
|
|
2371
|
-
handleWrapperKeyDown(e);
|
|
2372
|
-
}}
|
|
2373
|
-
tabIndex={-1} // require "tabIndex" attribute
|
|
2374
|
-
>
|
|
2375
|
-
<table role="grid" className={combinedCls(
|
|
2376
|
-
"custom-event-tl-table__timeline-table",
|
|
2377
|
-
tableClassName
|
|
2378
|
-
)}>
|
|
2379
|
-
<colgroup>
|
|
2380
|
-
<col className="custom-event-tl-table__datagrid-header" />
|
|
2381
|
-
<col />
|
|
2382
|
-
<col />
|
|
2383
|
-
</colgroup>
|
|
2384
|
-
|
|
2385
|
-
<thead className={combinedCls(
|
|
2386
|
-
tableHeadClassName
|
|
2387
|
-
)}
|
|
2388
|
-
ref={tableGridHeaderRef}
|
|
2389
|
-
role="rowgroup"
|
|
2390
|
-
>
|
|
2391
|
-
<tr role="presentation">
|
|
2392
|
-
<th role="presentation">
|
|
2393
|
-
{/*<!--///// HEADER LEFT //////-->*/}
|
|
2394
|
-
<div className="custom-event-tl-table__timeline-header custom-event-tl-table__timeline-headertitle">
|
|
2395
|
-
|
|
2396
|
-
<table role="presentation" className="custom-event-tl-table__datagrid-header__title">
|
|
2397
|
-
<colgroup>
|
|
2398
|
-
<col />
|
|
2399
|
-
</colgroup>
|
|
2400
|
-
<thead role="presentation">
|
|
2401
|
-
<tr role="row">
|
|
2402
|
-
<th role="columnheader">
|
|
2403
|
-
<div className="custom-event-tl-table__cell-cushion custom-event-tl-table__cell-cushion-headertitle">
|
|
2404
|
-
{tableListSectionTitle || ''}
|
|
2405
|
-
</div>
|
|
2406
|
-
</th>
|
|
2407
|
-
</tr>
|
|
2408
|
-
</thead>
|
|
2409
|
-
</table>
|
|
2410
|
-
|
|
2411
|
-
</div>
|
|
2412
|
-
{/*<!--///// /HEADER LEFT //////-->*/}
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
</th>
|
|
2417
|
-
<th role="presentation" className="custom-event-tl-table__timeline-divider"><div></div></th>
|
|
2418
|
-
<th role="presentation">
|
|
2419
|
-
<div
|
|
2420
|
-
ref={scrollHeaderRef}
|
|
2421
|
-
className="custom-event-tl-table__scroller-harness custom-event-tl-table__scroller-harness--hide"
|
|
2422
|
-
data-scroll="header"
|
|
2423
|
-
onScroll={syncTableScrollHeader}
|
|
2424
|
-
>
|
|
2425
|
-
<div className="custom-event-tl-table__scroller">
|
|
2426
|
-
|
|
2427
|
-
{/*<!--///// HEADER RIGHT //////-->*/}
|
|
2428
|
-
<div className="custom-event-tl-table__timeline-header">
|
|
2429
|
-
|
|
2430
|
-
<table className="custom-event-tl-table__datagrid-header__content custom-event-tl-table__scrollgrid-sync-table" >
|
|
2431
|
-
<tbody>
|
|
2432
|
-
<tr>
|
|
2433
|
-
{generateDaysUi()}
|
|
2434
|
-
</tr>
|
|
2435
|
-
</tbody>
|
|
2436
|
-
</table>
|
|
2437
|
-
</div>
|
|
2438
|
-
{/*<!--///// /HEADER RIGHT //////-->*/}
|
|
2439
|
-
</div>
|
|
2440
|
-
</div>
|
|
2441
|
-
</th>
|
|
2442
|
-
</tr>
|
|
2443
|
-
</thead>
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
<tbody className={combinedCls(
|
|
2448
|
-
tableBodyClassName
|
|
2449
|
-
)}
|
|
2450
|
-
role="rowgroup"
|
|
2451
|
-
>
|
|
2452
|
-
<tr role="presentation" className="custom-event-tl-table__list-section">
|
|
2453
|
-
<td
|
|
2454
|
-
role="presentation"
|
|
2455
|
-
className={combinedCls(
|
|
2456
|
-
tableListStartClassName
|
|
2457
|
-
)}
|
|
2458
|
-
|
|
2459
|
-
>
|
|
2460
|
-
|
|
2461
|
-
<div
|
|
2462
|
-
ref={scrollListRef}
|
|
2463
|
-
className={combinedCls(
|
|
2464
|
-
'custom-event-tl-table__scroller-harness',
|
|
2465
|
-
{
|
|
2466
|
-
'autoscroll': AUTO_SCROLL
|
|
2467
|
-
}
|
|
2468
|
-
)}
|
|
2469
|
-
data-scroll="list"
|
|
2470
|
-
onScroll={syncTableScrollList}
|
|
2471
|
-
>
|
|
2472
|
-
<div className="custom-event-tl-table__scroller">
|
|
2473
|
-
|
|
2474
|
-
{/*<!--///// RESOURCE LEFT //////-->*/}
|
|
2475
|
-
<table role="presentation" className="custom-event-tl-table__datagrid-body__title custom-event-tl-table__scrollgrid-sync-table">
|
|
2476
|
-
<colgroup>
|
|
2477
|
-
<col />
|
|
2478
|
-
</colgroup>
|
|
2479
|
-
<tbody role="presentation">
|
|
2480
|
-
|
|
2481
|
-
{/*<!-- per row -->*/}
|
|
2482
|
-
{generateListSectionUi()}
|
|
2483
|
-
{/*<!-- /per row -->*/}
|
|
2484
|
-
|
|
2485
|
-
</tbody>
|
|
2486
|
-
</table>
|
|
2487
|
-
{/*<!--///// /RESOURCE LEFT //////-->*/}
|
|
2488
|
-
</div>
|
|
2489
|
-
</div>
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
</td>
|
|
2493
|
-
<td
|
|
2494
|
-
role="presentation"
|
|
2495
|
-
className={combinedCls(
|
|
2496
|
-
'custom-event-tl-table__timeline-divider',
|
|
2497
|
-
tableListDividerClassName
|
|
2498
|
-
)}
|
|
2499
|
-
>
|
|
2500
|
-
<div></div>
|
|
2501
|
-
</td>
|
|
2502
|
-
<td
|
|
2503
|
-
role="presentation"
|
|
2504
|
-
className={combinedCls(
|
|
2505
|
-
tableListEndClassName
|
|
2506
|
-
)}
|
|
2507
|
-
>
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
<div
|
|
2511
|
-
ref={scrollBodyRef}
|
|
2512
|
-
className={combinedCls(
|
|
2513
|
-
'custom-event-tl-table__scroller-harness',
|
|
2514
|
-
{
|
|
2515
|
-
'autoscroll': AUTO_SCROLL
|
|
2516
|
-
}
|
|
2517
|
-
)}
|
|
2518
|
-
data-scroll="body"
|
|
2519
|
-
onScroll={syncTableScrollBody}
|
|
2520
|
-
onMouseMove={BODY_DRAG ? handleTableMove : () => { }}
|
|
2521
|
-
onMouseDown={BODY_DRAG ? handleTableDragStart : () => { }}
|
|
2522
|
-
onMouseUp={BODY_DRAG ? handleTableDragEnd : () => { }}
|
|
2523
|
-
onMouseLeave={BODY_DRAG ? handleTableDragEnd : () => { }}
|
|
2524
|
-
>
|
|
2525
|
-
<div className="custom-event-tl-table__scroller">
|
|
2526
|
-
{/*<!--///// RESOURCE RIGHT //////-->*/}
|
|
2527
|
-
<div className="custom-event-tl-table__timeline-body">
|
|
2528
|
-
<table
|
|
2529
|
-
className="custom-event-tl-table__datagrid-body__content custom-event-tl-table__scrollgrid-sync-table"
|
|
2530
|
-
/* Drag to activate the selection area */
|
|
2531
|
-
onMouseLeave={multipleCells ? handleTableMainMouseUp : undefined}
|
|
2532
|
-
onMouseUp={multipleCells ? handleTableMainMouseUp : undefined}
|
|
2533
|
-
|
|
2534
|
-
>
|
|
2535
|
-
<colgroup>
|
|
2536
|
-
{generateColUi()}
|
|
2537
|
-
</colgroup>
|
|
2538
|
-
<tbody>
|
|
2539
|
-
{/*<!-- per row -->*/}
|
|
2540
|
-
{orginalData.map((item: any, i: number) => {
|
|
2541
|
-
|
|
2542
|
-
return (
|
|
2543
|
-
<tr key={i}>
|
|
2544
|
-
{generateDaysUi(item.eventSources, item.listSection, i, true)}
|
|
2545
|
-
</tr>
|
|
2546
|
-
)
|
|
2547
|
-
|
|
2548
|
-
})}
|
|
2549
|
-
|
|
2550
|
-
</tbody>
|
|
2551
|
-
</table>
|
|
2552
|
-
|
|
2553
|
-
</div>
|
|
2554
|
-
{/*<!--///// /RESOURCE RIGHT //////-->*/}
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
</div>
|
|
2558
|
-
</div>
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
</td>
|
|
2562
|
-
</tr>
|
|
2563
|
-
</tbody>
|
|
2564
|
-
</table>
|
|
2565
|
-
|
|
2566
|
-
</div>{/* /.custom-event-tl-table__timeline-table__wrapper */}
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
</>}
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
{/*/////////////////////////////////////////////////// */}
|
|
2573
|
-
{/*//////////////////// Modal //////////////////// */}
|
|
2574
|
-
{/*////////////////////////////////////////////////// */}
|
|
2575
|
-
|
|
2576
|
-
{/*++++++++++++++++ MODAL ++++++++++++++++*/}
|
|
2577
|
-
{EVENTS_ENABLED ? <>
|
|
2578
|
-
|
|
2579
|
-
{/*<!-- DELETE -->*/}
|
|
2580
|
-
<ModalDialog
|
|
2581
|
-
ref={modalDeleteHandleRef}
|
|
2582
|
-
show={showDelete}
|
|
2583
|
-
maskOpacity={modalMaskOpacity}
|
|
2584
|
-
triggerClassName=""
|
|
2585
|
-
triggerContent=""
|
|
2586
|
-
closeBtnClassName={modalCloseBtnClassName || 'btn btn-secondary'}
|
|
2587
|
-
closeBtnLabel={modalCloseBtnLabel || 'Close'}
|
|
2588
|
-
submitBtnClassName={modalSubmitDeleteBtnClassName || 'btn btn-danger'}
|
|
2589
|
-
submitBtnLabel={modalSubmitDeleteBtnLabel || <>Delete</>}
|
|
2590
|
-
onClose={(e) => {
|
|
2591
|
-
|
|
2592
|
-
setTimeout(() => {
|
|
2593
|
-
setShowDelete(false);
|
|
2594
|
-
onModalDeleteClose?.(queryItemObj());
|
|
2595
|
-
// set temporary date
|
|
2596
|
-
setTempDate('');
|
|
2597
|
-
}, 350);
|
|
2598
|
-
}}
|
|
2599
|
-
onSubmit={async (e: any, closewin: Function, data: any) => {
|
|
2600
|
-
onModalDeleteEvent?.(queryItemObj(), closewin, () => {
|
|
2601
|
-
|
|
2602
|
-
// initialize table grid
|
|
2603
|
-
setTimeout(() => {
|
|
2604
|
-
tableGridInitHeadertitle();
|
|
2605
|
-
}, 500);
|
|
2606
|
-
});
|
|
2607
|
-
}}
|
|
2608
|
-
>
|
|
2609
|
-
{modalDeleteContent || 'Are you sure?'}
|
|
2610
|
-
|
|
2611
|
-
</ModalDialog>
|
|
2612
|
-
{/*<!-- /DELETE -->*/}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
{/*<!-- EDIT -->*/}
|
|
2616
|
-
<ModalDialog
|
|
2617
|
-
ref={modalEditHandleRef}
|
|
2618
|
-
show={showEdit}
|
|
2619
|
-
maskOpacity={modalMaskOpacity}
|
|
2620
|
-
heading={modalHeading}
|
|
2621
|
-
maxWidth={modalMaxWidth}
|
|
2622
|
-
minHeight={modalMinHeight}
|
|
2623
|
-
triggerClassName=""
|
|
2624
|
-
triggerContent=""
|
|
2625
|
-
closeBtnClassName={modalCloseBtnClassName || 'btn btn-secondary'}
|
|
2626
|
-
closeBtnLabel={modalCloseBtnLabel || 'Close'}
|
|
2627
|
-
submitBtnClassName={modalSubmitBtnClassName || 'btn btn-primary'}
|
|
2628
|
-
submitBtnLabel={modalSubmitBtnLabel || <>Save</>}
|
|
2629
|
-
onClose={(e) => {
|
|
2630
|
-
|
|
2631
|
-
setTimeout(() => {
|
|
2632
|
-
setShowEdit(false);
|
|
2633
|
-
onModalEditClose?.(queryItemObj());
|
|
2634
|
-
// set temporary date
|
|
2635
|
-
setTempDate('');
|
|
2636
|
-
}, 350);
|
|
2637
|
-
}}
|
|
2638
|
-
onSubmit={async (e: any, closewin: Function, data: any) => {
|
|
2639
|
-
|
|
2640
|
-
onModalEditEvent?.(queryItemObj(), closewin, () => {
|
|
2641
|
-
// initialize table grid
|
|
2642
|
-
setTimeout(() => {
|
|
2643
|
-
tableGridInitHeadertitle();
|
|
2644
|
-
}, 500);
|
|
2645
|
-
});
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
}}
|
|
2649
|
-
>
|
|
2650
|
-
{modalContent}
|
|
2651
|
-
|
|
2652
|
-
</ModalDialog>
|
|
2653
|
-
{/*<!-- /EDIT -->*/}
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
</> : null}
|
|
2657
|
-
{/*++++++++++++++++ /MODAL ++++++++++++++++*/}
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
{/*/////////////////////////////////////////////////// */}
|
|
2662
|
-
{/*//////////////////// Table Grid Tooltip //////////////////// */}
|
|
2663
|
-
{/*////////////////////////////////////////////////// */}
|
|
2664
|
-
<RootPortal show={true} containerClassName="EventCalendarTimeline-TooltipModal">
|
|
2665
|
-
<div
|
|
2666
|
-
ref={tableTooltipModalRef}
|
|
2667
|
-
id={`custom-event-tl-table__cell-tooltipwrapper-${idRes}`}
|
|
2668
|
-
className={`custom-event-tl-table__cell-tooltipwrapper d-inline-block ${isShowTableTooltip ? 'active' : ''}`}
|
|
2669
|
-
role="tooltip"
|
|
2670
|
-
data-microtip-position={tableTooltipDirection || 'bottom'}
|
|
2671
|
-
data-microtip-size={tableTooltipSize || 'auto'}
|
|
2672
|
-
style={{ display: 'none' }}
|
|
2673
|
-
>
|
|
2674
|
-
<div className="custom-event-tl-table__cell-tooltipcontent">
|
|
2675
|
-
{tableTooltipContent}
|
|
2676
|
-
</div>
|
|
2677
|
-
</div>
|
|
2678
|
-
</RootPortal>
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
</>
|
|
2682
|
-
)
|
|
2683
|
-
};
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
export default EventCalendarTimeline;
|