@cwellt_software/cwellt-reactjs-lib 1.0.0 → 1.0.1
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/dist/assets/asset-Boimp3FS +46 -0
- package/dist/assets/asset-CIKjURuf +48 -0
- package/dist/assets/asset-DO0cv1ff +51 -0
- package/dist/assets/asset-DitoBYw6 +51 -0
- package/dist/common/classes/CwSelectList.d.ts +8 -0
- package/dist/common/classes/CwSelectList.d.ts.map +1 -0
- package/dist/common/classes/CwSelectListItems.d.ts +9 -0
- package/dist/common/classes/CwSelectListItems.d.ts.map +1 -0
- package/dist/common/functions/collections.d.ts +5 -0
- package/dist/common/functions/collections.d.ts.map +1 -0
- package/dist/common/functions/reactor.d.ts +2 -0
- package/dist/common/functions/reactor.d.ts.map +1 -0
- package/dist/common/interfaces/CwSelectListProps.d.ts +9 -0
- package/dist/common/interfaces/CwSelectListProps.d.ts.map +1 -0
- package/dist/components/control/action/button/CwButton.d.ts +7 -0
- package/dist/components/control/action/button/CwButton.d.ts.map +1 -0
- package/dist/components/control/action/buttons/CwButtons.d.ts +326 -0
- package/dist/components/control/action/buttons/CwButtons.d.ts.map +1 -0
- package/dist/components/control/action/contextmenu/CwContextMenu.d.ts +33 -0
- package/dist/components/control/action/contextmenu/CwContextMenu.d.ts.map +1 -0
- package/dist/components/control/action/search/CwSearch.d.ts +18 -0
- package/dist/components/control/action/search/CwSearch.d.ts.map +1 -0
- package/dist/components/control/action/tooltip-dialog/CwTooltipDialog.d.ts +21 -0
- package/dist/components/control/action/tooltip-dialog/CwTooltipDialog.d.ts.map +1 -0
- package/dist/components/control/choice/checkbox/CwCheckbox.d.ts +19 -0
- package/dist/components/control/choice/checkbox/CwCheckbox.d.ts.map +1 -0
- package/dist/components/control/choice/deprecated/MultiSelect_deprecated_.d.ts +24 -0
- package/dist/components/control/choice/deprecated/MultiSelect_deprecated_.d.ts.map +1 -0
- package/dist/components/control/choice/dropdown/CwDropdown.d.ts +21 -0
- package/dist/components/control/choice/dropdown/CwDropdown.d.ts.map +1 -0
- package/dist/components/control/choice/dropdown/CwDropdownContainer.d.ts +19 -0
- package/dist/components/control/choice/dropdown/CwDropdownContainer.d.ts.map +1 -0
- package/dist/components/control/choice/dropdown/CwDropdownFilter.d.ts +32 -0
- package/dist/components/control/choice/dropdown/CwDropdownFilter.d.ts.map +1 -0
- package/dist/components/control/choice/dropdown/CwDropdownNavigation.d.ts +23 -0
- package/dist/components/control/choice/dropdown/CwDropdownNavigation.d.ts.map +1 -0
- package/dist/components/control/choice/multi-filter/CwMultiFilter.d.ts +68 -0
- package/dist/components/control/choice/multi-filter/CwMultiFilter.d.ts.map +1 -0
- package/dist/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts +34 -0
- package/dist/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts.map +1 -0
- package/dist/components/control/choice/multiselect/CwHeadFilter.d.ts +18 -0
- package/dist/components/control/choice/multiselect/CwHeadFilter.d.ts.map +1 -0
- package/dist/components/control/choice/multiselect/CwMultiselect.d.ts +15 -0
- package/dist/components/control/choice/multiselect/CwMultiselect.d.ts.map +1 -0
- package/dist/components/control/choice/multiselect/CwOptionList.d.ts +17 -0
- package/dist/components/control/choice/multiselect/CwOptionList.d.ts.map +1 -0
- package/dist/components/control/choice/option/CwOption.d.ts +17 -0
- package/dist/components/control/choice/option/CwOption.d.ts.map +1 -0
- package/dist/components/control/choice/select/CwSelect.d.ts +49 -0
- package/dist/components/control/choice/select/CwSelect.d.ts.map +1 -0
- package/dist/components/control/choice/toggle/CwToggle.d.ts +36 -0
- package/dist/components/control/choice/toggle/CwToggle.d.ts.map +1 -0
- package/dist/components/control/input/any/CwInput.d.ts +19 -0
- package/dist/components/control/input/any/CwInput.d.ts.map +1 -0
- package/dist/components/control/input/chipper/CwChip.d.ts +16 -0
- package/dist/components/control/input/chipper/CwChip.d.ts.map +1 -0
- package/dist/components/control/input/date/CwInputDate.d.ts +40 -0
- package/dist/components/control/input/date/CwInputDate.d.ts.map +1 -0
- package/dist/components/control/input/date-picker/CwInputDatePicker.d.ts +7 -0
- package/dist/components/control/input/date-picker/CwInputDatePicker.d.ts.map +1 -0
- package/dist/components/control/input/date-text/CwInputDateText.d.ts +39 -0
- package/dist/components/control/input/date-text/CwInputDateText.d.ts.map +1 -0
- package/dist/components/control/input/datetime/CwInputDatetime.d.ts +40 -0
- package/dist/components/control/input/datetime/CwInputDatetime.d.ts.map +1 -0
- package/dist/components/control/input/digit/CwDigit.d.ts +40 -0
- package/dist/components/control/input/digit/CwDigit.d.ts.map +1 -0
- package/dist/components/control/input/file/CwFileUpload.d.ts +20 -0
- package/dist/components/control/input/file/CwFileUpload.d.ts.map +1 -0
- package/dist/components/control/input/image/CwInputImage.d.ts +11 -0
- package/dist/components/control/input/image/CwInputImage.d.ts.map +1 -0
- package/dist/components/control/input/image-area/CwImageArea.d.ts +58 -0
- package/dist/components/control/input/image-area/CwImageArea.d.ts.map +1 -0
- package/dist/components/control/input/number/CwInputNumber.d.ts +22 -0
- package/dist/components/control/input/number/CwInputNumber.d.ts.map +1 -0
- package/dist/components/control/input/phone/CwInputPhone.d.ts +36 -0
- package/dist/components/control/input/phone/CwInputPhone.d.ts.map +1 -0
- package/dist/components/control/input/text/CwInputText.d.ts +40 -0
- package/dist/components/control/input/text/CwInputText.d.ts.map +1 -0
- package/dist/components/control/input/text-area/CwTextArea.d.ts +25 -0
- package/dist/components/control/input/text-area/CwTextArea.d.ts.map +1 -0
- package/dist/components/control/input/time/CwTime.d.ts +40 -0
- package/dist/components/control/input/time/CwTime.d.ts.map +1 -0
- package/dist/components/custom/find-airport/CwFindAirportComp.d.ts +32 -0
- package/dist/components/custom/find-airport/CwFindAirportComp.d.ts.map +1 -0
- package/dist/components/custom/scheduler/CwSchedulerComp.d.ts +39 -0
- package/dist/components/custom/scheduler/CwSchedulerComp.d.ts.map +1 -0
- package/dist/components/custom/scheduler/CwSuperSchedulerComp.d.ts +101 -0
- package/dist/components/custom/scheduler/CwSuperSchedulerComp.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/ClearSchedulerButton.d.ts +7 -0
- package/dist/components/custom/scheduler/components/ClearSchedulerButton.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/EventRender.d.ts +3 -0
- package/dist/components/custom/scheduler/components/EventRender.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/ResourceListRender.d.ts +17 -0
- package/dist/components/custom/scheduler/components/ResourceListRender.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/ResourceRender.d.ts +15 -0
- package/dist/components/custom/scheduler/components/ResourceRender.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/day_headers/DayHeader.d.ts +10 -0
- package/dist/components/custom/scheduler/components/day_headers/DayHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/day_headers/MonthHeader.d.ts +10 -0
- package/dist/components/custom/scheduler/components/day_headers/MonthHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/day_headers/MyDaysHeader.d.ts +10 -0
- package/dist/components/custom/scheduler/components/day_headers/MyDaysHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/day_headers/WeekHeader.d.ts +10 -0
- package/dist/components/custom/scheduler/components/day_headers/WeekHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/resources_title_list/ResourcesTitleList.d.ts +14 -0
- package/dist/components/custom/scheduler/components/resources_title_list/ResourcesTitleList.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/scheduler_content_area/SchedulerContentArea.d.ts +24 -0
- package/dist/components/custom/scheduler/components/scheduler_content_area/SchedulerContentArea.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/scheduler_header/SchedulerHeader.d.ts +8 -0
- package/dist/components/custom/scheduler/components/scheduler_header/SchedulerHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.d.ts +11 -0
- package/dist/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/time_headers/TimeHeader.d.ts +11 -0
- package/dist/components/custom/scheduler/components/time_headers/TimeHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/time_headers/TimeHeaderRow.d.ts +10 -0
- package/dist/components/custom/scheduler/components/time_headers/TimeHeaderRow.d.ts.map +1 -0
- package/dist/components/custom/scheduler/components/time_line/TimeLine.d.ts +7 -0
- package/dist/components/custom/scheduler/components/time_line/TimeLine.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/addMinutesToDateFromPx.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/dates/addMinutesToDateFromPx.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDates.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDates.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/getFormatedTimeForHeader.d.ts +11 -0
- package/dist/components/custom/scheduler/logic/dates/getFormatedTimeForHeader.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/getMonthHeaderData.d.ts +10 -0
- package/dist/components/custom/scheduler/logic/dates/getMonthHeaderData.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/getUtcToday.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/dates/getUtcToday.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/getWeekHeaderDataFromWeekRange.d.ts +11 -0
- package/dist/components/custom/scheduler/logic/dates/getWeekHeaderDataFromWeekRange.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/dates/listOfDatesToWeeks.d.ts +8 -0
- package/dist/components/custom/scheduler/logic/dates/listOfDatesToWeeks.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisionType.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisionType.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisions.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisions.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/filtering/filterAndProcessResources.d.ts +19 -0
- package/dist/components/custom/scheduler/logic/filtering/filterAndProcessResources.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/filtering/filterEvents.d.ts +10 -0
- package/dist/components/custom/scheduler/logic/filtering/filterEvents.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/filtering/filterResources.d.ts +10 -0
- package/dist/components/custom/scheduler/logic/filtering/filterResources.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/filtering/hasSameProperties.d.ts +3 -0
- package/dist/components/custom/scheduler/logic/filtering/hasSameProperties.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/onDrop/OnDrop.d.ts +14 -0
- package/dist/components/custom/scheduler/logic/onDrop/OnDrop.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/pixels/calculateMaxPxFromDateRange.d.ts +7 -0
- package/dist/components/custom/scheduler/logic/pixels/calculateMaxPxFromDateRange.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/pixels/getPixelsForEvent.d.ts +8 -0
- package/dist/components/custom/scheduler/logic/pixels/getPixelsForEvent.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/pixels/heightScheduler.d.ts +6 -0
- package/dist/components/custom/scheduler/logic/pixels/heightScheduler.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/pixels/heightSchedulerPinned.d.ts +6 -0
- package/dist/components/custom/scheduler/logic/pixels/heightSchedulerPinned.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/state_handle/handleDateChange.d.ts +10 -0
- package/dist/components/custom/scheduler/logic/state_handle/handleDateChange.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/state_handle/handlePropChanges.d.ts +11 -0
- package/dist/components/custom/scheduler/logic/state_handle/handlePropChanges.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/state_handle/handleResourceChange.d.ts +10 -0
- package/dist/components/custom/scheduler/logic/state_handle/handleResourceChange.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/strings/compareStrings.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/strings/compareStrings.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/strings/getGUID.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/strings/getGUID.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/ui/checkIfSlotAvailable.d.ts +3 -0
- package/dist/components/custom/scheduler/logic/ui/checkIfSlotAvailable.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/ui/getEventsOfResource.d.ts +13 -0
- package/dist/components/custom/scheduler/logic/ui/getEventsOfResource.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/ui/getHasPropsChanged.d.ts +8 -0
- package/dist/components/custom/scheduler/logic/ui/getHasPropsChanged.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/ui/getTimeHeaders.d.ts +2 -0
- package/dist/components/custom/scheduler/logic/ui/getTimeHeaders.d.ts.map +1 -0
- package/dist/components/custom/scheduler/logic/ui/isAllowedToMove.d.ts +3 -0
- package/dist/components/custom/scheduler/logic/ui/isAllowedToMove.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/CblDragAndDrop.d.ts +19 -0
- package/dist/components/custom/scheduler/state/CblDragAndDrop.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/CwSchedulerProps.d.ts +48 -0
- package/dist/components/custom/scheduler/state/CwSchedulerProps.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/EventProps.d.ts +7 -0
- package/dist/components/custom/scheduler/state/EventProps.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/Resource.d.ts +14 -0
- package/dist/components/custom/scheduler/state/Resource.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/State.d.ts +25 -0
- package/dist/components/custom/scheduler/state/State.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/cblEvent.d.ts +26 -0
- package/dist/components/custom/scheduler/state/cblEvent.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/cblEventCompProps.d.ts +7 -0
- package/dist/components/custom/scheduler/state/cblEventCompProps.d.ts.map +1 -0
- package/dist/components/custom/scheduler/state/resourceCompProps2.d.ts +6 -0
- package/dist/components/custom/scheduler/state/resourceCompProps2.d.ts.map +1 -0
- package/dist/components/display/data/accordion/CwAccordionContainer.d.ts +16 -0
- package/dist/components/display/data/accordion/CwAccordionContainer.d.ts.map +1 -0
- package/dist/components/display/data/table/CwTable.d.ts +130 -0
- package/dist/components/display/data/table/CwTable.d.ts.map +1 -0
- package/dist/components/display/graphics/icon/CwIcon.d.ts +14 -0
- package/dist/components/display/graphics/icon/CwIcon.d.ts.map +1 -0
- package/dist/components/display/graphics/loading/CwLoading.d.ts +19 -0
- package/dist/components/display/graphics/loading/CwLoading.d.ts.map +1 -0
- package/dist/components/display/graphics/loading-small/CwLoadingSmall.d.ts +8 -0
- package/dist/components/display/graphics/loading-small/CwLoadingSmall.d.ts.map +1 -0
- package/dist/components/display/text/heading/CwHeadingMain.d.ts +5 -0
- package/dist/components/display/text/heading/CwHeadingMain.d.ts.map +1 -0
- package/dist/components/display/text/heading/CwHeadingSecond.d.ts +5 -0
- package/dist/components/display/text/heading/CwHeadingSecond.d.ts.map +1 -0
- package/dist/components/display/text/label/CwLabel.d.ts +28 -0
- package/dist/components/display/text/label/CwLabel.d.ts.map +1 -0
- package/dist/components/display/text/message/CwMessage.d.ts +31 -0
- package/dist/components/display/text/message/CwMessage.d.ts.map +1 -0
- package/dist/components/display/text/tag/CwTag.d.ts +16 -0
- package/dist/components/display/text/tag/CwTag.d.ts.map +1 -0
- package/dist/components/display/text/tooltip/CwTooltip.d.ts +10 -0
- package/dist/components/display/text/tooltip/CwTooltip.d.ts.map +1 -0
- package/dist/components/layout/align/CwAlign.d.ts +53 -0
- package/dist/components/layout/align/CwAlign.d.ts.map +1 -0
- package/dist/components/layout/list/details/CwExpandable.d.ts +23 -0
- package/dist/components/layout/list/details/CwExpandable.d.ts.map +1 -0
- package/dist/components/layout/modal/hover/CwModalHover.d.ts +19 -0
- package/dist/components/layout/modal/hover/CwModalHover.d.ts.map +1 -0
- package/dist/components/layout/modal/legacy/cw_modal.d.ts +24 -0
- package/dist/components/layout/modal/legacy/cw_modal.d.ts.map +1 -0
- package/dist/components/layout/modal/legacy/cw_modal_confirm.d.ts +19 -0
- package/dist/components/layout/modal/legacy/cw_modal_confirm.d.ts.map +1 -0
- package/dist/components/layout/modal/legacy/cw_modal_iframe.d.ts +21 -0
- package/dist/components/layout/modal/legacy/cw_modal_iframe.d.ts.map +1 -0
- package/dist/components/layout/modal/legacy/cw_modal_report.d.ts +35 -0
- package/dist/components/layout/modal/legacy/cw_modal_report.d.ts.map +1 -0
- package/dist/components/layout/table/grouped/CwTableGrouped.d.ts +80 -0
- package/dist/components/layout/table/grouped/CwTableGrouped.d.ts.map +1 -0
- package/dist/components/layout/tabs/CwTabs.d.ts +37 -0
- package/dist/components/layout/tabs/CwTabs.d.ts.map +1 -0
- package/dist/content/icons/new-cw-icons/NewCwIcons.html +2 -2
- package/dist/content/icons/new-cw-icons/NewCwIcons.json +1 -1
- package/dist/content/icons/new-cw-icons/css/new-cw-icons.css +3 -1
- package/dist/content/icons/new-cw-icons/fonts/NewCwIcons.woff +0 -0
- package/dist/index.cjs.js +687 -514
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +2 -4
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +206 -192
- package/dist/index.es.js +688 -515
- package/dist/index.es.js.map +1 -0
- package/dist/index.esm.js +621 -693
- package/dist/index.esm.js.map +1 -0
- package/dist/src/common/functions/colorManipulation.d.ts +6 -0
- package/dist/src/common/functions/colorManipulation.d.ts.map +1 -0
- package/dist/src/common/functions/reactor.d.ts +0 -1
- package/dist/src/common/functions/useSingleAndDoubleClicks.d.ts.map +1 -1
- package/dist/src/components/control/action/button/CwButton.d.ts +1 -1
- package/dist/src/components/control/action/button/CwButton.d.ts.map +1 -1
- package/dist/src/components/control/choice/multi-filter/CwMultiFilter.d.ts +5 -5
- package/dist/src/components/control/choice/option/CwOption.d.ts +1 -1
- package/dist/src/components/control/choice/option/CwOption.d.ts.map +1 -1
- package/dist/src/components/control/choice/select/CwSelect.d.ts +11 -11
- package/dist/src/components/control/choice/select/CwSelect.d.ts.map +1 -1
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts +8 -8
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts.map +1 -1
- package/dist/src/components/control/input/chipper/CwChip.d.ts +4 -4
- package/dist/src/components/control/input/chipper/CwChip.d.ts.map +1 -1
- package/dist/src/components/control/input/date/CwInputDate.d.ts +11 -11
- package/dist/src/components/control/input/date/CwInputDate.d.ts.map +1 -1
- package/dist/src/components/control/input/date-text/CwInputDateText.d.ts +8 -8
- package/dist/src/components/control/input/date-text/CwInputDateText.d.ts.map +1 -1
- package/dist/src/components/control/input/datetime/CwInputDatetime.d.ts +11 -11
- package/dist/src/components/control/input/datetime/CwInputDatetime.d.ts.map +1 -1
- package/dist/src/components/control/input/digit/CwDigit.d.ts +11 -11
- package/dist/src/components/control/input/digit/CwDigit.d.ts.map +1 -1
- package/dist/src/components/control/input/file/CwFileUpload.d.ts.map +1 -1
- package/dist/src/components/control/input/image/CwInputImage.d.ts +1 -1
- package/dist/src/components/control/input/image/CwInputImage.d.ts.map +1 -1
- package/dist/src/components/control/input/image-area/CwImageArea.d.ts +7 -7
- package/dist/src/components/control/input/image-area/CwImageArea.d.ts.map +1 -1
- package/dist/src/components/control/input/phone/CwInputPhone.d.ts +9 -9
- package/dist/src/components/control/input/phone/CwInputPhone.d.ts.map +1 -1
- package/dist/src/components/control/input/text/CwInputText.d.ts +11 -11
- package/dist/src/components/control/input/text/CwInputText.d.ts.map +1 -1
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts +9 -9
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts.map +1 -1
- package/dist/src/components/control/input/time/CwTime.d.ts +11 -11
- package/dist/src/components/control/input/time/CwTime.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/CwSchedulerComp.d.ts +1 -0
- package/dist/src/components/custom/scheduler/CwSchedulerComp.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/components/ClearSchedulerButton.d.ts +2 -2
- package/dist/src/components/custom/scheduler/logic/filtering/filterAndProcessResources.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/pixels/calculateMaxPxFromDateRange.d.ts +0 -1
- package/dist/src/components/custom/scheduler/logic/state_handle/handleDateChange.d.ts +0 -1
- package/dist/src/components/custom/scheduler/logic/state_handle/handlePropChanges.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/getHasPropsChanged.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/shouldTriggerScroll.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/state/EventProps.d.ts +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts +6 -4
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/SchedulerPresenter.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/SchedulerPresenter.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderDivision.d.ts +4 -0
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderDivision.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderTitle.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/HeaderTitle.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/SchedulerHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/SchedulerHeaderState.d.ts +3 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/header/SchedulerHeaderState.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgrounEvent.d.ts +7 -0
- package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgrounEvent.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.d.ts +2 -3
- package/dist/src/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.d.ts +3 -3
- package/dist/src/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts +4 -2
- package/dist/src/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts +2 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/TimeLine.d.ts +3 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/TimeLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/WeekEndLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/helpers.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/getDefaultDivisions.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/separateEventsToInnerRows.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/sortByCategoryAndTitle.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/sortByCategoryAndTitle.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/external/Event.d.ts +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/external/Row.d.ts +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/EventSideDragState.d.ts +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerEventState.d.ts +3 -2
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerHeaderState.d.ts +2 -5
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerHeaderState.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerRow.d.ts +0 -1
- package/dist/src/components/custom/scheduler-temporal/CwSchedulerComp2.d.ts +5 -0
- package/dist/src/components/custom/scheduler-temporal/CwSchedulerComp2.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts +5 -5
- package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts.map +1 -1
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts +3 -2
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts.map +1 -1
- package/dist/src/components/display/graphics/icon/CwIcon.d.ts +2 -2
- package/dist/src/components/display/graphics/icon/CwIcon.d.ts.map +1 -1
- package/dist/src/components/display/text/label/CwLabel.d.ts +9 -9
- package/dist/src/components/display/text/label/CwLabel.d.ts.map +1 -1
- package/dist/src/components/display/text/message/CwMessage.d.ts +5 -5
- package/dist/src/components/display/text/message/CwMessage.d.ts.map +1 -1
- package/dist/src/components/layout/align/CwAlign.d.ts +24 -24
- package/dist/src/components/layout/align/CwAlign.d.ts.map +1 -1
- package/dist/src/components/layout/dialog/CwDialog.d.ts +8 -8
- package/dist/src/components/layout/dialog/CwDialog.d.ts.map +1 -1
- package/dist/src/components/layout/list/details/CwExpandable.d.ts +9 -9
- package/dist/src/components/layout/list/details/CwExpandable.d.ts.map +1 -1
- package/dist/src/components/layout/modal/hover/CwModalHover.d.ts +5 -5
- package/dist/src/components/layout/modal/hover/CwModalHover.d.ts.map +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/test/components/custom/scheduler/calculateMaxPxFromDateRange.test.d.ts +0 -1
- package/package.json +2 -2
- package/dist/src/components/custom/scheduler-new/presentation/TestScheduler.d.ts +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/cancellablePromise.d.ts +0 -7
- package/dist/src/components/custom/scheduler-new/presentation/components/row/cancellablePromise.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/components/row/useCancellablePromise.d.ts +0 -7
- package/dist/src/components/custom/scheduler-new/presentation/components/row/useCancellablePromise.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/separateEventsByResource.d.ts +0 -5
- package/dist/src/components/custom/scheduler-new/presentation/logic/separateEventsByResource.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/external/Event.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/external/Row.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/EventSideDragState.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerEventState.d.ts.map +0 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerRow.d.ts.map +0 -1
- package/dist/test/components/custom/newScheduler/presentation/logic/getDefaultDivisions.test.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useEffect, useState, useRef, useMemo, forwardRef, useImperativeHandle,
|
|
3
|
+
import React__default, { useEffect, useState, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, createElement, memo, Fragment, Component } from 'react';
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
5
6
|
import { Tooltip, Modal, InputNumber, Select, Tag, Dropdown, Menu } from 'antd';
|
|
6
7
|
import Draggable from 'react-draggable';
|
|
7
8
|
import moment from 'moment';
|
|
@@ -50,12 +51,12 @@ function CwHeadingSecond(props) {
|
|
|
50
51
|
* General purpose aligner flex container, useful for column or row view.
|
|
51
52
|
* @remarks
|
|
52
53
|
* ```txt
|
|
53
|
-
*
|
|
54
|
+
* flexDirection="row" (default):
|
|
54
55
|
*
|
|
55
56
|
* <Row A> | - item 1 - item 2 - item 3 |
|
|
56
57
|
* <Row B> | - item 1 - item 2 - item 3 |
|
|
57
58
|
*
|
|
58
|
-
*
|
|
59
|
+
* flexDirection="column":
|
|
59
60
|
*
|
|
60
61
|
* <Col A> <Col B>
|
|
61
62
|
* | - item 1 | - item 1 |
|
|
@@ -64,7 +65,7 @@ function CwHeadingSecond(props) {
|
|
|
64
65
|
*
|
|
65
66
|
* ```
|
|
66
67
|
* @example
|
|
67
|
-
* <CwAlign
|
|
68
|
+
* <CwAlign flexDirection="column">
|
|
68
69
|
* <div>
|
|
69
70
|
* <h2>ColumnA</h2>
|
|
70
71
|
* </div>
|
|
@@ -74,29 +75,29 @@ function CwHeadingSecond(props) {
|
|
|
74
75
|
* </CwAlign>
|
|
75
76
|
*/
|
|
76
77
|
function CwAlign(props) {
|
|
77
|
-
const {
|
|
78
|
+
const { alignContent, alignItems, alignSelf, bottom, display, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, cssHeight, justifyContent, left, margin, order, padding, position, right, top, cssWidth, gap, ...divProps } = props;
|
|
78
79
|
return (jsx("div", { className: "cw-align", ...divProps, style: {
|
|
79
|
-
alignContent:
|
|
80
|
-
alignItems:
|
|
81
|
-
alignSelf:
|
|
82
|
-
bottom:
|
|
83
|
-
display:
|
|
84
|
-
flexBasis:
|
|
85
|
-
flexDirection:
|
|
86
|
-
flexGrow:
|
|
87
|
-
flexShrink:
|
|
88
|
-
flexWrap:
|
|
89
|
-
height:
|
|
90
|
-
justifyContent:
|
|
91
|
-
left:
|
|
92
|
-
margin:
|
|
93
|
-
order:
|
|
94
|
-
padding:
|
|
95
|
-
position:
|
|
96
|
-
right:
|
|
97
|
-
top:
|
|
98
|
-
width:
|
|
99
|
-
gap:
|
|
80
|
+
alignContent: alignContent,
|
|
81
|
+
alignItems: alignItems,
|
|
82
|
+
alignSelf: alignSelf,
|
|
83
|
+
bottom: bottom,
|
|
84
|
+
display: display ?? "flex",
|
|
85
|
+
flexBasis: flexBasis,
|
|
86
|
+
flexDirection: flexDirection,
|
|
87
|
+
flexGrow: flexGrow,
|
|
88
|
+
flexShrink: flexShrink,
|
|
89
|
+
flexWrap: flexWrap,
|
|
90
|
+
height: cssHeight,
|
|
91
|
+
justifyContent: justifyContent,
|
|
92
|
+
left: left,
|
|
93
|
+
margin: margin,
|
|
94
|
+
order: order,
|
|
95
|
+
padding: padding,
|
|
96
|
+
position: position,
|
|
97
|
+
right: right,
|
|
98
|
+
top: top,
|
|
99
|
+
width: cssWidth,
|
|
100
|
+
gap: gap
|
|
100
101
|
}, children: props.children }));
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -104,12 +105,12 @@ function CwAlign(props) {
|
|
|
104
105
|
* Label for form controls.
|
|
105
106
|
* @example
|
|
106
107
|
* ```tsx
|
|
107
|
-
* <CwLabelForm
|
|
108
|
+
* <CwLabelForm justify="right" >Username:</CwLabelForm>
|
|
108
109
|
* ```
|
|
109
110
|
*/
|
|
110
111
|
function CwLabel(props) {
|
|
111
|
-
const {
|
|
112
|
-
return (jsx("span", { className: "cw-label", children: jsx(CwAlign, {
|
|
112
|
+
const { justify, text, labelHeight, labelWidth, alignProps, margin, ...labelProps } = props;
|
|
113
|
+
return (jsx("span", { className: "cw-label", children: jsx(CwAlign, { ...alignProps, children: jsx("label", { style: { textAlign: justify, width: labelWidth, height: labelHeight, margin: margin ?? "1px 0 0 0" }, ...labelProps, children: labelProps.children ?? text }) }) }));
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
function CwTooltip(CwelltTooltipProps) {
|
|
@@ -142,11 +143,12 @@ function CwTag(tagProps) {
|
|
|
142
143
|
/**
|
|
143
144
|
* An icon from fontawesome4. Find them here: [fontawesome.com/v4](https://fontawesome.com/v4/icons/)
|
|
144
145
|
* @example
|
|
145
|
-
* <CwIcon
|
|
146
|
+
* <CwIcon id="house" />
|
|
146
147
|
*/
|
|
147
148
|
function CwIcon(props) {
|
|
149
|
+
const { iconId, ...iconProps } = props;
|
|
148
150
|
// if you wrap this inside a div I WILL find you 🔪
|
|
149
|
-
return jsx("i", { ...
|
|
151
|
+
return jsx("i", { ...iconProps, className: `fa fa-${iconId}` });
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
const CW_DEFAULT_MESSAGE_DURATION = 2000;
|
|
@@ -160,27 +162,27 @@ var CwMessageType;
|
|
|
160
162
|
const CwMessage = props => {
|
|
161
163
|
useEffect(() => {
|
|
162
164
|
const timer = setTimeout(() => {
|
|
163
|
-
props
|
|
164
|
-
}, props
|
|
165
|
+
props.onClose?.();
|
|
166
|
+
}, props.duration ?? CW_DEFAULT_MESSAGE_DURATION);
|
|
165
167
|
return () => clearTimeout(timer);
|
|
166
168
|
}, [props]);
|
|
167
|
-
return (jsx("div", { className: "cw-message", "data-message-type": Object.keys(CwMessageType).find(key => CwMessageType[key] === props
|
|
169
|
+
return (jsx("div", { className: "cw-message", "data-message-type": Object.keys(CwMessageType).find(key => CwMessageType[key] === props.messageType), children: jsxs(CwAlign, { justifyContent: "center", alignItems: "center", children: [props.messageType && jsx(CwIcon, { iconId: props.messageType.toString() }), props.message] }) }));
|
|
168
170
|
};
|
|
169
171
|
const useCwMessage = () => {
|
|
170
172
|
const [isVisible, setIsVisible] = useState(false);
|
|
171
173
|
const [message, setMessage] = useState("");
|
|
172
174
|
const [duration, setDuration] = useState();
|
|
173
175
|
const [type, setType] = useState();
|
|
174
|
-
const showMessage = (
|
|
175
|
-
setMessage(
|
|
176
|
-
setDuration(
|
|
177
|
-
setType(
|
|
176
|
+
const showMessage = (props) => {
|
|
177
|
+
setMessage(props.message);
|
|
178
|
+
setDuration(props.duration);
|
|
179
|
+
setType(props.messageType);
|
|
178
180
|
setIsVisible(true);
|
|
179
181
|
};
|
|
180
182
|
const closeMessage = () => {
|
|
181
183
|
setIsVisible(false);
|
|
182
184
|
};
|
|
183
|
-
const RenderMessage = isVisible ? (jsx(CwMessage, {
|
|
185
|
+
const RenderMessage = isVisible ? (jsx(CwMessage, { message: message, duration: duration, messageType: type, onClose: closeMessage })) : null;
|
|
184
186
|
return { showMessage, RenderMessage };
|
|
185
187
|
};
|
|
186
188
|
class CwMessageManager {
|
|
@@ -210,7 +212,7 @@ class CwMessageManager {
|
|
|
210
212
|
const msg = document.createElement("div");
|
|
211
213
|
this.messageContainer?.prepend(msg);
|
|
212
214
|
const msgRoot = createRoot(msg); // Create a root for the new message
|
|
213
|
-
msgRoot.render(jsx(CwMessage, {
|
|
215
|
+
msgRoot.render(jsx(CwMessage, { message: message, messageType: type, duration: duration, onClose: () => this.closeMessage(msgRoot) }));
|
|
214
216
|
}
|
|
215
217
|
closeMessage(msgRoot) {
|
|
216
218
|
msgRoot.unmount(); // Unmount the message root
|
|
@@ -243,14 +245,136 @@ function CwLoadingSmall(CwelltLoadingAppointements) {
|
|
|
243
245
|
jsx("div", { className: "cwellt_d_none" })) }));
|
|
244
246
|
}
|
|
245
247
|
|
|
246
|
-
var styles$
|
|
248
|
+
var styles$a = {"cw-generic-tooltip":"cw-generic-tooltip-module_cw-generic-tooltip__Ij76M","cw-generic-tooltip-content":"cw-generic-tooltip-module_cw-generic-tooltip-content__la-Si"};
|
|
247
249
|
|
|
248
|
-
|
|
250
|
+
// Constants moved outside to prevent recreation
|
|
251
|
+
const margin = 16;
|
|
252
|
+
const defaultPosition = "right";
|
|
253
|
+
const positionOrder = ['right', 'bottom', 'left', 'top'];
|
|
254
|
+
// Memoized utility functions to prevent recreation
|
|
255
|
+
const calculatePositionForSide = (position, triggerRect, tooltipRect) => {
|
|
256
|
+
switch (position) {
|
|
257
|
+
case 'left':
|
|
258
|
+
return {
|
|
259
|
+
top: triggerRect.top + (triggerRect.height - tooltipRect.height) / 2,
|
|
260
|
+
left: triggerRect.left - tooltipRect.width - margin
|
|
261
|
+
};
|
|
262
|
+
case 'right':
|
|
263
|
+
return {
|
|
264
|
+
top: triggerRect.top + (triggerRect.height - tooltipRect.height) / 2,
|
|
265
|
+
left: triggerRect.right + margin
|
|
266
|
+
};
|
|
267
|
+
case 'top':
|
|
268
|
+
return {
|
|
269
|
+
top: triggerRect.top - tooltipRect.height - margin,
|
|
270
|
+
left: triggerRect.left + (triggerRect.width - tooltipRect.width) / 2
|
|
271
|
+
};
|
|
272
|
+
case 'bottom':
|
|
273
|
+
return {
|
|
274
|
+
top: triggerRect.bottom + margin,
|
|
275
|
+
left: triggerRect.left + (triggerRect.width - tooltipRect.width) / 2
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
// Optimized hooks
|
|
280
|
+
const useTooltipDelay = (callback, delay) => {
|
|
281
|
+
const timeoutRef = useRef();
|
|
282
|
+
const clearTooltipTimeout = useCallback(() => {
|
|
283
|
+
if (timeoutRef.current) {
|
|
284
|
+
window.clearTimeout(timeoutRef.current);
|
|
285
|
+
timeoutRef.current = undefined;
|
|
286
|
+
}
|
|
287
|
+
}, []);
|
|
288
|
+
const setTooltipTimeout = useCallback(() => {
|
|
289
|
+
clearTooltipTimeout();
|
|
290
|
+
if (delay) {
|
|
291
|
+
timeoutRef.current = window.setTimeout(callback, delay);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
callback();
|
|
295
|
+
}
|
|
296
|
+
}, [callback, delay, clearTooltipTimeout]);
|
|
297
|
+
useEffect(() => clearTooltipTimeout, [clearTooltipTimeout]);
|
|
298
|
+
return { setTooltipTimeout, clearTooltipTimeout };
|
|
299
|
+
};
|
|
300
|
+
const useTooltipPosition = (isVisible, containerRef, preferredPosition, tooltipClassName) => {
|
|
301
|
+
const [tooltipState, setTooltipState] = useState({
|
|
302
|
+
position: { top: 0, left: 0 },
|
|
303
|
+
actualPosition: preferredPosition
|
|
304
|
+
});
|
|
305
|
+
const frameRef = useRef();
|
|
306
|
+
const updatePosition = useCallback(() => {
|
|
307
|
+
if (!isVisible || !containerRef.current)
|
|
308
|
+
return;
|
|
309
|
+
const tooltipElement = document.querySelector(`.${tooltipClassName}`);
|
|
310
|
+
if (!tooltipElement)
|
|
311
|
+
return;
|
|
312
|
+
const triggerRect = containerRef.current.getBoundingClientRect();
|
|
313
|
+
const tooltipRect = tooltipElement.getBoundingClientRect();
|
|
314
|
+
// Try preferred position first
|
|
315
|
+
const position = calculatePositionForSide(preferredPosition, triggerRect, tooltipRect);
|
|
316
|
+
const windowWidth = window.innerWidth;
|
|
317
|
+
const windowHeight = window.innerHeight;
|
|
318
|
+
// Quick bounds check
|
|
319
|
+
if (position.left >= margin &&
|
|
320
|
+
position.top >= margin &&
|
|
321
|
+
position.left + tooltipRect.width <= windowWidth - margin &&
|
|
322
|
+
position.top + tooltipRect.height <= windowHeight - margin) {
|
|
323
|
+
setTooltipState({ position, actualPosition: preferredPosition });
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// Try other positions if preferred doesn't fit
|
|
327
|
+
for (const pos of positionOrder) {
|
|
328
|
+
if (pos === preferredPosition)
|
|
329
|
+
continue;
|
|
330
|
+
const newPosition = calculatePositionForSide(pos, triggerRect, tooltipRect);
|
|
331
|
+
if (newPosition.left >= margin &&
|
|
332
|
+
newPosition.top >= margin &&
|
|
333
|
+
newPosition.left + tooltipRect.width <= windowWidth - margin &&
|
|
334
|
+
newPosition.top + tooltipRect.height <= windowHeight - margin) {
|
|
335
|
+
setTooltipState({ position: newPosition, actualPosition: pos });
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// Fallback to preferred position if none fit
|
|
340
|
+
setTooltipState({ position, actualPosition: preferredPosition });
|
|
341
|
+
}, [isVisible, preferredPosition, tooltipClassName]);
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
frameRef.current = requestAnimationFrame(updatePosition);
|
|
344
|
+
return () => {
|
|
345
|
+
if (frameRef.current) {
|
|
346
|
+
cancelAnimationFrame(frameRef.current);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}, [updatePosition]);
|
|
350
|
+
return tooltipState;
|
|
351
|
+
};
|
|
352
|
+
// Main component with optimizations
|
|
353
|
+
const CwGenericTooltip = ({ children, content = null, position = defaultPosition, dissapearsWhenHover = false, overlayStyle = {}, showDelay = 0, }) => {
|
|
249
354
|
const [isVisible, setIsVisible] = useState(false);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
355
|
+
const containerRef = useRef(null);
|
|
356
|
+
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => setIsVisible(true), showDelay);
|
|
357
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$a["cw-generic-tooltip-content"]);
|
|
358
|
+
// Memoize tooltip content creation
|
|
359
|
+
const tooltipContent = useMemo(() => {
|
|
360
|
+
if (!isVisible || !content)
|
|
361
|
+
return null;
|
|
362
|
+
return createPortal(jsx("div", { className: styles$a["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, style: {
|
|
363
|
+
position: 'fixed',
|
|
364
|
+
top: `${tooltipPosition.top}px`,
|
|
365
|
+
left: `${tooltipPosition.left}px`,
|
|
366
|
+
visibility: tooltipPosition.top === 0 && tooltipPosition.left === 0 ? 'hidden' : 'visible',
|
|
367
|
+
...overlayStyle
|
|
368
|
+
}, onMouseEnter: () => dissapearsWhenHover && setIsVisible(false), children: content }), document.body);
|
|
369
|
+
}, [isVisible, content, actualPosition, tooltipPosition, dissapearsWhenHover, overlayStyle]);
|
|
370
|
+
const handleMouseEnter = useCallback(() => {
|
|
371
|
+
setTooltipTimeout();
|
|
372
|
+
}, [setTooltipTimeout]);
|
|
373
|
+
const handleMouseLeave = useCallback(() => {
|
|
374
|
+
clearTooltipTimeout();
|
|
375
|
+
setIsVisible(false);
|
|
376
|
+
}, [clearTooltipTimeout]);
|
|
377
|
+
return (jsxs("div", { ref: containerRef, className: styles$a["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, children: [tooltipContent, children] }));
|
|
254
378
|
};
|
|
255
379
|
|
|
256
380
|
// Reference for draggable modal
|
|
@@ -369,11 +493,11 @@ class CwModalIframe extends React.Component {
|
|
|
369
493
|
}
|
|
370
494
|
}
|
|
371
495
|
|
|
372
|
-
var styles$
|
|
496
|
+
var styles$9 = {"cw-dialog-main":"cw-dialog-module_cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module_cw-dialog-button-close__9GRd8","cw-dialog-button-save":"cw-dialog-module_cw-dialog-button-save__eZ9SI"};
|
|
373
497
|
|
|
374
498
|
const CwDialog = props => {
|
|
375
499
|
const dialogRef = useRef(null);
|
|
376
|
-
const initialDialogSize = { width: props
|
|
500
|
+
const initialDialogSize = { width: props.dialogSize?.width ?? 800, height: props.dialogSize?.height ?? 600 };
|
|
377
501
|
const [isDragging, setIsDragging] = useState(false);
|
|
378
502
|
const [resizeDirection, setResizeDirection] = useState(null);
|
|
379
503
|
const [position, setPosition] = useState({
|
|
@@ -455,9 +579,9 @@ const CwDialog = props => {
|
|
|
455
579
|
e.stopPropagation();
|
|
456
580
|
setResizeDirection(direction);
|
|
457
581
|
};
|
|
458
|
-
const header = (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: props
|
|
582
|
+
const header = (jsxs("header", { onMouseDown: handleMouseDown, children: [jsx("span", { children: props.headline }), props.customHeader || (jsx("button", { className: styles$9["cw-dialog-button-close"], onClick: props.onClose, children: "\u2A2F" }))] }));
|
|
459
583
|
const content = (jsx("section", { style: { flex: 1, overflowX: "auto", overflowY: "auto", width: "100%" }, children: props.children }));
|
|
460
|
-
const footer = (jsx("footer", { style: { width: "100%" }, children: props
|
|
584
|
+
const footer = (jsx("footer", { style: { width: "100%" }, children: props.customFooter || (jsx("button", { className: styles$9["cw-dialog-button-save"], onClick: props.onSave, children: "\uD83D\uDDAB" })) }));
|
|
461
585
|
const resizeHandles = [
|
|
462
586
|
jsx("div", { "data-handle-n": true, onMouseDown: handleResizeMouseDown("n") }, "handle-n"),
|
|
463
587
|
jsx("div", { "data-handle-s": true, onMouseDown: handleResizeMouseDown("s") }, "handle-s"),
|
|
@@ -468,12 +592,12 @@ const CwDialog = props => {
|
|
|
468
592
|
jsx("div", { "data-handle-se": true, onMouseDown: handleResizeMouseDown("se") }, "handle-se"),
|
|
469
593
|
jsx("div", { "data-handle-sw": true, onMouseDown: handleResizeMouseDown("sw") }, "handle-sw")
|
|
470
594
|
];
|
|
471
|
-
return (props.open && (jsx("div", { "data-has-scrim": props
|
|
595
|
+
return (props.open && (jsx("div", { "data-has-scrim": props.scrim, className: styles$9["cw-dialog-main"], children: jsxs("dialog", { ...props, ref: dialogRef, style: {
|
|
472
596
|
left: `${position.x}px`,
|
|
473
597
|
top: `${position.y}px`,
|
|
474
598
|
width: `${size.width}px`,
|
|
475
599
|
height: `${size.height}px`,
|
|
476
|
-
zIndex: props
|
|
600
|
+
zIndex: props.zIndex,
|
|
477
601
|
minWidth: "200px", // Set an appropriate minimum size
|
|
478
602
|
minHeight: "200px", // Set an appropriate minimum size
|
|
479
603
|
display: "flex",
|
|
@@ -499,7 +623,7 @@ const CwModalReportFunctional = (props) => {
|
|
|
499
623
|
return (jsxs("div", { children: ["Please add a(n) ", props.reportName, " report in ", props.moduleSettings, " Settings"] }));
|
|
500
624
|
}
|
|
501
625
|
};
|
|
502
|
-
return (jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsx(CwDialog, { open: props.visible,
|
|
626
|
+
return (jsx("div", { id: "cwelltModalReportContent", children: isModal ? (jsx(CwDialog, { open: props.visible, dialogSize: { width: props.width, height: props.height }, headline: props.title, customFooter: [jsx("div", {}, "footer")], onClose: props.onCloseModal, isReport: true, children: renderContentModal() })) : (jsx("div", { children: renderContentNotModal() })) }));
|
|
503
627
|
};
|
|
504
628
|
|
|
505
629
|
class CwReportModal extends React.Component {
|
|
@@ -519,7 +643,7 @@ class CwReportModal extends React.Component {
|
|
|
519
643
|
};
|
|
520
644
|
}
|
|
521
645
|
render() {
|
|
522
|
-
return (jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxs(CwDialog, { open: this.props.visible,
|
|
646
|
+
return (jsx("div", { id: "cwelltModalReportContent", children: this.state.isModal === true ? (jsxs(CwDialog, { open: this.props.visible, dialogSize: { width: this.props.width, height: this.props.height }, headline: this.props.title, customFooter: new Array(jsx("div", {})), onClose: () => {
|
|
523
647
|
this.formRef?.current?.resetFields();
|
|
524
648
|
this.props.SET_MODAL_REPORT_VISIBLE(false);
|
|
525
649
|
}, isReport: true, children: [this.props.name !== "Empty.pdf" && (jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", style: { width: "100%", height: "100%", display: "block" } }) })), this.props.name === "Empty.pdf" && (jsx("div", { children: jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "600px" })), this.props.name === "Empty.pdf" && (jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
|
|
@@ -529,14 +653,14 @@ class CwReportModal extends React.Component {
|
|
|
529
653
|
/**
|
|
530
654
|
* A modal that appears when an element is hovered
|
|
531
655
|
* @param children Contents of the modal
|
|
532
|
-
* @param
|
|
533
|
-
* @param
|
|
656
|
+
* @param hovereable Element to hover to display the modal
|
|
657
|
+
* @param onFirstOpened Function to run only once when the modal opens for the first time
|
|
534
658
|
* @example
|
|
535
|
-
* <CwModalHover
|
|
659
|
+
* <CwModalHover hovereable={<span>Hover me!</span>}>
|
|
536
660
|
* <p>Hello there</p>
|
|
537
661
|
* </CwModalHover>
|
|
538
662
|
*/
|
|
539
|
-
const CwModalHover = ({ children,
|
|
663
|
+
const CwModalHover = ({ children, hovereable, onFirstOpened, ...dialogProps }) => {
|
|
540
664
|
// Do not turn these into useState, it will break it.
|
|
541
665
|
const mouseDialogState = { isInsideDialog: false };
|
|
542
666
|
const mouseHoverState = { isInsideHover: false };
|
|
@@ -572,7 +696,7 @@ const CwModalHover = ({ children, $hovereable, $onFirstOpened, ...dialogProps })
|
|
|
572
696
|
};
|
|
573
697
|
}
|
|
574
698
|
}, [hoverRef]);
|
|
575
|
-
return (jsxs("div", { ref: hoverRef, className: "cw-modal-hover", children: [jsx("div", { "data-hovereable-icon": true, children:
|
|
699
|
+
return (jsxs("div", { ref: hoverRef, className: "cw-modal-hover", children: [jsx("div", { "data-hovereable-icon": true, children: hovereable }), jsx("dialog", { ...dialogProps, ref: dialogRef, onMouseEnter: () => {
|
|
576
700
|
mouseDialogState.isInsideDialog = true;
|
|
577
701
|
tryOpeningDialog();
|
|
578
702
|
}, onMouseLeave: () => {
|
|
@@ -803,7 +927,7 @@ function CwTable({ columns, data, pagination, itemsPerPage, expandedRowRender, o
|
|
|
803
927
|
return (jsxs("div", { id: id, className: classNameContainer + " " + "cwTableComp", children: [jsxs("table", { className: className + " " + "cw_table", style: style, children: [jsx("thead", { className: `${classNameHeader} cw_thead`, children: jsxs("tr", { className: "cw_thead_tr", children: [expandedRowRender && jsx("th", { className: "cw_thead_th cw_thead_th_expand" }), columns.map(column => (jsx("th", { onClick: () => handleSort(column.dataIndex), className: `cw_thead_th ${column.className} ${sortConfig.key === column.dataIndex ? sortConfig.direction : ""}`, children: column.title }, column.key)))] }) }), jsx("tbody", { className: "cw_tbody", children: !paginatedData || paginatedData.length === 0 ? (jsx("tr", { children: jsx("td", { colSpan: columns.length + (expandedRowRender ? 1 : 0), style: { textAlign: "center" }, children: textNoData !== undefined && textNoData !== "" ? textNoData : "No data" }) })) : (paginatedData.map(item => (jsxs(React__default.Fragment, { children: [jsxs("tr", { className: `${classNameTr_row} cw_tbody_tr`, children: [expandedRowRender && (jsx("td", { className: "cw_tbody_td", children: jsx("button", { onClick: () => handleRowExpand(item), className: `cwellt_flex cwellt_justify_center cwellt_align_items_center cw_button_expanded_collapse ${expandedRowKey === item.key ? "cw_button_expanded" : "cw_button_collapse"}` }) })), columns.map(column => (jsx("td", { className: "cw_tbody_td", children: column.render ? column.render(item) : item[column.dataIndex] }, `${item.key}_${column.key}`)))] }), expandedRowKey === item.key && expandedRowRender && (jsx("tr", { children: jsx("td", { colSpan: columns.length + 1, children: expandedRowRender(item) }) }))] }, item.key)))) })] }), pagination && totalPages > 1 && (jsxs("div", { className: "cw_table_pagination cwellt_flex cwellt_align-items-start cwellt_align_items_center", children: [jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1, className: "cw_tb_button_pag cw_tb_button_prev cwellt_flex cwellt_justify_center cwellt_align_items_center" }), jsxs("span", { className: "cw_table_pag_desc", children: ["Page ", currentPage, " of ", totalPages] }), jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages, className: "cw_tb_button_pag cw_tb_button_next cwellt_flex cwellt_justify_center cwellt_align_items_center" })] }))] }));
|
|
804
928
|
}
|
|
805
929
|
|
|
806
|
-
var styles$
|
|
930
|
+
var styles$8 = {"cw-tabs":"cw-tabs-module_cw-tabs__1pmji","cw-tabs-content":"cw-tabs-module_cw-tabs-content__HTp8d"};
|
|
807
931
|
|
|
808
932
|
const TabIcon = ({ icon }) => {
|
|
809
933
|
if (!icon)
|
|
@@ -843,31 +967,31 @@ function CwTabs(CwTabsProps) {
|
|
|
843
967
|
}
|
|
844
968
|
};
|
|
845
969
|
const position = CwTabsProps.tabsPosition || 'top';
|
|
846
|
-
return (jsxs("div", { id: CwTabsProps.id, className: styles$
|
|
970
|
+
return (jsxs("div", { id: CwTabsProps.id, className: styles$8['cw-tabs'], "data-tabs-position": position, children: [jsx("ul", { children: CwTabsProps.tabs.map(tab => (jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsx(TabIcon, { icon: tab.icon }), tab.title] }, tab.key))) }), jsx("div", { className: styles$8['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
847
971
|
}
|
|
848
972
|
|
|
849
973
|
/**
|
|
850
974
|
* An expandable element with briefing and children displayed when clicked
|
|
851
|
-
* @param
|
|
852
|
-
* @param
|
|
853
|
-
* @param
|
|
854
|
-
* @param
|
|
975
|
+
* @param briefing Title of the expandable
|
|
976
|
+
* @param onToggle Function to run when expandable is toggled open/closed
|
|
977
|
+
* @param onClose Function to run when expandable is closed
|
|
978
|
+
* @param onOpen Function to run when expandable is opened
|
|
855
979
|
* @example
|
|
856
|
-
* <CwExpandable
|
|
980
|
+
* <CwExpandable briefing="Title here">Contents here</CwExpandable>
|
|
857
981
|
*/
|
|
858
|
-
const CwExpandable = ({
|
|
982
|
+
const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detailsProps }) => {
|
|
859
983
|
const myRef = useRef(null);
|
|
860
984
|
useEffect(() => {
|
|
861
985
|
myRef.current?.addEventListener("click", ev => {
|
|
862
986
|
const isOpen = ev.currentTarget.open;
|
|
863
|
-
|
|
987
|
+
onToggle?.(!isOpen);
|
|
864
988
|
if (!isOpen)
|
|
865
|
-
|
|
989
|
+
onOpen?.(ev);
|
|
866
990
|
else
|
|
867
|
-
|
|
991
|
+
onClose?.(ev);
|
|
868
992
|
});
|
|
869
|
-
}, [
|
|
870
|
-
return (jsx("div", { className: "cw-expandable", children: jsxs("details", { ref: myRef, ...detailsProps, children: [jsx("summary", { children:
|
|
993
|
+
}, [onClose, onOpen, onToggle]);
|
|
994
|
+
return (jsx("div", { className: "cw-expandable", children: jsxs("details", { ref: myRef, ...detailsProps, children: [jsx("summary", { children: briefing }), children && jsx("section", { children: children })] }) }));
|
|
871
995
|
};
|
|
872
996
|
|
|
873
997
|
/**
|
|
@@ -965,12 +1089,6 @@ function CwFileUpload(fileUploadProps) {
|
|
|
965
1089
|
if (typeof reader.result === "string") {
|
|
966
1090
|
const hexContent = arrayBufferToHex(reader.result);
|
|
967
1091
|
setCurrentHexContent(hexContent);
|
|
968
|
-
debugger;
|
|
969
|
-
// fileUploadProps.onChange({
|
|
970
|
-
// ...file,
|
|
971
|
-
// Value:
|
|
972
|
-
// Bindata: hexContent // Replace Bindata with the new hexadecimal content
|
|
973
|
-
// });
|
|
974
1092
|
setPreviewURL(reader.result);
|
|
975
1093
|
setCurrentHexContent(arrayBufferToHex(reader.result));
|
|
976
1094
|
// Llama a la función para guardar el contenido hexadecimal
|
|
@@ -1011,8 +1129,8 @@ function CwInput(CwInputProps) {
|
|
|
1011
1129
|
}
|
|
1012
1130
|
|
|
1013
1131
|
function CwButton(props) {
|
|
1014
|
-
const {
|
|
1015
|
-
return (jsx("button", { type: "button", className: "cw-button", ...buttonProps, children: buttonProps.children ??
|
|
1132
|
+
const { text, ...buttonProps } = props;
|
|
1133
|
+
return (jsx("button", { type: "button", className: "cw-button", ...buttonProps, children: buttonProps.children ?? text }));
|
|
1016
1134
|
}
|
|
1017
1135
|
|
|
1018
1136
|
/**
|
|
@@ -1028,15 +1146,15 @@ function CwButton(props) {
|
|
|
1028
1146
|
* @example
|
|
1029
1147
|
* ```tsx
|
|
1030
1148
|
* <CwDigit
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1149
|
+
* iconProps={{ id: "home" }}
|
|
1150
|
+
* labelProps={{ children: "Name", width: "100px" }}
|
|
1151
|
+
* buttonProps={{ children: "Ok", onclick:()=>{alert("hi")} }}
|
|
1034
1152
|
* />
|
|
1035
1153
|
* ```
|
|
1036
1154
|
*/
|
|
1037
1155
|
function CwDigit(props) {
|
|
1038
|
-
const {
|
|
1039
|
-
return (jsx("div", { className: "cw-input-text", children: jsxs(CwAlign, {
|
|
1156
|
+
const { alignProps, buttonProps, iconProps, labelProps, ...inputProps } = props;
|
|
1157
|
+
return (jsx("div", { className: "cw-input-text", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: "number", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1040
1158
|
}
|
|
1041
1159
|
|
|
1042
1160
|
/**
|
|
@@ -1052,15 +1170,15 @@ function CwDigit(props) {
|
|
|
1052
1170
|
* @example
|
|
1053
1171
|
* ```tsx
|
|
1054
1172
|
* <CwInputText
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1173
|
+
* iconProps={{ id: "home" }}
|
|
1174
|
+
* labelProps={{ children: "Name", width: "100px" }}
|
|
1175
|
+
* buttonProps={{ children: "Ok", onclick:()=>{alert("hi")} }}
|
|
1058
1176
|
* />
|
|
1059
1177
|
* ```
|
|
1060
1178
|
*/
|
|
1061
1179
|
function CwInputText(props) {
|
|
1062
|
-
const {
|
|
1063
|
-
return (jsx("div", { className: "cw-input-text", children: jsxs(CwAlign, {
|
|
1180
|
+
const { alignProps, buttonProps, iconProps, labelProps, ...inputProps } = props;
|
|
1181
|
+
return (jsx("div", { className: "cw-input-text", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: props.type ?? "text", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1064
1182
|
}
|
|
1065
1183
|
|
|
1066
1184
|
/**
|
|
@@ -1075,12 +1193,12 @@ function CwInputText(props) {
|
|
|
1075
1193
|
* ```
|
|
1076
1194
|
* @example
|
|
1077
1195
|
* ```tsx
|
|
1078
|
-
* <CwInputPhone
|
|
1196
|
+
* <CwInputPhone iconProps={{iconId:"phone"}} labelProps={{children:"Phone"}} />
|
|
1079
1197
|
* ```
|
|
1080
1198
|
*/
|
|
1081
1199
|
function CwInputPhone(props) {
|
|
1082
|
-
const {
|
|
1083
|
-
return (jsx("div", { className: "cw-input-phone", children: jsxs(CwAlign, {
|
|
1200
|
+
const { alignProps, buttonProps, iconProps, labelProps, ...inputProps } = props;
|
|
1201
|
+
return (jsx("div", { className: "cw-input-phone", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: "tel", placeholder: "+## ### ### ###", pattern: "[+0-9 ]*", maxLength: 16, ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1084
1202
|
}
|
|
1085
1203
|
|
|
1086
1204
|
function CwInputNumber(CwInputNumberProps) {
|
|
@@ -1097,8 +1215,8 @@ function CwInputNumber(CwInputNumberProps) {
|
|
|
1097
1215
|
}
|
|
1098
1216
|
|
|
1099
1217
|
function CwTextArea(props) {
|
|
1100
|
-
const {
|
|
1101
|
-
return (jsx("div", { className: "cw-text-area", children: jsxs(CwAlign, {
|
|
1218
|
+
const { alignProps, buttonProps, iconProps, labelProps, resize, ...textareaProps } = props;
|
|
1219
|
+
return (jsx("div", { className: "cw-text-area", children: jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("textarea", { ...textareaProps, itemProp: textareaProps.required === true ? "required" : "", style: { ...textareaProps.style, resize: resize } }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1102
1220
|
}
|
|
1103
1221
|
|
|
1104
1222
|
/**
|
|
@@ -1114,16 +1232,16 @@ function CwTextArea(props) {
|
|
|
1114
1232
|
* @example
|
|
1115
1233
|
* ```tsx
|
|
1116
1234
|
* <CwInputDate
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1235
|
+
* iconProps={{ iconId: "Birthdate" }}
|
|
1236
|
+
* labelProps={{ children: "Name", width: "100px" }}
|
|
1237
|
+
* buttonProps={{ children: "Ok", onClick:()=>{alert("happy happy joy joy")} }}
|
|
1120
1238
|
* />
|
|
1121
1239
|
* ```
|
|
1122
1240
|
*/
|
|
1123
1241
|
function CwInputDate(props) {
|
|
1124
|
-
const {
|
|
1125
|
-
|
|
1126
|
-
return (jsx("div", { className: "cw-input-date", children: jsxs(CwAlign, {
|
|
1242
|
+
const { alignProps, buttonProps, iconProps, labelProps, ...inputProps } = props;
|
|
1243
|
+
inputProps.max = inputProps.max ?? "9999-01-01";
|
|
1244
|
+
return (jsx("div", { className: "cw-input-date", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: "date", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1127
1245
|
}
|
|
1128
1246
|
|
|
1129
1247
|
var classes = {"datePicker":"cw-input-date-picker-module_datePicker__jogOq","input":"cw-input-date-picker-module_input__uQshH","calendar":"cw-input-date-picker-module_calendar__q39ic","calendarHeader":"cw-input-date-picker-module_calendarHeader__1btPK","arrowButton":"cw-input-date-picker-module_arrowButton__23tNc","calendarTitle":"cw-input-date-picker-module_calendarTitle__oOODw","calendarBody":"cw-input-date-picker-module_calendarBody__-711a","calendarDay":"cw-input-date-picker-module_calendarDay__z-Mmv","selected":"cw-input-date-picker-module_selected__XQgR7","todayButton":"cw-input-date-picker-module_todayButton__oYamC","emptyDay":"cw-input-date-picker-module_emptyDay__lbI5B"};
|
|
@@ -1247,16 +1365,16 @@ const CwInputDatePicker = ({ value, onChange }) => {
|
|
|
1247
1365
|
* @example
|
|
1248
1366
|
* ```tsx
|
|
1249
1367
|
* <CwInputDate
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1368
|
+
* iconProps={{ id: "Birthdate" }}
|
|
1369
|
+
* labelProps={{ children: "Name", width: "100px" }}
|
|
1370
|
+
* buttonProps={{ children: "Ok", onClick:()=>{alert("happy happy joy joy")} }}
|
|
1253
1371
|
* />
|
|
1254
1372
|
* ```
|
|
1255
1373
|
*/
|
|
1256
1374
|
function CwInputDatetime(props) {
|
|
1257
|
-
const {
|
|
1375
|
+
const { alignProps, buttonProps, iconProps, labelProps, ...inputProps } = props;
|
|
1258
1376
|
inputProps.max = inputProps.max ?? "9999-01-01";
|
|
1259
|
-
return (jsx("div", { className: "cw-input-date", children: jsxs(CwAlign, {
|
|
1377
|
+
return (jsx("div", { className: "cw-input-date", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: "datetime-local", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1260
1378
|
}
|
|
1261
1379
|
|
|
1262
1380
|
/**
|
|
@@ -1272,16 +1390,16 @@ function CwInputDatetime(props) {
|
|
|
1272
1390
|
* @example
|
|
1273
1391
|
* ```tsx
|
|
1274
1392
|
* <CwTime
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1277
|
-
*
|
|
1393
|
+
* iconProps={{ iconId: "Birthdate" }}
|
|
1394
|
+
* labelProps={{ children: "Name", width: "100px" }}
|
|
1395
|
+
* buttonProps={{ children: "Ok", onClick:()=>{alert("happy happy joy joy")} }}
|
|
1278
1396
|
* />
|
|
1279
1397
|
* ```
|
|
1280
1398
|
*/
|
|
1281
1399
|
function CwTime(props) {
|
|
1282
|
-
const {
|
|
1400
|
+
const { alignProps, buttonProps, iconProps, labelProps, ...inputProps } = props;
|
|
1283
1401
|
inputProps.max = inputProps.max ?? "9999-01-01";
|
|
1284
|
-
return (jsx("div", { className: "cw-input-date", children: jsxs(CwAlign, {
|
|
1402
|
+
return (jsx("div", { className: "cw-input-date", children: jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { type: "time", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1285
1403
|
}
|
|
1286
1404
|
|
|
1287
1405
|
/**
|
|
@@ -1300,17 +1418,17 @@ function CwTime(props) {
|
|
|
1300
1418
|
* @example
|
|
1301
1419
|
* ```tsx
|
|
1302
1420
|
* <CwInputDateText
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1421
|
+
* iconProps={{ id: "Birthdate" }}
|
|
1422
|
+
* labelProps={{ children: "Name", width: "100px" }}
|
|
1423
|
+
* buttonProps={{ children: "Ok", onClick:()=>{alert("happy happy joy joy")} }}
|
|
1306
1424
|
* />
|
|
1307
1425
|
* ```
|
|
1308
1426
|
*/
|
|
1309
1427
|
function CwInputDateText(props) {
|
|
1310
1428
|
const displayFormat = "DD.MM.YYYY";
|
|
1311
1429
|
const internalFormat = "YYYY-MM-DD";
|
|
1312
|
-
const {
|
|
1313
|
-
const format =
|
|
1430
|
+
const { alignProps, buttonProps, iconProps, labelProps, dateFormat, value, size, onChange, name, required, tabIndex, disabled, readOnly, ...inputProps } = props;
|
|
1431
|
+
const format = dateFormat ?? displayFormat;
|
|
1314
1432
|
const width = size ?? 12;
|
|
1315
1433
|
const formattedDate = (date, inFormat, outFormat) => {
|
|
1316
1434
|
if (moment(date, inFormat, true).isValid()) {
|
|
@@ -1365,15 +1483,15 @@ function CwInputDateText(props) {
|
|
|
1365
1483
|
onChange?.({ target: { value: date, name: name } });
|
|
1366
1484
|
}
|
|
1367
1485
|
}, [date]);
|
|
1368
|
-
return (jsx("div", { className: "cw-input-date-text", children: jsxs(CwAlign, {
|
|
1486
|
+
return (jsx("div", { className: "cw-input-date-text", children: jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("div", { children: [jsx("input", { type: "text", disabled: disabled, maxLength: 10, onChange: onChangeInputText, pattern: "^$ --|[.0-9\\/\\-]{10}", placeholder: format.toLowerCase(), readOnly: readOnly, ref: textInputRef, required: required, size: width, tabIndex: tabIndex, value: displayedDate }), jsxs("span", { children: [jsx(CwIcon, { iconId: "calendar" }), jsx("input", { type: "date", disabled: disabled, onChange: onChangeInputDate, readOnly: readOnly, ref: dateInputRef, tabIndex: -1, value: date, ...inputProps })] })] }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1369
1487
|
}
|
|
1370
1488
|
|
|
1371
1489
|
function CwInputImage(props) {
|
|
1372
1490
|
const [_uploadedImage, setUploadedImage] = useState(null);
|
|
1373
1491
|
const inputRef = useRef(null);
|
|
1374
|
-
const {
|
|
1375
|
-
const
|
|
1376
|
-
const isValidFileType = (type) =>
|
|
1492
|
+
const { allowedImageFormats, onChange, ...inputProps } = props;
|
|
1493
|
+
const allowedFormats = allowedImageFormats || ["image/jpeg", "image/png", "image/gif"];
|
|
1494
|
+
const isValidFileType = (type) => allowedFormats.includes(type);
|
|
1377
1495
|
const handleFile = (file) => {
|
|
1378
1496
|
if (file && isValidFileType(file.type)) {
|
|
1379
1497
|
const imgURL = URL.createObjectURL(file);
|
|
@@ -1414,7 +1532,7 @@ function CwInputImage(props) {
|
|
|
1414
1532
|
const file = e.target.files?.[0];
|
|
1415
1533
|
handleFile(file ?? null);
|
|
1416
1534
|
};
|
|
1417
|
-
return (jsxs("div", { className: "cw-input-image", children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, style: { border: "2px dashed #ccc", padding: "20px", textAlign: "center" }, children: [jsx("p", { children: "Drop image here" }), jsxs("small", { children: ["(",
|
|
1535
|
+
return (jsxs("div", { className: "cw-input-image", children: [jsxs("div", { onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, style: { border: "2px dashed #ccc", padding: "20px", textAlign: "center" }, children: [jsx("p", { children: "Drop image here" }), jsxs("small", { children: ["(", allowedFormats.join(", ").replace(/image\//g, ""), ")"] })] }), jsxs("div", { style: { display: "flex", justifyContent: "center" }, children: [jsxs(CwButton, { style: { margin: "2px" }, onClick: onPasteButtonClick, children: [jsx(CwIcon, { iconId: "clipboard" }), "\u2002Paste"] }), jsxs(CwButton, { style: { margin: "2px" }, onClick: () => inputRef.current?.click(), children: [jsx(CwIcon, { iconId: "folder" }), "\u2002Browse"] })] }), jsx("input", { ref: inputRef, type: "file", accept: allowedFormats.join(","), onChange: handleFileChange, style: { display: "none" }, ...inputProps })] }));
|
|
1418
1536
|
}
|
|
1419
1537
|
|
|
1420
1538
|
/**
|
|
@@ -1446,18 +1564,18 @@ function CwInputImage(props) {
|
|
|
1446
1564
|
* <CwImageArea src="path/to/image.png" _onSelectionSuccess={img => setImage(img)} />
|
|
1447
1565
|
*/
|
|
1448
1566
|
const CwImageArea = forwardRef((props, ref) => {
|
|
1449
|
-
const {
|
|
1567
|
+
const { alignProps: alignProps, initialSelectionArea: initialSelectionArea, onSelectionEnd, onSelectionStart, onSelectionSuccess, selectionAreaAttenuation: selectionAreaAttenuation, selectionAreaStyle: selectionAreaStyle, ...imgProps } = props;
|
|
1450
1568
|
// Default no-op functions for selection callbacks
|
|
1451
|
-
const
|
|
1452
|
-
const
|
|
1453
|
-
const
|
|
1569
|
+
const onSelectionStartHandler = onSelectionStart || (() => true);
|
|
1570
|
+
const onSelectionEndHandler = onSelectionEnd || (() => true);
|
|
1571
|
+
const onSelectionSuccessHandler = onSelectionSuccess || (() => { });
|
|
1454
1572
|
// Ref to the image element and state management hooks
|
|
1455
1573
|
const imageRef = useRef(null);
|
|
1456
1574
|
const [selectedImage, setSelectedImage] = useState();
|
|
1457
|
-
const [opacity, setOpacity] = useState(
|
|
1575
|
+
const [opacity, setOpacity] = useState(selectionAreaAttenuation ?? selectionAreaStyle?.opacity ?? "1.0");
|
|
1458
1576
|
// Track drag start position and selected area
|
|
1459
1577
|
const [dragStart, setDragStart] = useState(null);
|
|
1460
|
-
const [selectedArea, setSelectedArea] = useState(
|
|
1578
|
+
const [selectedArea, setSelectedArea] = useState(initialSelectionArea ?? null);
|
|
1461
1579
|
// Expose component methods using ref
|
|
1462
1580
|
useImperativeHandle(ref, () => ({
|
|
1463
1581
|
getSelectedImage: () => selectedImage
|
|
@@ -1468,13 +1586,13 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
1468
1586
|
if (rect) {
|
|
1469
1587
|
const x = event.clientX - rect.left;
|
|
1470
1588
|
const y = event.clientY - rect.top;
|
|
1471
|
-
if (
|
|
1589
|
+
if (onSelectionStartHandler(x, y)) {
|
|
1472
1590
|
setDragStart({ x, y });
|
|
1473
1591
|
}
|
|
1474
1592
|
setSelectedArea(null);
|
|
1475
|
-
setOpacity(
|
|
1593
|
+
setOpacity(selectionAreaStyle?.opacity ?? 1);
|
|
1476
1594
|
}
|
|
1477
|
-
}, [
|
|
1595
|
+
}, [onSelectionStartHandler]);
|
|
1478
1596
|
// Update selection area as mouse moves
|
|
1479
1597
|
const onMouseMove = useCallback((event) => {
|
|
1480
1598
|
if (dragStart && imageRef.current) {
|
|
@@ -1494,12 +1612,12 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
1494
1612
|
const scaleX = imageRef.current.naturalWidth / rect.width;
|
|
1495
1613
|
const scaleY = imageRef.current.naturalHeight / rect.height;
|
|
1496
1614
|
const scaledArea = new DOMRect(selectedArea.x * scaleX, selectedArea.y * scaleY, selectedArea.width * scaleX, selectedArea.height * scaleY);
|
|
1497
|
-
if (
|
|
1615
|
+
if (onSelectionEndHandler(scaledArea))
|
|
1498
1616
|
createSelectedImage(scaledArea);
|
|
1499
|
-
setOpacity(
|
|
1617
|
+
setOpacity(selectionAreaAttenuation ?? selectionAreaStyle?.opacity ?? 1);
|
|
1500
1618
|
setDragStart(null);
|
|
1501
1619
|
}
|
|
1502
|
-
}, [selectedArea,
|
|
1620
|
+
}, [selectedArea, onSelectionEndHandler]);
|
|
1503
1621
|
// Create an image from the selected area
|
|
1504
1622
|
const createSelectedImage = useCallback((scaledArea) => {
|
|
1505
1623
|
const canvas = document.createElement("canvas");
|
|
@@ -1510,12 +1628,12 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
1510
1628
|
ctx.drawImage(imageRef.current, scaledArea.x, scaledArea.y, scaledArea.width, scaledArea.height, 0, 0, canvas.width, canvas.height);
|
|
1511
1629
|
const selectedImageURL = canvas.toDataURL("image/png");
|
|
1512
1630
|
setSelectedImage(selectedImageURL);
|
|
1513
|
-
|
|
1631
|
+
onSelectionSuccessHandler(selectedImageURL);
|
|
1514
1632
|
}
|
|
1515
|
-
}, [
|
|
1633
|
+
}, [onSelectionSuccessHandler]);
|
|
1516
1634
|
// Render the component UI
|
|
1517
|
-
return (jsx("div", { className: "cw-image-area", children: jsxs(CwAlign, {
|
|
1518
|
-
|
|
1635
|
+
return (jsx("div", { className: "cw-image-area", children: jsxs(CwAlign, { position: "relative", ...alignProps, children: [jsx("img", { ref: imageRef, onMouseDown: onMouseDown, onMouseMove: onMouseMove, onMouseUp: onMouseUp, onDragStart: e => e.preventDefault(), ...imgProps }), selectedArea && (jsx("section", { style: {
|
|
1636
|
+
...selectionAreaStyle,
|
|
1519
1637
|
height: `${selectedArea.height}px`,
|
|
1520
1638
|
left: `${selectedArea.x}px`,
|
|
1521
1639
|
opacity: opacity,
|
|
@@ -1528,7 +1646,7 @@ const CwImageArea = forwardRef((props, ref) => {
|
|
|
1528
1646
|
});
|
|
1529
1647
|
CwImageArea.displayName = "CwImageArea";
|
|
1530
1648
|
|
|
1531
|
-
var styles$
|
|
1649
|
+
var styles$7 = {"cw-weekday-selector":"cw-weekday-selector-module_cw-weekday-selector__Iz4GZ"};
|
|
1532
1650
|
|
|
1533
1651
|
/**
|
|
1534
1652
|
* This class represents a week where days can be selected or unselected
|
|
@@ -1668,7 +1786,7 @@ const CwWeekdaySelector = ({ value = "", onChange, disabled = false }) => {
|
|
|
1668
1786
|
setSelectedDays(newWeekdays);
|
|
1669
1787
|
onChange?.(newWeekdays.toString());
|
|
1670
1788
|
};
|
|
1671
|
-
return (jsx("div", { className: styles$
|
|
1789
|
+
return (jsx("div", { className: styles$7["cw-weekday-selector"], children: Weekdays.getFullWeek().map(day => (jsx("input", { type: "checkbox", "data-day": day, checked: selectedDays.toArray().includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }));
|
|
1672
1790
|
};
|
|
1673
1791
|
|
|
1674
1792
|
function CwCheckbox(CwCheckboxProps) {
|
|
@@ -1694,8 +1812,8 @@ function CwCheckbox(CwCheckboxProps) {
|
|
|
1694
1812
|
* <CwToggle checked/>
|
|
1695
1813
|
*/
|
|
1696
1814
|
function CwToggle(props) {
|
|
1697
|
-
const {
|
|
1698
|
-
return (jsx("div", { className: "cw-toggle", children: jsxs(CwAlign, {
|
|
1815
|
+
const { alignProps, labelProps, buttonProps, iconProps, ...inputProps } = props;
|
|
1816
|
+
return (jsx("div", { className: "cw-toggle", children: jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsx("input", { className: "cw-toggle", type: "checkbox", ...inputProps }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1699
1817
|
}
|
|
1700
1818
|
|
|
1701
1819
|
/**
|
|
@@ -1710,8 +1828,8 @@ function CwToggle(props) {
|
|
|
1710
1828
|
* </CwSelect>
|
|
1711
1829
|
*/
|
|
1712
1830
|
function CwOption(props) {
|
|
1713
|
-
const {
|
|
1714
|
-
return (jsx("option", { className: "cw-option", ...optionProps, children: optionProps.children ??
|
|
1831
|
+
const { text, ...optionProps } = props;
|
|
1832
|
+
return (jsx("option", { className: "cw-option", ...optionProps, children: optionProps.children ?? text }));
|
|
1715
1833
|
}
|
|
1716
1834
|
|
|
1717
1835
|
/**
|
|
@@ -1731,7 +1849,7 @@ function CwOption(props) {
|
|
|
1731
1849
|
* ╰────────────────────╯
|
|
1732
1850
|
* ```
|
|
1733
1851
|
* @example
|
|
1734
|
-
* <CwSelect name="cat"
|
|
1852
|
+
* <CwSelect name="cat" iconProps={{iconId:"pet"}} labelProps={{children:"Cat:"}}>
|
|
1735
1853
|
* <CwOption value="" > - Choose a cat - </CwOption>
|
|
1736
1854
|
* <CwOption value="o" >Orange</CwOption>
|
|
1737
1855
|
* <CwOption value="b" >Black</CwOption>
|
|
@@ -1739,8 +1857,8 @@ function CwOption(props) {
|
|
|
1739
1857
|
* </CwSelect>
|
|
1740
1858
|
*/
|
|
1741
1859
|
function CwSelect(props) {
|
|
1742
|
-
const {
|
|
1743
|
-
return (jsx("div", { className: "cw-select", children: jsxs(CwAlign, {
|
|
1860
|
+
const { alignProps, labelProps, buttonProps, iconProps, placeholder, children, ...selectProps } = props;
|
|
1861
|
+
return (jsx("div", { className: "cw-select", children: jsxs(CwAlign, { ...alignProps, itemProp: selectProps.required === true ? "required" : "", children: [labelProps && (jsxs(CwLabel, { ...labelProps, children: [iconProps && jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxs("select", { ...selectProps, children: [placeholder && jsx(CwOption, { value: "", children: placeholder }), children] }), buttonProps && jsx(CwButton, { ...buttonProps })] }) }));
|
|
1744
1862
|
}
|
|
1745
1863
|
|
|
1746
1864
|
function CwDropdown(optionsProps) {
|
|
@@ -2636,13 +2754,13 @@ function CwMultiselect(CwelltCustomFilterTabProps) {
|
|
|
2636
2754
|
}) }) }, "_" + i))) })] }) }) }));
|
|
2637
2755
|
}
|
|
2638
2756
|
|
|
2639
|
-
var styles$
|
|
2757
|
+
var styles$6 = {"cw-multifilter-tag":"cw-multi-filter-tag-module_cw-multifilter-tag__Epda-"};
|
|
2640
2758
|
|
|
2641
2759
|
const CwMultiFilterTag = props => {
|
|
2642
2760
|
const { ID, Name, Value, Category, Removable, PrimaryColor, OnPrimaryColor, Selectable, Selected, OnSelect } = props;
|
|
2643
2761
|
const BackgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
2644
2762
|
const TextColor = `rgb(${OnPrimaryColor.r},${OnPrimaryColor.g},${OnPrimaryColor.b})`;
|
|
2645
|
-
return (jsxs("li", { className: styles$
|
|
2763
|
+
return (jsxs("li", { className: styles$6["cw-multifilter-tag"], "data-selected": !!props.Selected, "data-removable": !!props.Removable, style: {
|
|
2646
2764
|
color: TextColor,
|
|
2647
2765
|
backgroundColor: BackgroundColor,
|
|
2648
2766
|
opacity: Selected && !Removable ? "0.5" : "1",
|
|
@@ -2650,10 +2768,10 @@ const CwMultiFilterTag = props => {
|
|
|
2650
2768
|
}, onClick: () => {
|
|
2651
2769
|
if (Selectable)
|
|
2652
2770
|
OnSelect?.(props);
|
|
2653
|
-
}, children: [jsx("span", { id: ID, "data-value": Value, "data-category": Category, children: Name }), Removable && (jsx("span", { onClick: () => props.OnRemove?.(props), children: jsx(CwIcon, {
|
|
2771
|
+
}, children: [jsx("span", { id: ID, "data-value": Value, "data-category": Category, children: Name }), Removable && (jsx("span", { onClick: () => props.OnRemove?.(props), children: jsx(CwIcon, { iconId: "xmark" }) }))] }));
|
|
2654
2772
|
};
|
|
2655
2773
|
|
|
2656
|
-
var styles$
|
|
2774
|
+
var styles$5 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-multi-filter-catalog-container__S3nsq","cw-multi-filter":"cw-multi-filter-module_cw-multi-filter__zipBK","cw-multi-filter-search":"cw-multi-filter-module_cw-multi-filter-search__eyHr0"};
|
|
2657
2775
|
|
|
2658
2776
|
/**
|
|
2659
2777
|
* A multiple filter selector, a MULTI-SELECT even.
|
|
@@ -2678,14 +2796,14 @@ var styles$1 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
|
|
|
2678
2796
|
* const [selectedCategory, setSelectedCategory] = useState("");
|
|
2679
2797
|
*
|
|
2680
2798
|
* <CwMultiFilter
|
|
2681
|
-
*
|
|
2682
|
-
*
|
|
2799
|
+
* id="multifilter"
|
|
2800
|
+
* onChange={tags => { // Collection of currently active tags
|
|
2683
2801
|
* console.log("This will get called every time the selected filters change");
|
|
2684
2802
|
* }}
|
|
2685
|
-
*
|
|
2803
|
+
* selectedTags={selectedTags} // Selected filters, in case you want to modify them manually
|
|
2686
2804
|
* selectedCategory={selectedCategory}
|
|
2687
2805
|
* onChangeCategory={setSelectedCategory}
|
|
2688
|
-
*
|
|
2806
|
+
* allTags={
|
|
2689
2807
|
* new Set([
|
|
2690
2808
|
* {
|
|
2691
2809
|
* Name: "DEF", // The text displayed on the tag/filter/chip
|
|
@@ -2707,7 +2825,7 @@ var styles$1 = {"cw-multi-filter-catalog-container":"cw-multi-filter-module_cw-m
|
|
|
2707
2825
|
* }
|
|
2708
2826
|
* ```
|
|
2709
2827
|
* @param {CwMultiFilterProps} props
|
|
2710
|
-
* @returns Set the
|
|
2828
|
+
* @returns Set the `onChange` callback to a function to check for changes in the selected filters
|
|
2711
2829
|
*/
|
|
2712
2830
|
const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style }) => {
|
|
2713
2831
|
const [filteredTags, setFilteredTags] = useState(new Set());
|
|
@@ -2810,9 +2928,9 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
|
|
|
2810
2928
|
inputRef.current?.focus();
|
|
2811
2929
|
}
|
|
2812
2930
|
};
|
|
2813
|
-
return (jsxs("form", { ref: componentRef, id: id, className: styles$
|
|
2931
|
+
return (jsxs("form", { ref: componentRef, id: id, className: styles$5["cw-multi-filter"], style: style, onSubmit: (e) => {
|
|
2814
2932
|
e.preventDefault();
|
|
2815
|
-
}, children: [jsxs("div", { onClick: handleDivClick, className: styles$
|
|
2933
|
+
}, children: [jsxs("div", { onClick: handleDivClick, className: styles$5["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-color-primary)", outlineOffset: "-2px" } : {}, children: [jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.target.value), autoComplete: "off", onKeyDown: e => {
|
|
2816
2934
|
switch (e.key) {
|
|
2817
2935
|
case "Enter":
|
|
2818
2936
|
case "Tab":
|
|
@@ -2833,7 +2951,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
|
|
|
2833
2951
|
} })] }), selectedTags.size > 0 ? (jsx("input", { type: "reset", value: "\u00D7", onClick: e => {
|
|
2834
2952
|
e.preventDefault();
|
|
2835
2953
|
onChangeSelectedTags?.(new Set());
|
|
2836
|
-
} })) : null] }), jsxs("section", { className: styles$
|
|
2954
|
+
} })) : null] }), jsxs("section", { className: styles$5["cw-multi-filter-catalog-container"], "data-display-none": !isPanelOpen, children: [jsxs("nav", { children: [jsx("button", { style: selectedCategory === "All"
|
|
2837
2955
|
? {
|
|
2838
2956
|
backgroundColor: "var(--cw-color-primary-container)",
|
|
2839
2957
|
color: "var(--cw-color-primary)",
|
|
@@ -2896,7 +3014,7 @@ function CwSearchInput(optionsProps) {
|
|
|
2896
3014
|
: "cw_label_text" + " " + optionsProps.labelClassName, children: optionsProps.labelName }), jsx("input", { type: "text", value: searchText, onChange: handleInputChange, placeholder: "Search...", className: "cw_input_search", disabled: optionsProps.disabled }), searchText && (jsx("button", { className: "cw_button_search_clear cwelt_flex cwellt_justify_center cwellt_align_items_center cwellt_p_abs", onClick: handleClearClick }))] }), filteredOptions.length > 0 && (jsx("div", { className: "cw_searchInput_dropDown cwellt_p_abs", children: jsx("ul", { className: "cw_searchInput_listContainer", children: filteredOptions.map((option) => (jsx("li", { onClick: () => handleOptionSelect(option), className: "cw_searchInput_list cwellt_flex cwellt_align_items_center", children: option.description }, option.id))) }) }))] }));
|
|
2897
3015
|
}
|
|
2898
3016
|
|
|
2899
|
-
var styles = {"context-menu":"cw-context-menu-module_context-menu__dbxnO","context-menu-item":"cw-context-menu-module_context-menu-item__B2W-Q"};
|
|
3017
|
+
var styles$4 = {"context-menu":"cw-context-menu-module_context-menu__dbxnO","context-menu-item":"cw-context-menu-module_context-menu-item__B2W-Q"};
|
|
2900
3018
|
|
|
2901
3019
|
/**
|
|
2902
3020
|
* A context menu that is rendered when the user clicks on a button.
|
|
@@ -2933,10 +3051,10 @@ const CwContextMenu = ({ children, options, onSelect }) => {
|
|
|
2933
3051
|
document.removeEventListener("mousedown", handleOutsideClick);
|
|
2934
3052
|
};
|
|
2935
3053
|
}, []);
|
|
2936
|
-
return (jsxs("div", { onContextMenu: handleContextMenu, children: [children, isOpen && (jsx("div", { ref: menuRef, className: styles["context-menu"], style: {
|
|
3054
|
+
return (jsxs("div", { onContextMenu: handleContextMenu, children: [children, isOpen && (jsx("div", { ref: menuRef, className: styles$4["context-menu"], style: {
|
|
2937
3055
|
top: position.y,
|
|
2938
3056
|
left: position.x
|
|
2939
|
-
}, children: options.map(option => (jsx("div", { onClick: () => handleOptionClick(option), className: styles["context-menu-item"], children: option }, option))) }))] }));
|
|
3057
|
+
}, children: options.map(option => (jsx("div", { onClick: () => handleOptionClick(option), className: styles$4["context-menu-item"], children: option }, option))) }))] }));
|
|
2940
3058
|
};
|
|
2941
3059
|
|
|
2942
3060
|
function CwDataItem(cwBoxItemsProps) {
|
|
@@ -4145,8 +4263,16 @@ class CwScheduler2 extends Component {
|
|
|
4145
4263
|
super(Props);
|
|
4146
4264
|
this.init(this.props);
|
|
4147
4265
|
}
|
|
4266
|
+
resizeObserver;
|
|
4267
|
+
calculateMaxPx = () => {
|
|
4268
|
+
const mainElement = document.querySelector(".cw-scheduler-main-wrapper");
|
|
4269
|
+
if (!mainElement)
|
|
4270
|
+
return window.innerWidth - 402; // sidebar + first column + padding
|
|
4271
|
+
const mainRect = mainElement.getBoundingClientRect();
|
|
4272
|
+
return Math.floor(mainRect.width - 162); // first column + padding
|
|
4273
|
+
};
|
|
4148
4274
|
init = (props) => {
|
|
4149
|
-
const maxPx =
|
|
4275
|
+
const maxPx = this.calculateMaxPx();
|
|
4150
4276
|
const timeHeaders = getTimeHeaders$1(props.startDate, props.endDate);
|
|
4151
4277
|
const dayPx = maxPx / Math.floor(daysBetweenTwoDates$1(props.startDate, props.endDate));
|
|
4152
4278
|
const hourPx = dayPx / 24;
|
|
@@ -4175,7 +4301,8 @@ class CwScheduler2 extends Component {
|
|
|
4175
4301
|
};
|
|
4176
4302
|
};
|
|
4177
4303
|
initOutside = (events, resources, _nextProps, startDate, endDate) => {
|
|
4178
|
-
const maxPx = (document.getElementById("root")?.clientWidth ?? window.innerWidth) - 150;
|
|
4304
|
+
// const maxPx: number = (document.getElementById("root")?.clientWidth ?? window.innerWidth) - 150;
|
|
4305
|
+
const maxPx = this.calculateMaxPx();
|
|
4179
4306
|
const timeHeaders = getTimeHeaders$1(startDate, endDate);
|
|
4180
4307
|
const days = Math.floor(daysBetweenTwoDates$1(startDate, endDate));
|
|
4181
4308
|
const dayPx = maxPx / days;
|
|
@@ -4196,7 +4323,7 @@ class CwScheduler2 extends Component {
|
|
|
4196
4323
|
this.setState({
|
|
4197
4324
|
startDate: startDate,
|
|
4198
4325
|
endDate: endDate,
|
|
4199
|
-
maxPx: maxPx,
|
|
4326
|
+
maxPx: maxPx,
|
|
4200
4327
|
dayPx: dayPx,
|
|
4201
4328
|
hourPx: hourPx,
|
|
4202
4329
|
minutePx: minutePx,
|
|
@@ -4225,15 +4352,47 @@ class CwScheduler2 extends Component {
|
|
|
4225
4352
|
division: divisions,
|
|
4226
4353
|
divisionType: divisionType,
|
|
4227
4354
|
});
|
|
4355
|
+
// Añadir ResizeObserver
|
|
4356
|
+
const mainElement = document.querySelector(".cw-scheduler-main-wrapper");
|
|
4357
|
+
if (mainElement) {
|
|
4358
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
4359
|
+
this.handleResize();
|
|
4360
|
+
});
|
|
4361
|
+
this.resizeObserver.observe(mainElement);
|
|
4362
|
+
}
|
|
4228
4363
|
window?.addEventListener("resize", this.handleResize);
|
|
4229
4364
|
}
|
|
4365
|
+
componentWillUnmount() {
|
|
4366
|
+
if (this.resizeObserver) {
|
|
4367
|
+
this.resizeObserver.disconnect();
|
|
4368
|
+
}
|
|
4369
|
+
window?.removeEventListener("resize", this.handleResize);
|
|
4370
|
+
}
|
|
4371
|
+
recalculateEventPositions = (events, dayPx, startDate) => {
|
|
4372
|
+
return events.map(event => getEventWithSize$1(event, startDate, dayPx));
|
|
4373
|
+
};
|
|
4374
|
+
updateResourcesWithEvents = (resources, events) => {
|
|
4375
|
+
return resources.map(resource => ({
|
|
4376
|
+
...resource,
|
|
4377
|
+
events: events.filter(event => event.resourceId === resource.id)
|
|
4378
|
+
}));
|
|
4379
|
+
};
|
|
4230
4380
|
handleResize = () => {
|
|
4231
|
-
const maxPx =
|
|
4381
|
+
const maxPx = this.calculateMaxPx();
|
|
4232
4382
|
const days = Math.floor(daysBetweenTwoDates$1(this.state.startDate, this.state.endDate));
|
|
4233
4383
|
const dayPx = maxPx / days;
|
|
4234
4384
|
const hourPx = dayPx / 24;
|
|
4235
|
-
const
|
|
4236
|
-
this.
|
|
4385
|
+
const minutePx = dayPx / 1440;
|
|
4386
|
+
const recalculatedEvents = this.recalculateEventPositions(this.state.events, dayPx, this.state.startDate);
|
|
4387
|
+
const updatedResources = this.updateResourcesWithEvents(this.state.resources, recalculatedEvents);
|
|
4388
|
+
this.setState({
|
|
4389
|
+
maxPx,
|
|
4390
|
+
dayPx,
|
|
4391
|
+
hourPx,
|
|
4392
|
+
minutePx,
|
|
4393
|
+
events: recalculatedEvents,
|
|
4394
|
+
resources: updatedResources
|
|
4395
|
+
});
|
|
4237
4396
|
};
|
|
4238
4397
|
componentWillReceiveProps(_nextProps) {
|
|
4239
4398
|
if (this.state.showConsoleLogs) {
|
|
@@ -4331,8 +4490,8 @@ class CwScheduler2 extends Component {
|
|
|
4331
4490
|
return pixels;
|
|
4332
4491
|
});
|
|
4333
4492
|
return (jsx("div", { id: this.props.id, style: {
|
|
4334
|
-
overflowY: "
|
|
4335
|
-
maxHeight: isPinnedTable ? "auto" : schedulerHeight
|
|
4493
|
+
overflowY: "auto",
|
|
4494
|
+
maxHeight: isPinnedTable ? "auto" : schedulerHeight
|
|
4336
4495
|
}, className: this.state.resources.length > 0 ? "cwellt_tb_con" : "cwellt_tb_con cw_tb_con_emptyValues", children: jsxs("table", { id: "cwelltTableScheduler", children: [this.props.id !== "crewAssignmentsScheduler" && (jsx(SchedulerHeader$2, { timelineProps: {
|
|
4337
4496
|
maxPx: this.state.maxPx,
|
|
4338
4497
|
hoursList: this.state.timeHeaders,
|
|
@@ -5193,9 +5352,13 @@ const getTimeHeaders = (startDate, endDate) => {
|
|
|
5193
5352
|
|
|
5194
5353
|
class CwScheduler extends Component {
|
|
5195
5354
|
contentArea;
|
|
5355
|
+
calculateMaxPx = () => {
|
|
5356
|
+
const mainRect = document.body.getBoundingClientRect();
|
|
5357
|
+
return Math.floor(mainRect.width - 200);
|
|
5358
|
+
};
|
|
5196
5359
|
constructor(props) {
|
|
5197
5360
|
super(props);
|
|
5198
|
-
const maxPx =
|
|
5361
|
+
const maxPx = this.calculateMaxPx();
|
|
5199
5362
|
const timeHeaders = getTimeHeaders(props.startDate, props.endDate);
|
|
5200
5363
|
const dayPx = maxPx / Math.floor(daysBetweenTwoDates(props.startDate, props.endDate));
|
|
5201
5364
|
const hourPx = dayPx / 24;
|
|
@@ -5230,7 +5393,7 @@ class CwScheduler extends Component {
|
|
|
5230
5393
|
};
|
|
5231
5394
|
}
|
|
5232
5395
|
handleResize = () => {
|
|
5233
|
-
const maxPx =
|
|
5396
|
+
const maxPx = this.calculateMaxPx();
|
|
5234
5397
|
const days = Math.floor(daysBetweenTwoDates(this.props.startDate, this.props.endDate));
|
|
5235
5398
|
const dayPx = maxPx / days;
|
|
5236
5399
|
const hourPx = dayPx / 24;
|
|
@@ -5255,7 +5418,7 @@ class CwScheduler extends Component {
|
|
|
5255
5418
|
if (dateChange) {
|
|
5256
5419
|
const startDate = _nextProps.startDate;
|
|
5257
5420
|
const endDate = _nextProps.endDate;
|
|
5258
|
-
const maxPx =
|
|
5421
|
+
const maxPx = this.calculateMaxPx();
|
|
5259
5422
|
const timeHeaders = getTimeHeaders(startDate, endDate);
|
|
5260
5423
|
const days = Math.floor(daysBetweenTwoDates(startDate, endDate));
|
|
5261
5424
|
const dayPx = maxPx / days;
|
|
@@ -5299,7 +5462,7 @@ class CwScheduler extends Component {
|
|
|
5299
5462
|
if (!areSameEvents || !areSameRows) {
|
|
5300
5463
|
const startDate = _nextProps.startDate;
|
|
5301
5464
|
const endDate = _nextProps.endDate;
|
|
5302
|
-
const maxPx =
|
|
5465
|
+
const maxPx = this.calculateMaxPx();
|
|
5303
5466
|
const days = Math.floor(daysBetweenTwoDates(startDate, endDate));
|
|
5304
5467
|
const dayPx = maxPx / days;
|
|
5305
5468
|
this.setState({
|
|
@@ -5365,6 +5528,7 @@ class CwScheduler extends Component {
|
|
|
5365
5528
|
return (jsx("div", { id: this.props.id, style: {
|
|
5366
5529
|
overflowY: "scroll",
|
|
5367
5530
|
maxHeight: isPinnedTable ? "auto" : schedulerHeight,
|
|
5531
|
+
minHeight: (this.state.resources.length === 1 || this.state.resources.length === 2) ? schedulerHeight + 10 : 0
|
|
5368
5532
|
}, className: this.state.resources.length > 0 ? "cwellt_tb_con" : "cwellt_tb_con cw_tb_con_emptyValues", children: jsxs("table", { id: "cwelltTableScheduler", children: [this.props.id !== "crewAssignmentsScheduler" && (jsx(SchedulerHeader$1, { timelineProps: {
|
|
5369
5533
|
maxPx: this.state.maxPx,
|
|
5370
5534
|
hoursList: this.state.timeHeaders,
|
|
@@ -5374,6 +5538,7 @@ class CwScheduler extends Component {
|
|
|
5374
5538
|
headerName: this.props.resourceName,
|
|
5375
5539
|
}, descriptionColumn: this.props.descriptionColumn })), jsx("tbody", { style: {
|
|
5376
5540
|
overflow: "visible",
|
|
5541
|
+
width: this.state.maxPx + 150
|
|
5377
5542
|
}, className: isPinnedTable ? "fc-body cw-fc-body-pinned" : "fc-body", children: jsxs("tr", { className: "fc_body_row", children: [jsx(ResourcesTitleList, { resources: this.state.resources, canBePinned: this.props.canBePinned ?? false, includesPinned: this.props.id.toLowerCase().includes("pinned"), onCrewPinning: this.handleCrewPinning, onClickResourceContextMenu: (_e, resource) => {
|
|
5378
5543
|
if (this.props.scheduler_handleOnClickResourceContextMenu) {
|
|
5379
5544
|
this.props.scheduler_handleOnClickResourceContextMenu(_e, resource);
|
|
@@ -5382,32 +5547,6 @@ class CwScheduler extends Component {
|
|
|
5382
5547
|
}
|
|
5383
5548
|
}
|
|
5384
5549
|
|
|
5385
|
-
const SchedulerHeaderDivision = ({ topDivisions, bottomDivisions, classification, topWidth }) => {
|
|
5386
|
-
return (jsxs("div", { style: {
|
|
5387
|
-
width: topWidth,
|
|
5388
|
-
cursor: "pointer"
|
|
5389
|
-
}, children: [jsx("div", { className: "scheduler-dates", style: {
|
|
5390
|
-
background: "#e6e6e6",
|
|
5391
|
-
borderLeft: "1px white solid",
|
|
5392
|
-
display: "flex",
|
|
5393
|
-
overflow: "hidden",
|
|
5394
|
-
alignItems: "center",
|
|
5395
|
-
justifyContent: "center",
|
|
5396
|
-
}, children: jsx("span", { style: { textAlign: "center", height: "2rem", padding: "2px" }, children: topDivisions }) }), jsx("div", { style: { display: "flex", justifyContent: "space-between", flex: 1 }, children: bottomDivisions.map((element) => (jsx("div", { style: {
|
|
5397
|
-
background: "#cacaca",
|
|
5398
|
-
display: "flex",
|
|
5399
|
-
flex: 1,
|
|
5400
|
-
height: "2rem",
|
|
5401
|
-
justifyContent: "center",
|
|
5402
|
-
borderLeft: "white 1px solid",
|
|
5403
|
-
overflow: "hidden"
|
|
5404
|
-
}, children: jsx("span", { children: element }) }, classification + element + topDivisions))) })] }));
|
|
5405
|
-
};
|
|
5406
|
-
|
|
5407
|
-
const HeaderTitle = ({ title, dividerText, width }) => {
|
|
5408
|
-
return (jsxs("div", { style: { display: "flex", flexDirection: "column", width: width }, children: [jsx("div", { style: { display: "flex", justifyContent: "center", background: "white", height: "2rem" }, children: jsx("span", { children: title }) }), jsx("div", { style: { display: "flex", justifyContent: "center", background: "#e6e6e6", height: "2rem" }, children: jsx("span", { children: dividerText }) })] }));
|
|
5409
|
-
};
|
|
5410
|
-
|
|
5411
5550
|
function dateFromPercentage(startDate, visibleDays, percentage) {
|
|
5412
5551
|
const endTime = moment(startDate).add(visibleDays, "day").toDate();
|
|
5413
5552
|
const timeSpan = endTime.getTime() - startDate.getTime();
|
|
@@ -5415,6 +5554,14 @@ function dateFromPercentage(startDate, visibleDays, percentage) {
|
|
|
5415
5554
|
return clickedDate;
|
|
5416
5555
|
}
|
|
5417
5556
|
|
|
5557
|
+
function getPercentageFromMouseEvent(event) {
|
|
5558
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
5559
|
+
const x = event.clientX - rect.left;
|
|
5560
|
+
const totalWidth = rect.width;
|
|
5561
|
+
const clickPercentage = x / totalWidth;
|
|
5562
|
+
return clickPercentage;
|
|
5563
|
+
}
|
|
5564
|
+
|
|
5418
5565
|
class OnClickEvent {
|
|
5419
5566
|
id;
|
|
5420
5567
|
constructor(id) {
|
|
@@ -5530,22 +5677,66 @@ class OnClickContextMenu {
|
|
|
5530
5677
|
}
|
|
5531
5678
|
}
|
|
5532
5679
|
|
|
5533
|
-
|
|
5534
|
-
const rect = event.currentTarget.getBoundingClientRect();
|
|
5535
|
-
const x = event.clientX - rect.left;
|
|
5536
|
-
const totalWidth = rect.width;
|
|
5537
|
-
const clickPercentage = x / totalWidth;
|
|
5538
|
-
return clickPercentage;
|
|
5539
|
-
}
|
|
5680
|
+
var styles$3 = {"scheduler-header-divisions":"scheduler-header-module_scheduler-header-divisions__1JrNe","scheduler-timeline-now":"scheduler-header-module_scheduler-timeline-now__naREv","scheduler-timeline-label":"scheduler-header-module_scheduler-timeline-label__mLVAp","scheduler-header-title":"scheduler-header-module_scheduler-header-title__Jzy94","scheduler-dates":"scheduler-header-module_scheduler-dates__O7ePQ","current-day":"scheduler-header-module_current-day__FpHiv","scheduler-hours":"scheduler-header-module_scheduler-hours__ZDCVj"};
|
|
5540
5681
|
|
|
5541
|
-
const
|
|
5682
|
+
const getNow$1 = (isUtc) => {
|
|
5683
|
+
let now = new Date();
|
|
5684
|
+
if (isUtc) {
|
|
5685
|
+
now = new Date(now.getTime() + now.getTimezoneOffset() * 60_000);
|
|
5686
|
+
}
|
|
5687
|
+
return now;
|
|
5688
|
+
};
|
|
5689
|
+
const TimeLine = ({ left, top = "0px", height, color, width = "2px", zIndexNumber = 0, isHeader, isUtc = false }) => {
|
|
5690
|
+
const [currentTime, setCurrentTime] = useState(getNow$1(isUtc));
|
|
5691
|
+
useEffect(() => {
|
|
5692
|
+
const interval = setInterval(() => {
|
|
5693
|
+
setCurrentTime(getNow$1(isUtc));
|
|
5694
|
+
}, 60000); // Actualiza cada minuto
|
|
5695
|
+
return () => clearInterval(interval);
|
|
5696
|
+
}, [isUtc]);
|
|
5697
|
+
const timeString = currentTime.toLocaleTimeString([], {
|
|
5698
|
+
hour: '2-digit',
|
|
5699
|
+
minute: '2-digit',
|
|
5700
|
+
hour12: false
|
|
5701
|
+
});
|
|
5702
|
+
return (jsx("div", { style: {
|
|
5703
|
+
position: "absolute",
|
|
5704
|
+
top: top,
|
|
5705
|
+
height: height,
|
|
5706
|
+
left: left,
|
|
5707
|
+
width: width,
|
|
5708
|
+
background: color,
|
|
5709
|
+
pointerEvents: "none",
|
|
5710
|
+
zIndex: zIndexNumber,
|
|
5711
|
+
}, className: styles$3["scheduler-timeline-now"], children: isHeader && (jsx("span", { style: {
|
|
5712
|
+
color: color,
|
|
5713
|
+
}, className: styles$3["scheduler-timeline-label"], children: timeString })) }));
|
|
5714
|
+
};
|
|
5715
|
+
|
|
5716
|
+
const SchedulerHeaderDivision = ({ topDivisions, bottomDivisions, classification, topWidth, startDate, endDate }) => {
|
|
5717
|
+
const isToday = () => {
|
|
5718
|
+
if (!startDate)
|
|
5719
|
+
return false;
|
|
5720
|
+
const today = moment();
|
|
5721
|
+
if (endDate) {
|
|
5722
|
+
return today.isBetween(startDate, endDate, 'day', '[]');
|
|
5723
|
+
}
|
|
5724
|
+
return today.isSame(startDate, 'day');
|
|
5725
|
+
};
|
|
5726
|
+
return (jsxs("div", { style: {
|
|
5727
|
+
width: topWidth,
|
|
5728
|
+
cursor: "pointer"
|
|
5729
|
+
}, children: [jsx("div", { className: `${styles$3["scheduler-dates"]} ${isToday() ? styles$3["current-day"] : ""}`, children: jsx("span", { children: topDivisions }) }), jsx("div", { style: { display: "flex", justifyContent: "space-between", flex: 1 }, children: bottomDivisions.map((element) => (jsx("div", { className: styles$3["scheduler-hours"], children: jsx("span", { children: element }) }, classification + element + topDivisions))) })] }));
|
|
5730
|
+
};
|
|
5731
|
+
|
|
5732
|
+
const HeaderTitle = ({ title, dividerText, width }) => {
|
|
5733
|
+
return (jsxs("div", { className: styles$3["scheduler-header-title"], style: { width: width }, children: [jsx("div", { children: jsx("h5", { children: title }) }), jsx("div", { children: jsx("span", { children: dividerText }) })] }));
|
|
5734
|
+
};
|
|
5735
|
+
|
|
5736
|
+
const SchedulerHeader = ({ content, divisions, visibleDays, selectedDate, width, onEvent, timeLinePercentage, isUtc }) => {
|
|
5542
5737
|
const topWidth = (100 / visibleDays);
|
|
5543
5738
|
const { title, classification } = content;
|
|
5544
|
-
return (jsxs("div", { style: {
|
|
5545
|
-
display: "flex",
|
|
5546
|
-
justifyContent: "space-between",
|
|
5547
|
-
alignItems: "center",
|
|
5548
|
-
}, children: [jsx(HeaderTitle, { title: title, dividerText: classification, width: width }), jsx("div", { style: { flex: 1, display: "flex" }, onMouseDown: (e) => {
|
|
5739
|
+
return (jsxs("div", { style: { display: "flex" }, children: [jsx(HeaderTitle, { title: title, dividerText: classification, width: width }), jsxs("div", { className: styles$3["scheduler-header-divisions"], style: { flex: 1, display: "flex", position: "relative" }, onMouseDown: (e) => {
|
|
5549
5740
|
e.preventDefault();
|
|
5550
5741
|
const clickPercentage = getPercentageFromMouseEvent(e);
|
|
5551
5742
|
const date = dateFromPercentage(selectedDate, visibleDays, clickPercentage);
|
|
@@ -5555,29 +5746,118 @@ const SchedulerHeader = ({ content, divisions, visibleDays, selectedDate, width,
|
|
|
5555
5746
|
const clickPercentage = getPercentageFromMouseEvent(e);
|
|
5556
5747
|
const date = dateFromPercentage(selectedDate, visibleDays, clickPercentage);
|
|
5557
5748
|
onEvent(new OnEndClickHeaderEvent(date));
|
|
5558
|
-
}, children: divisions.map((day) => {
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5749
|
+
}, children: [divisions.map((day) => {
|
|
5750
|
+
const thisTopWidth = visibleDays > 15
|
|
5751
|
+
? topWidth * day.bottom.length
|
|
5752
|
+
: topWidth;
|
|
5753
|
+
const dateStr = day.startDate ? moment(day.startDate) : moment(day.top, "DD.MM.YYYY");
|
|
5754
|
+
const startDate = dateStr.toDate();
|
|
5755
|
+
const endDate = day.endDate ? moment(day.endDate).toDate() : undefined;
|
|
5756
|
+
return (jsx(SchedulerHeaderDivision, { topDivisions: day.top, bottomDivisions: day.bottom, classification: classification, topWidth: thisTopWidth + "%", startDate: startDate, endDate: endDate }, day.top + classification));
|
|
5757
|
+
}), !(timeLinePercentage < 0 || timeLinePercentage > 100) && (jsx(TimeLine, { color: "red", left: `${timeLinePercentage}%`, top: "50%", height: "50%", isHeader: true, isUtc: isUtc }))] })] }));
|
|
5758
|
+
};
|
|
5759
|
+
|
|
5760
|
+
function colorToHSL(color) {
|
|
5761
|
+
const hexColor = colorToHEX(color);
|
|
5762
|
+
const hex = hexColor.replace('#', '');
|
|
5763
|
+
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
5764
|
+
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
5765
|
+
const b = parseInt(hex.substring(4, 6), 16) / 255;
|
|
5766
|
+
const max = Math.max(r, g, b);
|
|
5767
|
+
const min = Math.min(r, g, b);
|
|
5768
|
+
let h = 0;
|
|
5769
|
+
let s = 0;
|
|
5770
|
+
const l = (max + min) / 2;
|
|
5771
|
+
if (max !== min) {
|
|
5772
|
+
const d = max - min;
|
|
5773
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
5774
|
+
switch (max) {
|
|
5775
|
+
case r:
|
|
5776
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
5777
|
+
break;
|
|
5778
|
+
case g:
|
|
5779
|
+
h = (b - r) / d + 2;
|
|
5780
|
+
break;
|
|
5781
|
+
case b:
|
|
5782
|
+
h = (r - g) / d + 4;
|
|
5783
|
+
break;
|
|
5784
|
+
}
|
|
5785
|
+
h /= 6;
|
|
5786
|
+
}
|
|
5787
|
+
return {
|
|
5788
|
+
h: Math.round(h * 360),
|
|
5789
|
+
s: Math.round(s * 100),
|
|
5790
|
+
l: Math.round(l * 100)
|
|
5791
|
+
};
|
|
5792
|
+
}
|
|
5793
|
+
function colorToHEX(color) {
|
|
5794
|
+
const canvas = document.createElement('canvas');
|
|
5795
|
+
const context = canvas.getContext('2d');
|
|
5796
|
+
if (!context)
|
|
5797
|
+
throw new Error('Could not create canvas context');
|
|
5798
|
+
context.fillStyle = color;
|
|
5799
|
+
return context.fillStyle;
|
|
5800
|
+
}
|
|
5801
|
+
function getHSLColor(color, alpha = 1) {
|
|
5802
|
+
const hsl = colorToHSL(color);
|
|
5803
|
+
return `hsla(${hsl.h}, ${hsl.s}%, ${hsl.l}%, ${alpha})`;
|
|
5804
|
+
}
|
|
5805
|
+
function getContrastColor(color) {
|
|
5806
|
+
const hsl = colorToHSL(color);
|
|
5807
|
+
const contrastL = hsl.l > 50 ? 20 : 90;
|
|
5808
|
+
return `hsl(${hsl.h}, ${hsl.s}%, ${contrastL}%)`;
|
|
5809
|
+
}
|
|
5810
|
+
|
|
5811
|
+
const BackgroundEvent = ({ value, heightRem }) => {
|
|
5812
|
+
const isVerticalText = value.isVerticalText ?? false;
|
|
5813
|
+
const backColor = getHSLColor(value.color, value.alpha ?? 0.5);
|
|
5814
|
+
const textColor = getContrastColor(value.color);
|
|
5815
|
+
return value.isVisible ? (jsx("div", { style: {
|
|
5816
|
+
left: `${value.left}%`,
|
|
5817
|
+
width: `${value.width}%`,
|
|
5818
|
+
position: "absolute",
|
|
5819
|
+
height: `${heightRem}rem`,
|
|
5820
|
+
}, children: jsx(CwGenericTooltip, { content: value.tooltip, position: "bottom", dissapearsWhenHover: true, showDelay: 200, children: jsx("div", { style: {
|
|
5821
|
+
overflow: "hidden",
|
|
5822
|
+
backgroundColor: backColor,
|
|
5823
|
+
height: `${heightRem}rem`,
|
|
5824
|
+
}, children: jsx("div", { style: {
|
|
5825
|
+
display: "flex",
|
|
5826
|
+
flexDirection: "row",
|
|
5827
|
+
width: "100%",
|
|
5828
|
+
contentVisibility: "auto",
|
|
5829
|
+
height: `${heightRem}rem`,
|
|
5830
|
+
}, children: jsxs("div", { style: {
|
|
5831
|
+
flex: 1,
|
|
5832
|
+
display: "flex",
|
|
5833
|
+
flexDirection: "row",
|
|
5834
|
+
alignItems: "center",
|
|
5835
|
+
whiteSpace: "nowrap",
|
|
5836
|
+
overflow: "hidden",
|
|
5837
|
+
width: value.width + "%",
|
|
5838
|
+
fontSize: "var(--cw-font-size-smallest)"
|
|
5839
|
+
}, children: [value.icons ? jsx("div", { style: {
|
|
5840
|
+
display: "flex",
|
|
5841
|
+
flexDirection: "row",
|
|
5842
|
+
alignItems: "center",
|
|
5843
|
+
whiteSpace: "nowrap",
|
|
5844
|
+
color: textColor,
|
|
5845
|
+
}, children: value.icons }) : null, jsx("span", { style: {
|
|
5846
|
+
color: textColor,
|
|
5847
|
+
writingMode: isVerticalText ? "vertical-lr" : "initial",
|
|
5848
|
+
textOrientation: isVerticalText ? "upright" : "initial"
|
|
5849
|
+
}, children: value.name })] }) }) }) }) })) : null;
|
|
5564
5850
|
};
|
|
5565
5851
|
|
|
5566
|
-
|
|
5567
|
-
|
|
5852
|
+
var styles$2 = {"scheduler-row-header":"scheduler-row-module_scheduler-row-header__S-iv4"};
|
|
5853
|
+
|
|
5854
|
+
const DefaultRowHeader = ({ value, width, onEvent }) => {
|
|
5855
|
+
return (jsxs("div", { style: {
|
|
5568
5856
|
width: width,
|
|
5569
|
-
background: color,
|
|
5570
|
-
cursor: "pointer",
|
|
5571
|
-
padding: "8px",
|
|
5572
|
-
boxSizing: "border-box"
|
|
5857
|
+
// background: color,
|
|
5573
5858
|
}, onClick: (_) => {
|
|
5574
|
-
onEvent(new OnClickRowHeader(value.
|
|
5575
|
-
}, children: jsxs("div", { style: {
|
|
5576
|
-
display: "flex",
|
|
5577
|
-
flexDirection: "column",
|
|
5578
|
-
justifyContent: "center",
|
|
5579
|
-
alignItems: "center",
|
|
5580
|
-
}, children: [jsxs("div", { style: { display: "flex", flexDirection: "row", alignItems: "center" }, children: [jsx("span", { style: { fontWeight: "bold" }, children: value.title }), value.title2 && jsxs("span", { children: ["-", value.title2] })] }), jsxs("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", color: "gray" }, children: [value.subtitle && jsx("span", { style: { fontWeight: "bold" }, children: value.subtitle }), value.subtitle2 && jsxs("span", { children: ["-", value.subtitle2] })] })] }) }));
|
|
5859
|
+
onEvent(new OnClickRowHeader(value.rowId));
|
|
5860
|
+
}, className: styles$2["scheduler-row-header"], children: [jsxs("div", { children: [jsx("strong", { children: value.title }), value.title2 && jsxs("span", { children: ["-", value.title2] }), value.title3 && jsxs("span", { className: styles$2["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] })] }), value.subtitle && jsxs("div", { style: { opacity: 0.5 }, children: [jsx("strong", { children: value.subtitle }), value.subtitle2 && jsxs("span", { children: ["-", value.subtitle2] })] })] }));
|
|
5581
5861
|
};
|
|
5582
5862
|
|
|
5583
5863
|
function useSingleAndDoubleClicks(onClick, onDoubleClick) {
|
|
@@ -5596,7 +5876,7 @@ function useSingleAndDoubleClicks(onClick, onDoubleClick) {
|
|
|
5596
5876
|
timer.current = setTimeout(() => {
|
|
5597
5877
|
timer.current = null;
|
|
5598
5878
|
onClick(e);
|
|
5599
|
-
},
|
|
5879
|
+
}, 500);
|
|
5600
5880
|
}, [timer, cancelPendingClick, onClick]);
|
|
5601
5881
|
const handleDoubleClick = useCallback((e) => {
|
|
5602
5882
|
e.stopPropagation();
|
|
@@ -5607,6 +5887,8 @@ function useSingleAndDoubleClicks(onClick, onDoubleClick) {
|
|
|
5607
5887
|
return { handleClick, handleDoubleClick };
|
|
5608
5888
|
}
|
|
5609
5889
|
|
|
5890
|
+
var styles$1 = {"hide-scrollbar":"new-scheduler-module_hide-scrollbar__33GG9","scheduler-event":"new-scheduler-module_scheduler-event__gphwn","scheduler-event-container":"new-scheduler-module_scheduler-event-container__-h1xm","time-marker":"new-scheduler-module_time-marker__2BejU"};
|
|
5891
|
+
|
|
5610
5892
|
const EventSideDrag = ({ left = false, heightRem, onStartEvent }) => {
|
|
5611
5893
|
return (jsx("span", { draggable: true, onDragStart: (e) => {
|
|
5612
5894
|
e.stopPropagation();
|
|
@@ -5621,16 +5903,24 @@ const EventSideDrag = ({ left = false, heightRem, onStartEvent }) => {
|
|
|
5621
5903
|
const SchedulerEvent = ({ value, heightRem, onEvent }) => {
|
|
5622
5904
|
const [isOnDrag, setIsOnDrag] = useState(false);
|
|
5623
5905
|
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
|
5906
|
+
// Calculate colors of the event
|
|
5907
|
+
const backColor = getHSLColor(value.color, value.alpha ?? 0.75);
|
|
5908
|
+
const textColor = getContrastColor(value.color);
|
|
5909
|
+
const eventTransparent = value.alpha ? value.alpha < 0.7 : false;
|
|
5624
5910
|
const { handleClick, handleDoubleClick } = useSingleAndDoubleClicks((e) => {
|
|
5625
5911
|
e.stopPropagation();
|
|
5626
5912
|
e.preventDefault();
|
|
5627
5913
|
if (!value.isDraggable) {
|
|
5628
5914
|
return;
|
|
5629
5915
|
}
|
|
5916
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/platform
|
|
5917
|
+
// change for navigator.userAgentData.platform when acepted in all browsers
|
|
5918
|
+
const isMac = navigator.platform.toUpperCase().includes("MAC");
|
|
5919
|
+
const isCtrlOrAltPressed = isMac ? e.altKey : e.ctrlKey;
|
|
5630
5920
|
if (e.shiftKey) {
|
|
5631
5921
|
onEvent(new OnRangeClickEvent(value.id));
|
|
5632
5922
|
}
|
|
5633
|
-
else if (
|
|
5923
|
+
else if (isCtrlOrAltPressed) {
|
|
5634
5924
|
onEvent(new OnMultiClickEvent(value.id));
|
|
5635
5925
|
}
|
|
5636
5926
|
else {
|
|
@@ -5641,83 +5931,71 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
|
|
|
5641
5931
|
e.preventDefault();
|
|
5642
5932
|
onEvent(new OnDoubleClickEvent(value.id));
|
|
5643
5933
|
});
|
|
5644
|
-
return (jsx(
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
backgroundColor:
|
|
5682
|
-
height:
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
}, children: [jsxs("div", { style: {
|
|
5934
|
+
return (jsx(Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottomCenter", menu: {
|
|
5935
|
+
items: value.contextMenuItems,
|
|
5936
|
+
onClick: (e) => {
|
|
5937
|
+
e.domEvent.nativeEvent.preventDefault();
|
|
5938
|
+
e.domEvent.nativeEvent.stopPropagation();
|
|
5939
|
+
e.domEvent.nativeEvent.stopImmediatePropagation();
|
|
5940
|
+
e.domEvent.preventDefault();
|
|
5941
|
+
e.domEvent.stopPropagation();
|
|
5942
|
+
onEvent(new OnClickContextMenu(value.id, e.key));
|
|
5943
|
+
},
|
|
5944
|
+
onMouseLeave: () => setIsContextMenuOpen(false),
|
|
5945
|
+
}, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (value.contextMenuItems?.length ?? 0) > 0, children: jsx("div", { style: {
|
|
5946
|
+
top: "2px",
|
|
5947
|
+
left: `${value.left}%`,
|
|
5948
|
+
width: `${value.width}%`,
|
|
5949
|
+
position: "absolute",
|
|
5950
|
+
zIndex: isOnDrag ? 999 : undefined,
|
|
5951
|
+
contentVisibility: "auto",
|
|
5952
|
+
pointerEvents: "auto",
|
|
5953
|
+
}, onClick: handleClick, onDoubleClick: handleDoubleClick, draggable: value.isDraggable, onMouseDown: (_) => {
|
|
5954
|
+
if (value.isDraggable)
|
|
5955
|
+
setIsOnDrag(true);
|
|
5956
|
+
}, onMouseLeave: (_) => {
|
|
5957
|
+
if (value.isDraggable)
|
|
5958
|
+
setIsOnDrag(false);
|
|
5959
|
+
}, onDragStart: (_) => {
|
|
5960
|
+
if (value.isDraggable)
|
|
5961
|
+
onEvent(new OnDragEvent(value.id));
|
|
5962
|
+
}, onDragEnd: (_) => {
|
|
5963
|
+
if (value.isDraggable)
|
|
5964
|
+
setIsOnDrag(false);
|
|
5965
|
+
}, onContextMenu: (e) => {
|
|
5966
|
+
e.stopPropagation();
|
|
5967
|
+
e.preventDefault();
|
|
5968
|
+
onEvent(new OnRightClickEvent(value.id));
|
|
5969
|
+
}, children: jsx(CwGenericTooltip, { content: value.tooltip, position: "bottom", dissapearsWhenHover: true, showDelay: 200, children: jsxs("div", { style: {
|
|
5970
|
+
border: value.selected ? "2px solid black" : "none",
|
|
5971
|
+
backgroundColor: backColor,
|
|
5972
|
+
height: `calc(${heightRem}rem - 4px)`,
|
|
5973
|
+
opacity: eventTransparent ? 0.5 : 1,
|
|
5974
|
+
}, className: styles$1["scheduler-event"], children: [jsxs("div", { style: {
|
|
5686
5975
|
display: "flex",
|
|
5687
5976
|
flexDirection: "row",
|
|
5688
5977
|
alignItems: "stretch",
|
|
5689
5978
|
width: "100%",
|
|
5690
5979
|
cursor: value.isDraggable ? "pointer" : "default",
|
|
5691
|
-
height:
|
|
5692
|
-
}, children: [value.isResizable && (jsx(EventSideDrag, { left: true, heightRem: heightRem * 0.
|
|
5980
|
+
height: `calc(${heightRem}rem - 10px)`,
|
|
5981
|
+
}, children: [value.isResizable && (jsx(EventSideDrag, { left: true, heightRem: heightRem * 0.7, onStartEvent: () => {
|
|
5693
5982
|
onEvent(new OnLeftDragStart(value.id));
|
|
5694
|
-
} })), jsxs("div", { style: {
|
|
5695
|
-
flex: 1,
|
|
5696
|
-
display: "flex",
|
|
5697
|
-
flexDirection: "row",
|
|
5698
|
-
alignItems: "center",
|
|
5699
|
-
whiteSpace: "nowrap",
|
|
5700
|
-
overflow: "hidden",
|
|
5701
|
-
}, children: [jsx("div", { style: {
|
|
5983
|
+
} })), jsxs("div", { className: styles$1["scheduler-event-container"], children: [jsx("div", { style: {
|
|
5702
5984
|
display: "flex",
|
|
5703
5985
|
flexDirection: "row",
|
|
5704
5986
|
alignItems: "center",
|
|
5705
5987
|
whiteSpace: "nowrap",
|
|
5706
|
-
color:
|
|
5988
|
+
color: textColor,
|
|
5707
5989
|
}, children: value.icons }), jsx("span", { style: {
|
|
5708
5990
|
padding: "0.1rem",
|
|
5709
|
-
color:
|
|
5710
|
-
}, children: value.name })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: heightRem * 0.
|
|
5991
|
+
color: textColor,
|
|
5992
|
+
}, children: value.name })] }), value.isResizable && (jsx(EventSideDrag, { heightRem: heightRem * 0.7, onStartEvent: () => {
|
|
5711
5993
|
onEvent(new OnRightDragStart(value.id));
|
|
5712
|
-
} }))] }), value.primaryTimeMarkerColor && (jsx("div", { style: {
|
|
5994
|
+
} }))] }), value.primaryTimeMarkerColor && (jsx("div", { className: styles$1["time-marker"], style: {
|
|
5713
5995
|
backgroundColor: value.primaryTimeMarkerColor,
|
|
5714
|
-
|
|
5715
|
-
width: "100%",
|
|
5716
|
-
} })), value.secondaryTimeMarkerColor && (jsx("div", { style: {
|
|
5996
|
+
} })), value.secondaryTimeMarkerColor && (jsx("div", { className: styles$1["time-marker"], style: {
|
|
5717
5997
|
backgroundColor: value.secondaryTimeMarkerColor,
|
|
5718
|
-
|
|
5719
|
-
width: "100%",
|
|
5720
|
-
} }))] }) }, value.id) }, value.id) }));
|
|
5998
|
+
} }))] }) }) }, value.id) }, value.id));
|
|
5721
5999
|
};
|
|
5722
6000
|
|
|
5723
6001
|
const eventsCollide = (event1, event2) => {
|
|
@@ -5728,7 +6006,14 @@ const eventsCollide = (event1, event2) => {
|
|
|
5728
6006
|
};
|
|
5729
6007
|
// Function to separate events into non-colliding rows
|
|
5730
6008
|
const separateEventsToInnerRows = (events) => {
|
|
5731
|
-
const sortedEvents = [...events].sort((a, b) =>
|
|
6009
|
+
const sortedEvents = [...events].sort((a, b) => {
|
|
6010
|
+
const aOrder = a.order ?? Number.MAX_SAFE_INTEGER;
|
|
6011
|
+
const bOrder = b.order ?? Number.MAX_SAFE_INTEGER;
|
|
6012
|
+
if (aOrder !== bOrder) {
|
|
6013
|
+
return aOrder - bOrder; // Prioridad al order si ambos están definidos
|
|
6014
|
+
}
|
|
6015
|
+
return a.startDate.getTime() - b.startDate.getTime();
|
|
6016
|
+
});
|
|
5732
6017
|
const rows = [];
|
|
5733
6018
|
for (const event of sortedEvents) {
|
|
5734
6019
|
let placed = false;
|
|
@@ -5746,61 +6031,12 @@ const separateEventsToInnerRows = (events) => {
|
|
|
5746
6031
|
return rows;
|
|
5747
6032
|
};
|
|
5748
6033
|
|
|
5749
|
-
const
|
|
5750
|
-
return (jsx("
|
|
5751
|
-
position: "absolute",
|
|
5752
|
-
top: top,
|
|
5753
|
-
height: height,
|
|
5754
|
-
left: left,
|
|
5755
|
-
width: width,
|
|
5756
|
-
background: color,
|
|
5757
|
-
pointerEvents: "none",
|
|
5758
|
-
zIndex: zIndexNumber,
|
|
5759
|
-
} }));
|
|
6034
|
+
const DivisionLine = ({ left, top = "0px", height }) => {
|
|
6035
|
+
return (jsx(TimeLine, { color: "rgba(255,255,255,1)", left: left + "%", height: height, width: 1 + "px", top: top }));
|
|
5760
6036
|
};
|
|
5761
6037
|
|
|
5762
6038
|
const WeekEndLine = ({ left, top = "0px", height, widthPercentage }) => {
|
|
5763
|
-
return (jsx(TimeLine, { color: "rgba(0,0,0,0.
|
|
5764
|
-
};
|
|
5765
|
-
|
|
5766
|
-
const BackgroundEvent = ({ value, }) => {
|
|
5767
|
-
return value.isVisible ? (jsx("div", { style: {
|
|
5768
|
-
left: `${value.left}%`,
|
|
5769
|
-
width: `${value.width}%`,
|
|
5770
|
-
position: "absolute",
|
|
5771
|
-
height: "100%",
|
|
5772
|
-
}, children: jsx("div", { style: {
|
|
5773
|
-
overflow: "hidden",
|
|
5774
|
-
backgroundColor: value.color,
|
|
5775
|
-
height: "100%",
|
|
5776
|
-
}, children: jsx("div", { style: {
|
|
5777
|
-
display: "flex",
|
|
5778
|
-
flexDirection: "row",
|
|
5779
|
-
alignItems: "stretch",
|
|
5780
|
-
width: "100%",
|
|
5781
|
-
contentVisibility: "auto",
|
|
5782
|
-
}, children: jsxs("div", { style: {
|
|
5783
|
-
flex: 1,
|
|
5784
|
-
display: "flex",
|
|
5785
|
-
flexDirection: "row",
|
|
5786
|
-
alignItems: "center",
|
|
5787
|
-
whiteSpace: "nowrap",
|
|
5788
|
-
overflow: "hidden",
|
|
5789
|
-
width: value.width + "%",
|
|
5790
|
-
}, children: [jsx("div", { style: {
|
|
5791
|
-
display: "flex",
|
|
5792
|
-
flexDirection: "row",
|
|
5793
|
-
alignItems: "center",
|
|
5794
|
-
whiteSpace: "nowrap",
|
|
5795
|
-
color: value.isLightColor ? "black" : "white",
|
|
5796
|
-
}, children: value.icons }), jsx("span", { style: {
|
|
5797
|
-
padding: "0.2rem",
|
|
5798
|
-
color: value.isLightColor ? "black" : "white"
|
|
5799
|
-
}, children: value.name })] }) }) }) })) : null;
|
|
5800
|
-
};
|
|
5801
|
-
|
|
5802
|
-
const DivisionLine = ({ left, top = "0px", height }) => {
|
|
5803
|
-
return (jsx(TimeLine, { color: "rgba(255,255,255,1)", left: left + "%", height: height, width: 1 + "px", top: top }));
|
|
6039
|
+
return (jsx(TimeLine, { color: "rgba(0,0,0,0.05)", left: left + "%", height: height, width: widthPercentage + "%", top: top }));
|
|
5804
6040
|
};
|
|
5805
6041
|
|
|
5806
6042
|
const onClickMenuItem$1 = (e, event) => {
|
|
@@ -5813,33 +6049,30 @@ const onClickMenuItem$1 = (e, event) => {
|
|
|
5813
6049
|
};
|
|
5814
6050
|
const SchedulerRow = memo((props) => {
|
|
5815
6051
|
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
|
5816
|
-
const { events, backgroundEvents, rowHeader, contextMenuItems, RowTitleComp, EventComp, weekendLines, divisionLines, timeLinePercentage, selectedDate, visibleDays, onEvent, } = props;
|
|
6052
|
+
const { events, backgroundEvents, rowHeader, contextMenuItems, RowTitleComp, EventComp, BackgroundEventComp, weekendLines, divisionLines, timeLinePercentage, selectedDate, visibleDays, onEvent, } = props;
|
|
5817
6053
|
const internalRows = separateEventsToInnerRows(events);
|
|
5818
6054
|
const { handleClick, handleDoubleClick } = useSingleAndDoubleClicks((e) => {
|
|
5819
6055
|
e.stopPropagation();
|
|
5820
6056
|
e.preventDefault();
|
|
5821
|
-
onEvent(new OnClickRowEvent(rowHeader.value.
|
|
6057
|
+
onEvent(new OnClickRowEvent(rowHeader.value.rowId));
|
|
5822
6058
|
}, (e) => {
|
|
5823
6059
|
e.stopPropagation();
|
|
5824
6060
|
e.preventDefault();
|
|
5825
|
-
onEvent(new OnDoubleClickRowEvent(rowHeader.value.
|
|
6061
|
+
onEvent(new OnDoubleClickRowEvent(rowHeader.value.rowId));
|
|
5826
6062
|
});
|
|
5827
6063
|
return (jsxs("div", { style: {
|
|
5828
6064
|
display: "flex",
|
|
5829
|
-
|
|
5830
|
-
// containIntrinsicSize: "auto auto"
|
|
6065
|
+
minHeight: props.rowHeightInRem + "rem",
|
|
5831
6066
|
}, children: [jsx(RowTitleComp, { ...rowHeader }), jsx(Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottomCenter", menu: {
|
|
5832
6067
|
items: contextMenuItems,
|
|
5833
6068
|
onClick: (e) => {
|
|
5834
6069
|
onClickMenuItem$1(e, () => {
|
|
5835
|
-
onEvent(new OnClickContextMenu(rowHeader.value.
|
|
6070
|
+
onEvent(new OnClickContextMenu(rowHeader.value.rowId, e.key));
|
|
5836
6071
|
});
|
|
5837
6072
|
},
|
|
5838
6073
|
onMouseLeave: () => setIsContextMenuOpen(false),
|
|
5839
6074
|
}, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (contextMenuItems?.length ?? 0) > 0, children: jsxs("div", { style: {
|
|
5840
6075
|
flex: 1,
|
|
5841
|
-
background: rowHeader.color,
|
|
5842
|
-
borderLeft: "1px white solid",
|
|
5843
6076
|
display: "flex",
|
|
5844
6077
|
flexDirection: "column",
|
|
5845
6078
|
position: "relative",
|
|
@@ -5847,11 +6080,15 @@ const SchedulerRow = memo((props) => {
|
|
|
5847
6080
|
e.preventDefault();
|
|
5848
6081
|
const percentage = getPercentageFromMouseEvent(e);
|
|
5849
6082
|
const date = dateFromPercentage(selectedDate, visibleDays, percentage);
|
|
5850
|
-
|
|
5851
|
-
|
|
6083
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/platform
|
|
6084
|
+
// change for navigator.userAgentData.platform when acepted in all browsers
|
|
6085
|
+
const isMac = navigator.platform.toUpperCase().includes("MAC");
|
|
6086
|
+
const isCtrlOrAltPressed = isMac ? e.altKey : e.ctrlKey;
|
|
6087
|
+
if (isCtrlOrAltPressed) {
|
|
6088
|
+
onEvent(new OnDropCtrlEvent(rowHeader.value.rowId, date));
|
|
5852
6089
|
}
|
|
5853
6090
|
else {
|
|
5854
|
-
onEvent(new OnDropEvent(rowHeader.value.
|
|
6091
|
+
onEvent(new OnDropEvent(rowHeader.value.rowId, date));
|
|
5855
6092
|
}
|
|
5856
6093
|
}, onDragOver: (e) => {
|
|
5857
6094
|
e.preventDefault();
|
|
@@ -5860,16 +6097,21 @@ const SchedulerRow = memo((props) => {
|
|
|
5860
6097
|
e.stopPropagation();
|
|
5861
6098
|
const percentage = getPercentageFromMouseEvent(e);
|
|
5862
6099
|
const date = dateFromPercentage(selectedDate, visibleDays, percentage);
|
|
5863
|
-
onEvent(new OnRightClickRow(rowHeader.value.
|
|
6100
|
+
onEvent(new OnRightClickRow(rowHeader.value.rowId, date));
|
|
5864
6101
|
}, children: [weekendLines.map((weekend) => (jsx(WeekEndLine, { height: "100%", left: weekend.left, widthPercentage: weekend.width }))), divisionLines.map((division) => (jsx(DivisionLine, { height: "100%", left: division.left }))), backgroundEvents.length > 0 && backgroundEvents.some((e) => e.isVisible) && (jsx("div", { style: {
|
|
5865
6102
|
height: "100%",
|
|
5866
6103
|
position: internalRows.length > 0 ? "absolute" : "relative",
|
|
5867
6104
|
width: "100%",
|
|
6105
|
+
pointerEvents: "none",
|
|
5868
6106
|
}, children: backgroundEvents.map((event) => {
|
|
5869
|
-
return jsx(
|
|
5870
|
-
}) })), backgroundEvents.length === 0 && internalRows.length === 0 && (jsx("div", { style: { position: "relative", height: props.
|
|
5871
|
-
return (jsx("div", { style: {
|
|
5872
|
-
|
|
6107
|
+
return jsx(BackgroundEventComp, { value: { ...event }, onEvent: onEvent, heightRem: props.rowHeightInRem * Math.max(1, internalRows.length) });
|
|
6108
|
+
}) })), backgroundEvents.length === 0 && internalRows.length === 0 && (jsx("div", { style: { position: "relative", height: props.rowHeightInRem + "rem" } })), internalRows.map((internalRow, index) => {
|
|
6109
|
+
return (jsx("div", { style: {
|
|
6110
|
+
position: "relative",
|
|
6111
|
+
height: props.rowHeightInRem + "rem",
|
|
6112
|
+
pointerEvents: "none"
|
|
6113
|
+
}, children: internalRow.map((event, index) => (jsx(EventComp, { value: event, heightRem: props.rowHeightInRem, onEvent: onEvent }, index))) }, index));
|
|
6114
|
+
}), !(timeLinePercentage < 0 || timeLinePercentage > 100) && (jsx(TimeLine, { color: "red", left: `${timeLinePercentage}%`, top: "0px", height: `100%` }))] }) }, rowHeader.value.rowId)] }));
|
|
5873
6115
|
}, (prevProps, nextProps) => {
|
|
5874
6116
|
// This memo is necessary to prevent re-render all the rows when a user makes drag and drop
|
|
5875
6117
|
const getEventKey = (event) => {
|
|
@@ -5935,9 +6177,12 @@ const getDayDivisions = (visibleDays, selectedDate) => {
|
|
|
5935
6177
|
const divisions = getHoursFromDivisions(divisionsNumber);
|
|
5936
6178
|
const calculatedDivision = [];
|
|
5937
6179
|
for (let i = 0; i < visibleDays; i++) {
|
|
6180
|
+
const currentDate = moment(selectedDate).add(i, "days");
|
|
5938
6181
|
calculatedDivision.push({
|
|
5939
|
-
top:
|
|
6182
|
+
top: currentDate.format("DD.MM.YYYY"),
|
|
5940
6183
|
bottom: divisions,
|
|
6184
|
+
startDate: currentDate.toDate(),
|
|
6185
|
+
endDate: currentDate.toDate()
|
|
5941
6186
|
});
|
|
5942
6187
|
}
|
|
5943
6188
|
return calculatedDivision;
|
|
@@ -5946,12 +6191,15 @@ const getWeekDivisions = (visibleDays, selectedDate) => {
|
|
|
5946
6191
|
const weeks = getWeeksByDays(visibleDays, selectedDate);
|
|
5947
6192
|
const divisions = weeks.map((week) => {
|
|
5948
6193
|
const days = Array.from({ length: week.days }, (_, i) => moment(week.start).add(i, "days").date().toString());
|
|
6194
|
+
const weekEnd = moment(week.start).add(week.days - 1, "days");
|
|
5949
6195
|
const top = days.length > 2
|
|
5950
6196
|
? moment(week.start).format("DD.MM.YYYY") + " - " + moment(week.start).add(week.days - 1, "days").format("DD.MM.YYYY")
|
|
5951
6197
|
: moment(week.start).format("DD.MM.YYYY");
|
|
5952
6198
|
const division = {
|
|
5953
6199
|
top: top,
|
|
5954
6200
|
bottom: days,
|
|
6201
|
+
startDate: moment(week.start).toDate(),
|
|
6202
|
+
endDate: weekEnd.toDate()
|
|
5955
6203
|
};
|
|
5956
6204
|
return division;
|
|
5957
6205
|
});
|
|
@@ -5961,9 +6209,12 @@ const getMonthDivisions = (visibleDays, selectedDate) => {
|
|
|
5961
6209
|
const months = getMonthsByDays(visibleDays, selectedDate);
|
|
5962
6210
|
const divisions = months.map((month) => {
|
|
5963
6211
|
const days = Array.from({ length: month.days }, (_, i) => moment(month.start).add(i, "days").date().toString());
|
|
6212
|
+
const monthEnd = moment(month.start).add(month.days - 1, "days");
|
|
5964
6213
|
const division = {
|
|
5965
6214
|
top: moment(month.start).format("MM.YYYY"),
|
|
5966
6215
|
bottom: days,
|
|
6216
|
+
startDate: moment(month.start).toDate(), // Añadir fecha de inicio
|
|
6217
|
+
endDate: monthEnd.toDate()
|
|
5967
6218
|
};
|
|
5968
6219
|
return division;
|
|
5969
6220
|
});
|
|
@@ -6074,6 +6325,19 @@ function getLinesByDivisions(headerDivision, _) {
|
|
|
6074
6325
|
return finalLines;
|
|
6075
6326
|
}
|
|
6076
6327
|
|
|
6328
|
+
const sortByCategoryAndTitle = (previous, next, orderCategories) => {
|
|
6329
|
+
for (const orderCategory of orderCategories) {
|
|
6330
|
+
const prevOrder = previous[orderCategory];
|
|
6331
|
+
const nextOrder = next[orderCategory];
|
|
6332
|
+
if (prevOrder !== nextOrder) {
|
|
6333
|
+
return prevOrder > nextOrder ? 1 : -1;
|
|
6334
|
+
}
|
|
6335
|
+
}
|
|
6336
|
+
const prevTitle = previous["title"];
|
|
6337
|
+
const nextTitle = next["title"];
|
|
6338
|
+
return prevTitle > nextTitle ? 1 : -1;
|
|
6339
|
+
};
|
|
6340
|
+
|
|
6077
6341
|
const getWeekendLinesByDatesVisible = (initialDate, visibleDays) => {
|
|
6078
6342
|
const dateString = initialDate.toISOString().split('T')[0];
|
|
6079
6343
|
const todayAtO = new Date(dateString);
|
|
@@ -6100,35 +6364,6 @@ const getWeekendsDaysInDateRange = (initialDate, visibleDays) => {
|
|
|
6100
6364
|
|
|
6101
6365
|
class UiEvent {
|
|
6102
6366
|
}
|
|
6103
|
-
function when(event) {
|
|
6104
|
-
let found = false;
|
|
6105
|
-
const actions = {
|
|
6106
|
-
case(eventType, action) {
|
|
6107
|
-
if (!found && event instanceof eventType) {
|
|
6108
|
-
action(event);
|
|
6109
|
-
found = true;
|
|
6110
|
-
}
|
|
6111
|
-
return actions;
|
|
6112
|
-
},
|
|
6113
|
-
else(action) {
|
|
6114
|
-
if (!found) {
|
|
6115
|
-
action(event);
|
|
6116
|
-
}
|
|
6117
|
-
}
|
|
6118
|
-
};
|
|
6119
|
-
return actions;
|
|
6120
|
-
}
|
|
6121
|
-
|
|
6122
|
-
const sortByCategoryAndTitle = (previous, next, orderCategory) => {
|
|
6123
|
-
const prevOrder = previous[orderCategory] ?? "";
|
|
6124
|
-
const nextOrder = next[orderCategory] ?? "";
|
|
6125
|
-
if (prevOrder === nextOrder) {
|
|
6126
|
-
const prevTitle = previous["title"] ?? "";
|
|
6127
|
-
const nextTitle = next["title"] ?? "";
|
|
6128
|
-
return prevTitle > nextTitle ? 1 : -1;
|
|
6129
|
-
}
|
|
6130
|
-
return prevOrder > nextOrder ? 1 : -1;
|
|
6131
|
-
};
|
|
6132
6367
|
|
|
6133
6368
|
const getNow = (isUtc) => {
|
|
6134
6369
|
let now = new Date();
|
|
@@ -6138,32 +6373,39 @@ const getNow = (isUtc) => {
|
|
|
6138
6373
|
return now;
|
|
6139
6374
|
};
|
|
6140
6375
|
const Scheduler = (props) => {
|
|
6141
|
-
const { header: headerContent, id, events, backgroundEvents, contextMenuItems, EventComp, RowTitleComp,
|
|
6376
|
+
const { header: headerContent, id, events: eventsState, backgroundEvents, contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, } = props;
|
|
6377
|
+
const BackgroundEventComp = props.BackgroundEventComp ?? BackgroundEvent;
|
|
6142
6378
|
const rows = useOrderCategory === false
|
|
6143
6379
|
? props.rows
|
|
6144
|
-
: props.rows.sort((a, b) => sortByCategoryAndTitle(a, b,
|
|
6380
|
+
: props.rows.sort((a, b) => sortByCategoryAndTitle(a, b, orderCategories));
|
|
6145
6381
|
const instanceRef = useRef(null);
|
|
6382
|
+
// const rowHeaderWidth = "180px";
|
|
6383
|
+
const { selectedDate, visibleDays, isUtc, isHeaderVisible, visibleRows: stateVisibleRows } = props.state;
|
|
6384
|
+
const events = eventsState.filter((event) => {
|
|
6385
|
+
const lastDayOfScheduler = moment(selectedDate).add(visibleDays, "days");
|
|
6386
|
+
return (moment(event.endDate).isAfter(selectedDate) &&
|
|
6387
|
+
moment(event.startDate).isBefore(lastDayOfScheduler));
|
|
6388
|
+
});
|
|
6146
6389
|
useEffect(() => {
|
|
6147
|
-
console.debug("scheduler");
|
|
6148
6390
|
instanceRef.current?.resetAfterIndex(0);
|
|
6149
|
-
}, [
|
|
6150
|
-
const
|
|
6151
|
-
const
|
|
6391
|
+
}, [orderCategories, props.rows.length, events]);
|
|
6392
|
+
const notEmptyRows = stateVisibleRows ?? rows.length;
|
|
6393
|
+
const visibleRows = height(events, rows, notEmptyRows);
|
|
6394
|
+
const totalHours = visibleDays * 24;
|
|
6395
|
+
const [timeLinePercentage, setTimeLinePercentage] = useState(0);
|
|
6152
6396
|
const header = {
|
|
6153
6397
|
content: headerContent,
|
|
6154
|
-
divisions:
|
|
6398
|
+
divisions: getDefaultDivisions(visibleDays, selectedDate),
|
|
6155
6399
|
visibleDays: visibleDays,
|
|
6156
6400
|
width: rowHeaderWidth,
|
|
6157
6401
|
selectedDate,
|
|
6158
6402
|
onEvent,
|
|
6403
|
+
timeLinePercentage: timeLinePercentage,
|
|
6404
|
+
isUtc: isUtc
|
|
6159
6405
|
};
|
|
6160
|
-
const
|
|
6161
|
-
const
|
|
6162
|
-
const
|
|
6163
|
-
const [timeLinePercentage, setTimeLinePercentage] = useState(0);
|
|
6164
|
-
const evenColor = "#EEEEEE";
|
|
6165
|
-
const oddColor = "#E0E0EF";
|
|
6166
|
-
const rowsHeight = 2.5; // rem
|
|
6406
|
+
const evenColor = "var(--cw-color-surface-container-low)";
|
|
6407
|
+
const oddColor = "var(--cw-color-surface-container)";
|
|
6408
|
+
const rowsHeight = 1.75; // rem
|
|
6167
6409
|
const schedulerContentHeight = rowsHeight * visibleRows;
|
|
6168
6410
|
const weekendsLines = getWeekendLinesByDatesVisible(selectedDate, visibleDays);
|
|
6169
6411
|
const divisionLines = getLinesByDivisions(header.divisions);
|
|
@@ -6174,35 +6416,33 @@ const Scheduler = (props) => {
|
|
|
6174
6416
|
setTimeLinePercentage(percentage);
|
|
6175
6417
|
};
|
|
6176
6418
|
updateTimeLinePercentage();
|
|
6177
|
-
const interval = setInterval(updateTimeLinePercentage,
|
|
6419
|
+
const interval = setInterval(updateTimeLinePercentage, 10_000);
|
|
6178
6420
|
return () => clearInterval(interval);
|
|
6179
6421
|
}, [selectedDate, isUtc, totalHours]);
|
|
6180
6422
|
// Memoized Row Component
|
|
6181
6423
|
const Row = React__default.memo(({ index, style }) => {
|
|
6182
6424
|
const row = rows[index];
|
|
6425
|
+
const rowColor = groupRowColors
|
|
6426
|
+
? Math.floor(index / 2) % 2 === 0 ? evenColor : oddColor
|
|
6427
|
+
: index % 2 === 0 ? evenColor : oddColor;
|
|
6183
6428
|
const header = {
|
|
6184
6429
|
value: row,
|
|
6185
|
-
color: index % 2 === 0 ? evenColor : oddColor,
|
|
6186
6430
|
width: rowHeaderWidth,
|
|
6187
6431
|
onEvent: onEvent,
|
|
6188
6432
|
};
|
|
6189
|
-
return (jsx("div", { style:
|
|
6433
|
+
return (jsx("div", { style: {
|
|
6434
|
+
...style,
|
|
6435
|
+
backgroundColor: rowColor
|
|
6436
|
+
}, children: jsx(SchedulerRow, { events: events.filter((it) => it.rowId === row.rowId), backgroundEvents: backgroundEvents.filter((it) => it.rowId === row.rowId), rowHeader: header, EventComp: EventComp, BackgroundEventComp: BackgroundEventComp, RowTitleComp: RowTitleComp, weekendLines: weekendsLines, divisionLines: divisionLines, timeLinePercentage: timeLinePercentage, rowHeightInRem: rowsHeight, onEvent: onEvent, contextMenuItems: contextMenuItems, visibleDays: visibleDays, selectedDate: selectedDate }) }));
|
|
6190
6437
|
});
|
|
6191
|
-
const getItemSize = (index) => {
|
|
6438
|
+
const getItemSize = useCallback((index) => {
|
|
6192
6439
|
const row = rows[index];
|
|
6193
|
-
const filteredEvents = events
|
|
6194
|
-
.filter((it) => {
|
|
6195
|
-
return it.resourceId === row.resourceId;
|
|
6196
|
-
})
|
|
6197
|
-
.filter((event) => {
|
|
6198
|
-
return (event.endDate > selectedDate &&
|
|
6199
|
-
moment(event.startDate).isBefore(moment(selectedDate).add(visibleDays, "days")));
|
|
6200
|
-
});
|
|
6440
|
+
const filteredEvents = events.filter((it) => it.rowId === row.rowId);
|
|
6201
6441
|
const innerRows = separateEventsToInnerRows(filteredEvents);
|
|
6202
6442
|
const rowsNumber = innerRows.length > 0 ? innerRows.length : 1;
|
|
6203
6443
|
const pixelsInRem = 16;
|
|
6204
6444
|
return rowsNumber * rowsHeight * pixelsInRem;
|
|
6205
|
-
};
|
|
6445
|
+
}, [rows, events, selectedDate, visibleDays, rowsHeight]);
|
|
6206
6446
|
// Render
|
|
6207
6447
|
return (jsxs("div", { id: id, style: {
|
|
6208
6448
|
position: "relative",
|
|
@@ -6213,15 +6453,16 @@ const Scheduler = (props) => {
|
|
|
6213
6453
|
position: "sticky",
|
|
6214
6454
|
top: 0,
|
|
6215
6455
|
zIndex: 1,
|
|
6216
|
-
}, children: jsx(SchedulerHeader, { ...header }) })), jsx("
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6456
|
+
}, children: jsx(SchedulerHeader, { ...header }) })), jsx(VariableSizeList, { height: schedulerContentHeight * 16, itemCount: rows.length, itemSize: getItemSize, width: "100%", style: { overflowX: "hidden" }, ref: instanceRef, className: styles$1["hide-scrollbar"], children: Row })] }));
|
|
6457
|
+
};
|
|
6458
|
+
const height = (events, rows, rowsNumber) => {
|
|
6459
|
+
const selectedRows = rows.slice(0, rowsNumber);
|
|
6460
|
+
const flatMapped = selectedRows.flatMap(row => {
|
|
6461
|
+
const newEvents = events.filter(it => it.rowId === row.rowId);
|
|
6462
|
+
const innerRows = separateEventsToInnerRows(newEvents);
|
|
6463
|
+
return innerRows.length > 0 ? innerRows : [[]];
|
|
6464
|
+
});
|
|
6465
|
+
return flatMapped.length;
|
|
6225
6466
|
};
|
|
6226
6467
|
|
|
6227
6468
|
let topsCounter = 0;
|
|
@@ -6465,7 +6706,7 @@ class CwSuperScheduler extends React.Component {
|
|
|
6465
6706
|
? this.props.pinnedEvents.filter(x => this.state.pinnedResources.includes(x.resourceId))
|
|
6466
6707
|
: new Array();
|
|
6467
6708
|
const notPinnedEvents = this.props.events.filter(x => !this.props.pinnedResources?.includes(x.resourceId));
|
|
6468
|
-
return (jsxs("div", { className: "cwelltSuperScheduler_content", children: [jsx(CwScheduler, { id: "crewPinnedScheduler", events: pinnedEvents, resources: firstSchedulerResources, height: this.state.height, startDate: this.props.startDate, endDate: this.props.endDate, scheduler_handleCblEventClick: this.props.scheduler_handleCblEventClick, scheduler_handleCblEventClickRight: this.props.scheduler_handleCblEventClickRight, scheduler_handleCblEventDoubleClick: this.props.scheduler_handleCblEventDoubleClick, scheduler_handleOnDropCblEventsOnResource: this.props.scheduler_handleOnDropCblEventsOnResource, parent: this.props.parent, cblEventComp: this.props.cblEventComp, scheduler_handleOnClickEventContextMenu: this.props.scheduler_handleOnClickEventContextMenu, resourceComp: this.props.resourceComp, scheduler_handleOnClickContextMenuResource: this.props.scheduler_handleOnClickContextMenuResource, resourceContextMenuContents: this.props.resourceContextMenuContents, scheduler_handleDblClickOnResourceInScheduler: this.props.scheduler_handleDblClickOnResourceInScheduler, scheduler_handleEmptyClick: this.props.scheduler_handleEmptyClick, canBePinned: false, scheduler_handlePinned: this.scheduler_handlePinnedClick, resourceName: this.props.resourceName, descriptionColumn: this.props.descriptionColumn, scheduler_handleOnClickResourceContextMenu: this.props.scheduler_handleOnClickResourceContextMenu, groupByFunction: this.props.groupByFunction }), havePinnedResources && (jsx("div", { style: { padding: "0.5rem" }, children: jsx(CwButton, {
|
|
6709
|
+
return (jsxs("div", { className: "cwelltSuperScheduler_content", children: [jsx(CwScheduler, { id: "crewPinnedScheduler", events: pinnedEvents, resources: firstSchedulerResources, height: this.state.height, startDate: this.props.startDate, endDate: this.props.endDate, scheduler_handleCblEventClick: this.props.scheduler_handleCblEventClick, scheduler_handleCblEventClickRight: this.props.scheduler_handleCblEventClickRight, scheduler_handleCblEventDoubleClick: this.props.scheduler_handleCblEventDoubleClick, scheduler_handleOnDropCblEventsOnResource: this.props.scheduler_handleOnDropCblEventsOnResource, parent: this.props.parent, cblEventComp: this.props.cblEventComp, scheduler_handleOnClickEventContextMenu: this.props.scheduler_handleOnClickEventContextMenu, resourceComp: this.props.resourceComp, scheduler_handleOnClickContextMenuResource: this.props.scheduler_handleOnClickContextMenuResource, resourceContextMenuContents: this.props.resourceContextMenuContents, scheduler_handleDblClickOnResourceInScheduler: this.props.scheduler_handleDblClickOnResourceInScheduler, scheduler_handleEmptyClick: this.props.scheduler_handleEmptyClick, canBePinned: false, scheduler_handlePinned: this.scheduler_handlePinnedClick, resourceName: this.props.resourceName, descriptionColumn: this.props.descriptionColumn, scheduler_handleOnClickResourceContextMenu: this.props.scheduler_handleOnClickResourceContextMenu, groupByFunction: this.props.groupByFunction }), havePinnedResources && (jsx("div", { style: { padding: "0.5rem" }, children: jsx(CwButton, { text: "Clear", onClick: () => {
|
|
6469
6710
|
this.props.scheduler_handleClearPinnedOnParent();
|
|
6470
6711
|
} }) })), jsx(CwScheduler, { id: "crewAssignmentsScheduler", events: notPinnedEvents, resources: secondSchedulerResources, height: this.props.height, startDate: this.props.startDate, endDate: this.props.endDate, scheduler_handleCblEventClick: this.props.scheduler_handleCblEventClick, scheduler_handleCblEventClickRight: this.props.scheduler_handleCblEventClickRight, scheduler_handleCblEventDoubleClick: this.props.scheduler_handleCblEventDoubleClick, scheduler_handleOnDropCblEventsOnResource: this.props.scheduler_handleOnDropCblEventsOnResource, parent: this.props.parent, cblEventComp: this.props.cblEventComp, scheduler_handleOnClickEventContextMenu: this.props.scheduler_handleOnClickEventContextMenu, resourceComp: this.props.resourceComp, scheduler_handleOnClickContextMenuResource: this.handleOnClickContextMenuResource, resourceContextMenuContents: this.props.resourceContextMenuContents, scheduler_handleDblClickOnResourceInScheduler: this.props.scheduler_handleDblClickOnResourceInScheduler, scheduler_handleEmptyClick: this.props.scheduler_handleEmptyClick, canBePinned: true, scheduler_handlePinned: this.scheduler_handlePinnedClick, scheduler_handleCblEventResize: this.props.scheduler_handleCblEventResize, resourceName: this.props.resourceName, descriptionColumn: this.props.descriptionColumn, scheduler_handleOnClickResourceContextMenu: this.props.scheduler_handleOnClickResourceContextMenu, airportSelected: this.props.airportSelected, module: this.props.module, groupByFunction: this.props.groupByFunction })] }));
|
|
6471
6712
|
}
|
|
@@ -6544,6 +6785,8 @@ class Resource {
|
|
|
6544
6785
|
}
|
|
6545
6786
|
}
|
|
6546
6787
|
|
|
6788
|
+
var styles = {"super-scheduler-row-header":"super-scheduler-module_super-scheduler-row-header__TTs4e","indicators":"super-scheduler-module_indicators__f4lIT","scheduler-crewmember-functions":"super-scheduler-module_scheduler-crewmember-functions__BS2hs"};
|
|
6789
|
+
|
|
6547
6790
|
class OnPinRow {
|
|
6548
6791
|
id;
|
|
6549
6792
|
constructor(id) {
|
|
@@ -6568,107 +6811,37 @@ const onClickMenuItem = (e, event) => {
|
|
|
6568
6811
|
e.domEvent.stopPropagation();
|
|
6569
6812
|
event();
|
|
6570
6813
|
};
|
|
6571
|
-
const PinRowHeader = ({ value,
|
|
6814
|
+
const PinRowHeader = ({ value, width, onEvent }) => {
|
|
6572
6815
|
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
|
|
6573
6816
|
const { highlightColor, isLoading } = value;
|
|
6574
6817
|
return (jsxs("div", { style: {
|
|
6575
|
-
display: "flex",
|
|
6576
|
-
justifyContent: "space-around",
|
|
6577
|
-
alignItems: "center",
|
|
6578
6818
|
width: width,
|
|
6579
|
-
background: highlightColor
|
|
6580
|
-
}, children: [jsx("button", { className: "cw-button-icon", onClick: (_) => {
|
|
6581
|
-
onEvent(value.isPinned ? new OnUnpinRow(value.
|
|
6582
|
-
}, children: jsx("
|
|
6583
|
-
transform: value.isPinned ? undefined : "rotateY(0deg) rotate(45deg)",
|
|
6584
|
-
alignSelf: "center",
|
|
6585
|
-
}, children: jsx(CwIcon, { "$id": "thumbtack fa-xs" }) }) }), value.indicators ?? undefined, jsx(CwGenericTooltip, { content: value.tooltip, position: "bottom", dissapearsWhenHover: true, overlayStyle: value.overlayTooltipStyle, children: jsx(Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottomCenter", menu: {
|
|
6819
|
+
background: highlightColor,
|
|
6820
|
+
}, className: styles["super-scheduler-row-header"], children: [jsx("button", { className: "cw-button-icon cwi-pin", "data-pinned": value.isPinned, onClick: (_) => {
|
|
6821
|
+
onEvent(value.isPinned ? new OnUnpinRow(value.rowId) : new OnPinRow(value.rowId));
|
|
6822
|
+
} }), jsx("div", { className: styles["indicators"], children: value.indicators ?? undefined }), jsx(CwGenericTooltip, { content: value.tooltip, position: "right", dissapearsWhenHover: true, overlayStyle: value.overlayTooltipStyle, children: jsx(Dropdown, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "bottomCenter", menu: {
|
|
6586
6823
|
items: value.contextMenuItems,
|
|
6587
6824
|
onClick: (e) => {
|
|
6588
6825
|
onClickMenuItem(e, () => {
|
|
6589
|
-
onEvent(new OnClickContextMenu(value.
|
|
6826
|
+
onEvent(new OnClickContextMenu(value.rowId, e.key));
|
|
6590
6827
|
});
|
|
6591
6828
|
},
|
|
6592
6829
|
onMouseLeave: () => setIsContextMenuOpen(false),
|
|
6593
|
-
}, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (value.contextMenuItems?.length ?? 0) > 0, children: jsxs("div", { style: {
|
|
6830
|
+
}, trigger: ["contextMenu"], overlayStyle: { animationDuration: "0" }, arrow: (value.contextMenuItems?.length ?? 0) > 0, children: jsxs("div", { className: styles["scheduler-row-header"], style: {
|
|
6594
6831
|
display: "flex",
|
|
6595
6832
|
flexDirection: "column",
|
|
6596
6833
|
justifyContent: "center",
|
|
6597
|
-
alignItems: "
|
|
6598
|
-
}, children: [jsxs("div", {
|
|
6599
|
-
display: "flex",
|
|
6600
|
-
flexDirection: "row",
|
|
6601
|
-
alignItems: "center",
|
|
6602
|
-
color: "lightgray"
|
|
6603
|
-
}, children: [value.subtitle && jsx("span", { style: { fontWeight: "bold" }, children: value.subtitle }), value.subtitle2 && jsxs("span", { children: ["-", value.subtitle2] })] })] }) }, value.resourceId) }, value.resourceId), isLoading ? jsx(CwIcon, { "$id": "spinner fa-spin" }) : undefined] }));
|
|
6834
|
+
alignItems: "flex-start",
|
|
6835
|
+
}, children: [jsxs("div", { children: [jsx("strong", { children: value.title }), value.title2 && jsxs("span", { children: ["-", value.title2] }), value.title3 && jsxs("span", { className: styles["scheduler-crewmember-functions"], children: [" (", value.title3, ")"] })] }), value.subtitle && jsxs("div", { style: { opacity: 0.5 }, children: [jsx("strong", { children: value.subtitle }), value.subtitle2 && jsxs("span", { children: ["-", value.subtitle2] })] })] }) }, value.rowId) }, value.rowId), isLoading ? jsx(CwIcon, { iconId: "spinner fa-spin" }) : undefined] }));
|
|
6604
6836
|
};
|
|
6605
6837
|
|
|
6606
6838
|
const SuperScheduler = ({ id, state, header, rows, events, pinnedOrderCategory, unPinnedOrderCategory, backgroundEvents, contextMenuItems, onEvent }) => {
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
setPinnedRows(rows.filter((it) => it.isPinned));
|
|
6610
|
-
}, [rows, events]);
|
|
6611
|
-
const [pinnedRows, setPinnedRows] = useState([]);
|
|
6612
|
-
const [notPinnedRows, setNotPinnedRows] = useState([]);
|
|
6613
|
-
const customOnEvent = (event) => {
|
|
6614
|
-
when(event)
|
|
6615
|
-
.case(OnClearPinned, () => {
|
|
6616
|
-
setPinnedRows((old) => {
|
|
6617
|
-
const oldPinned = old.map((it) => {
|
|
6618
|
-
return { ...it, isPinned: false };
|
|
6619
|
-
});
|
|
6620
|
-
setNotPinnedRows((oldNotPinned) => {
|
|
6621
|
-
return [...oldPinned, ...oldNotPinned];
|
|
6622
|
-
});
|
|
6623
|
-
return [];
|
|
6624
|
-
});
|
|
6625
|
-
})
|
|
6626
|
-
.case(OnPinRow, (event) => {
|
|
6627
|
-
setNotPinnedRows((oldNotPinned) => {
|
|
6628
|
-
const newNotPinned = [...oldNotPinned];
|
|
6629
|
-
const rowToModifyIndex = oldNotPinned.findIndex((it) => it.resourceId == event.id);
|
|
6630
|
-
const rowToModify = oldNotPinned[rowToModifyIndex];
|
|
6631
|
-
newNotPinned.splice(rowToModifyIndex, 1);
|
|
6632
|
-
const modifiedRow = {
|
|
6633
|
-
...rowToModify,
|
|
6634
|
-
isPinned: true,
|
|
6635
|
-
};
|
|
6636
|
-
setPinnedRows((oldPinned) => {
|
|
6637
|
-
const modifiedResources = [...oldPinned];
|
|
6638
|
-
modifiedResources.push(modifiedRow);
|
|
6639
|
-
return modifiedResources;
|
|
6640
|
-
});
|
|
6641
|
-
return newNotPinned;
|
|
6642
|
-
});
|
|
6643
|
-
})
|
|
6644
|
-
.case(OnUnpinRow, (event) => {
|
|
6645
|
-
setPinnedRows((oldPinned) => {
|
|
6646
|
-
const modifiedPinnedRows = [...oldPinned];
|
|
6647
|
-
const rowToModifyIndex = oldPinned.findIndex((it) => it.resourceId == event.id);
|
|
6648
|
-
const rowToModify = oldPinned[rowToModifyIndex];
|
|
6649
|
-
modifiedPinnedRows.splice(rowToModifyIndex, 1);
|
|
6650
|
-
const modifiedRow = {
|
|
6651
|
-
...rowToModify,
|
|
6652
|
-
isPinned: false,
|
|
6653
|
-
};
|
|
6654
|
-
setNotPinnedRows((oldNotPinned) => {
|
|
6655
|
-
const modifiedResources = [...oldNotPinned];
|
|
6656
|
-
modifiedResources.push(modifiedRow);
|
|
6657
|
-
return modifiedResources;
|
|
6658
|
-
});
|
|
6659
|
-
return modifiedPinnedRows;
|
|
6660
|
-
});
|
|
6661
|
-
})
|
|
6662
|
-
.else((event) => {
|
|
6663
|
-
onEvent(event);
|
|
6664
|
-
});
|
|
6665
|
-
};
|
|
6839
|
+
const pinnedRows = rows.filter((it) => it.isPinned);
|
|
6840
|
+
const notPinnedRows = rows.filter((it) => !it.isPinned);
|
|
6666
6841
|
const isFirstVisible = pinnedRows.length > 0;
|
|
6667
|
-
return (jsxs(Fragment$1, { children: [isFirstVisible && (jsxs(Fragment$1, { children: [jsx(Scheduler, { id: `${id}-pinned`, state: state, header: header, rows: pinnedRows, events: events, backgroundEvents: backgroundEvents, contextMenuItems: contextMenuItems,
|
|
6668
|
-
|
|
6669
|
-
}, children: "Clear pinned" }) })] })), jsx(Scheduler, { id: `${id}-notPinned`, state: { ...state, isHeaderVisible: !isFirstVisible }, header: header, rows: notPinnedRows, events: events, backgroundEvents: backgroundEvents, contextMenuItems: contextMenuItems,
|
|
6670
|
-
customOnEvent(it);
|
|
6671
|
-
}, EventComp: SchedulerEvent, RowTitleComp: PinRowHeader })] }));
|
|
6842
|
+
return (jsxs(Fragment$1, { children: [isFirstVisible && (jsxs(Fragment$1, { children: [jsx(Scheduler, { id: `${id}-pinned`, state: state, header: header, rows: pinnedRows, events: events, backgroundEvents: backgroundEvents, contextMenuItems: contextMenuItems, orderCategories: pinnedOrderCategory, onEvent: onEvent, EventComp: SchedulerEvent, RowTitleComp: PinRowHeader }), jsx("div", { children: jsx(CwButton, { onClick: () => {
|
|
6843
|
+
onEvent(new OnClearPinned());
|
|
6844
|
+
}, children: "Clear pinned" }) })] })), jsx(Scheduler, { id: `${id}-notPinned`, state: { ...state, isHeaderVisible: !isFirstVisible }, header: header, rows: notPinnedRows, events: events, backgroundEvents: backgroundEvents, contextMenuItems: contextMenuItems, orderCategories: unPinnedOrderCategory, onEvent: onEvent, EventComp: SchedulerEvent, RowTitleComp: PinRowHeader })] }));
|
|
6672
6845
|
};
|
|
6673
6846
|
|
|
6674
6847
|
const { Option } = Select;
|