@cwellt_software/cwellt-reactjs-lib 1.2.13 → 1.2.15
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/content/icons/new-cw-icons/NewCwIcons.json +1 -204
- package/dist/content/icons/new-cw-icons/css/new-cw-icons.css +9 -1
- package/dist/content/icons/new-cw-icons/fonts/NewCwIcons.woff +0 -0
- package/dist/{components/control/choice/deprecated → deprecated/components}/MultiSelect_deprecated_.d.ts +1 -1
- package/dist/deprecated/components/MultiSelect_deprecated_.d.ts.map +1 -0
- package/dist/deprecated/components/dropdown/CwDropdownContainer.d.ts.map +1 -0
- package/dist/{components/control/choice → deprecated/components}/multiselect/CwHeadFilter.d.ts +1 -0
- package/dist/deprecated/components/multiselect/CwHeadFilter.d.ts.map +1 -0
- package/dist/{components/control/choice → deprecated/components}/multiselect/CwMultiselect.d.ts +1 -1
- package/dist/deprecated/components/multiselect/CwMultiselect.d.ts.map +1 -0
- package/dist/{components/control/choice → deprecated/components}/multiselect/CwOptionList.d.ts +0 -1
- package/dist/deprecated/components/multiselect/CwOptionList.d.ts.map +1 -0
- package/dist/{components/display/text → deprecated/components}/tag/CwTag.d.ts +0 -1
- package/dist/deprecated/components/tag/CwTag.d.ts.map +1 -0
- package/dist/index.cjs.js +1184 -1606
- package/dist/index.css +1 -1
- package/dist/index.d.ts +323 -154
- package/dist/index.es.js +1179 -1606
- package/dist/playground/main.d.ts +4 -0
- package/dist/playground/main.d.ts.map +1 -0
- package/dist/src/common/functions/collections.d.ts.map +1 -1
- package/dist/src/common/functions/dsl/UiEventDSL.d.ts +1 -1
- package/dist/src/common/interfaces/CwFormTypes.d.ts +5 -0
- package/dist/src/common/interfaces/CwFormTypes.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwPopoverButton.d.ts +33 -0
- package/dist/src/components/control/action/button/CwPopoverButton.d.ts.map +1 -0
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts +15 -0
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts.map +1 -0
- package/dist/src/components/control/choice/checkbox/CwCheckbox.d.ts +4 -0
- package/dist/src/components/control/choice/checkbox/CwCheckbox.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwCheckboxGroup.d.ts +35 -0
- package/dist/src/components/control/choice/checkbox/CwCheckboxGroup.d.ts.map +1 -0
- package/dist/src/components/control/choice/deprecated/CwDropdown.d.ts.map +1 -0
- package/dist/src/components/control/choice/deprecated/CwDropdownNavigation.d.ts.map +1 -0
- package/dist/src/components/control/choice/dropdown/CwPopoverButton.d.ts +35 -0
- package/dist/src/components/control/choice/dropdown/CwPopoverButton.d.ts.map +1 -0
- package/dist/src/components/control/choice/multi-filter/CwMultiFilter.d.ts.map +1 -1
- package/dist/src/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts +1 -0
- package/dist/src/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts.map +1 -1
- package/dist/src/components/control/choice/select/CwSelect.d.ts +7 -1
- package/dist/src/components/control/choice/select/CwSelect.d.ts.map +1 -1
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts +1 -1
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts.map +1 -1
- package/dist/src/components/control/input/color/CwInputColor.d.ts +30 -0
- package/dist/src/components/control/input/color/CwInputColor.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDatePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateRangePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts +3 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwDateTimePicker2.d.ts +47 -0
- package/dist/src/components/control/input/new-dates/CwDateTimePicker2.d.ts.map +1 -0
- package/dist/src/components/control/input/new-dates/CwDateTimePickerCompact.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/CwTimePicker.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/dateRangePresets.d.ts.map +1 -1
- package/dist/src/components/control/input/new-dates/usePickerPopup.d.ts +24 -0
- package/dist/src/components/control/input/new-dates/usePickerPopup.d.ts.map +1 -0
- package/dist/src/components/control/input/new-dates/utils/timezoneHelpers.d.ts +22 -0
- package/dist/src/components/control/input/new-dates/utils/timezoneHelpers.d.ts.map +1 -0
- package/dist/src/components/control/input/text/CwInputText.d.ts +7 -0
- package/dist/src/components/control/input/text/CwInputText.d.ts.map +1 -1
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts +6 -0
- package/dist/src/components/control/input/text-area/CwTextArea.d.ts.map +1 -1
- package/dist/src/components/custom/find-airport/CwFindAirportComp.d.ts +1 -0
- package/dist/src/components/custom/find-airport/CwFindAirportComp.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/CwSchedulerComp.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/CwSuperSchedulerComp.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/components/time_line/TimeLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/addMinutesToDateFromPx.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/daysBetweenTwoDates.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/getFormatedTimeForHeader.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/getMonthHeaderData.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/getWeekHeaderDataFromWeekRange.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/dates/listOfDatesToWeeks.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/divisions/calculateDivisionType.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/divisions/calculateDivisions.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/filtering/filterEvents.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/filtering/filterResources.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/filtering/hasSameProperties.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/pixels/getHeightLineScheduler.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/pixels/getPixelsForEvent.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/pixels/heightScheduler.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/pixels/heightSchedulerPinned.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/state_handle/doubleClickOnResource.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/state_handle/handleResourceChange.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/state_handle/onDragOver.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/state_handle/onDropEventToResource.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/strings/compareStrings.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/checkIfSlotAvailable.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/getEventsOfResource.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/getTimeHeaders.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/isAllowedToMove.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler/logic/ui/updateResourceVisibility.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/NewScheduler.d.ts +2 -1
- 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.map +1 -1
- 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 +1 -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/DivisionLine.d.ts +1 -0
- package/dist/src/components/custom/scheduler-new/presentation/components/timeline/DivisionLine.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/helpers.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/WeekendCalc.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/eventIsVisible.d.ts.map +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/getDivisions.d.ts +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/getDivisions.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/getEventSizes.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/logic/getLinesByDivisions.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.map +1 -1
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerState.d.ts +1 -0
- package/dist/src/components/custom/scheduler-new/presentation/state/ui/SchedulerState.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.d.ts +1 -12
- package/dist/src/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.d.ts +1 -11
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightScheduler.d.ts +1 -1
- package/dist/src/components/custom/scheduler-temporal/logic/pixels/heightScheduler.d.ts.map +1 -1
- package/dist/src/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.d.ts +1 -1
- package/dist/src/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts +1 -2
- package/dist/src/components/custom/super-scheduler/PinRowHeader.d.ts.map +1 -1
- package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts +1 -0
- package/dist/src/components/custom/super-scheduler/SuperScheduler.d.ts.map +1 -1
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts +13 -0
- package/dist/src/components/display/data/generic_tooltip/CwGenericTooltip.d.ts.map +1 -1
- package/dist/src/components/display/data/table/CwTable.d.ts +1 -1
- package/dist/src/components/display/data/table/CwTable.d.ts.map +1 -1
- package/dist/src/components/display/data/table_sortable/CwSortableTable.d.ts +74 -0
- package/dist/src/components/display/data/table_sortable/CwSortableTable.d.ts.map +1 -0
- package/dist/src/components/display/data/table_sortable/useSortableTable.d.ts +42 -0
- package/dist/src/components/display/data/table_sortable/useSortableTable.d.ts.map +1 -0
- package/dist/src/components/display/data/tooltip_manager/CwTooltip.d.ts +25 -0
- package/dist/src/components/display/data/tooltip_manager/CwTooltip.d.ts.map +1 -0
- package/dist/src/components/display/data/tooltip_manager/CwTooltipManager.d.ts +19 -0
- package/dist/src/components/display/data/tooltip_manager/CwTooltipManager.d.ts.map +1 -0
- package/dist/src/components/display/text/note/CwNote.d.ts +1 -1
- package/dist/src/components/display/text/note/CwNote.d.ts.map +1 -1
- package/dist/src/components/display/text/tag/CwChip.d.ts +1 -1
- package/dist/src/components/display/text/tag/CwChip.d.ts.map +1 -1
- package/dist/src/components/display/text/tooltip/CwTooltip.d.ts +4 -1
- package/dist/src/components/display/text/tooltip/CwTooltip.d.ts.map +1 -1
- package/dist/src/components/layout/dialog/CwDialog.d.ts +2 -0
- package/dist/src/components/layout/dialog/CwDialog.d.ts.map +1 -1
- package/dist/src/components/layout/dialog/CwDialogManager.d.ts.map +1 -1
- package/dist/src/components/layout/list/sortable/CwSortableList.d.ts +2 -1
- package/dist/src/components/layout/list/sortable/CwSortableList.d.ts.map +1 -1
- package/dist/src/components/layout/master-detail/CwMasterDetail.d.ts +41 -0
- package/dist/src/components/layout/master-detail/CwMasterDetail.d.ts.map +1 -0
- package/dist/src/components/layout/modal/legacy/cw_modal.d.ts.map +1 -1
- package/dist/src/components/layout/modal/legacy/cw_modal_report.d.ts +0 -2
- package/dist/src/components/layout/modal/legacy/cw_modal_report.d.ts.map +1 -1
- package/dist/src/dev/index.d.ts +5 -0
- package/dist/src/dev/index.d.ts.map +1 -0
- package/dist/src/dev/palette.d.ts +3 -0
- package/dist/src/dev/palette.d.ts.map +1 -0
- package/dist/src/dev/previews.d.ts +3 -0
- package/dist/src/dev/previews.d.ts.map +1 -0
- package/dist/src/dev/useInitial.d.ts +3 -0
- package/dist/src/dev/useInitial.d.ts.map +1 -0
- package/dist/src/index.d.ts +8 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/main.d.ts +3 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/test/components/control/input/new-dates/timezoneHelpers.test.d.ts +2 -0
- package/dist/test/components/control/input/new-dates/timezoneHelpers.test.d.ts.map +1 -0
- package/dist/test/vitest.setup.d.ts +2 -0
- package/dist/test/vitest.setup.d.ts.map +1 -0
- package/package.json +20 -22
- package/dist/common/classes/CwSelectList.d.ts +0 -8
- package/dist/common/classes/CwSelectList.d.ts.map +0 -1
- package/dist/common/classes/CwSelectListItems.d.ts +0 -9
- package/dist/common/classes/CwSelectListItems.d.ts.map +0 -1
- package/dist/common/functions/collections.d.ts +0 -15
- package/dist/common/functions/collections.d.ts.map +0 -1
- package/dist/common/functions/colorManipulation.d.ts +0 -6
- package/dist/common/functions/colorManipulation.d.ts.map +0 -1
- package/dist/common/functions/dsl/UiEventDSL.d.ts +0 -9
- package/dist/common/functions/dsl/UiEventDSL.d.ts.map +0 -1
- package/dist/common/functions/useSingleAndDoubleClicks.d.ts +0 -7
- package/dist/common/functions/useSingleAndDoubleClicks.d.ts.map +0 -1
- package/dist/common/interfaces/CwSelectListProps.d.ts +0 -9
- package/dist/common/interfaces/CwSelectListProps.d.ts.map +0 -1
- package/dist/components/control/action/button/CwButton.d.ts +0 -26
- package/dist/components/control/action/button/CwButton.d.ts.map +0 -1
- package/dist/components/control/action/buttons/CwButtons.d.ts +0 -59
- package/dist/components/control/action/buttons/CwButtons.d.ts.map +0 -1
- package/dist/components/control/action/contextmenu/CwContextMenu.d.ts +0 -23
- package/dist/components/control/action/contextmenu/CwContextMenu.d.ts.map +0 -1
- package/dist/components/control/action/contextual-menu/CwContextualMenu.d.ts +0 -29
- package/dist/components/control/action/contextual-menu/CwContextualMenu.d.ts.map +0 -1
- package/dist/components/control/action/search/CwSearch.d.ts +0 -16
- package/dist/components/control/action/search/CwSearch.d.ts.map +0 -1
- package/dist/components/control/choice/checkbox/CwCheckbox.d.ts +0 -17
- package/dist/components/control/choice/checkbox/CwCheckbox.d.ts.map +0 -1
- package/dist/components/control/choice/deprecated/MultiSelect_deprecated_.d.ts.map +0 -1
- package/dist/components/control/choice/dropdown/CwDropdown.d.ts.map +0 -1
- package/dist/components/control/choice/dropdown/CwDropdownContainer.d.ts.map +0 -1
- package/dist/components/control/choice/dropdown/CwDropdownFilter.d.ts +0 -28
- package/dist/components/control/choice/dropdown/CwDropdownFilter.d.ts.map +0 -1
- package/dist/components/control/choice/dropdown/CwDropdownNavigation.d.ts.map +0 -1
- package/dist/components/control/choice/multi-filter/CwMultiFilter.d.ts +0 -158
- package/dist/components/control/choice/multi-filter/CwMultiFilter.d.ts.map +0 -1
- package/dist/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts +0 -33
- package/dist/components/control/choice/multi-filter/components/tag/CwMultiFilterTag.d.ts.map +0 -1
- package/dist/components/control/choice/multiselect/CwHeadFilter.d.ts.map +0 -1
- package/dist/components/control/choice/multiselect/CwMultiselect.d.ts.map +0 -1
- package/dist/components/control/choice/multiselect/CwOptionList.d.ts.map +0 -1
- package/dist/components/control/choice/option/CwOption.d.ts +0 -17
- package/dist/components/control/choice/option/CwOption.d.ts.map +0 -1
- package/dist/components/control/choice/select/CwSelect.d.ts +0 -48
- package/dist/components/control/choice/select/CwSelect.d.ts.map +0 -1
- package/dist/components/control/choice/toggle/CwToggle.d.ts +0 -28
- package/dist/components/control/choice/toggle/CwToggle.d.ts.map +0 -1
- package/dist/components/control/input/any/CwInput.d.ts +0 -17
- package/dist/components/control/input/any/CwInput.d.ts.map +0 -1
- package/dist/components/control/input/date/CwInputDate.d.ts +0 -40
- package/dist/components/control/input/date/CwInputDate.d.ts.map +0 -1
- package/dist/components/control/input/date-picker/CwInputDatePicker.d.ts +0 -7
- package/dist/components/control/input/date-picker/CwInputDatePicker.d.ts.map +0 -1
- package/dist/components/control/input/date-text/CwInputDateText.d.ts +0 -38
- package/dist/components/control/input/date-text/CwInputDateText.d.ts.map +0 -1
- package/dist/components/control/input/datetime/CwInputDatetime.d.ts +0 -40
- package/dist/components/control/input/datetime/CwInputDatetime.d.ts.map +0 -1
- package/dist/components/control/input/digit/CwDigit.d.ts +0 -40
- package/dist/components/control/input/digit/CwDigit.d.ts.map +0 -1
- package/dist/components/control/input/file/CwFileUpload.d.ts +0 -18
- package/dist/components/control/input/file/CwFileUpload.d.ts.map +0 -1
- package/dist/components/control/input/file/CwFileUploadMultiple.d.ts +0 -15
- package/dist/components/control/input/file/CwFileUploadMultiple.d.ts.map +0 -1
- package/dist/components/control/input/image/CwInputImage.d.ts +0 -7
- package/dist/components/control/input/image/CwInputImage.d.ts.map +0 -1
- package/dist/components/control/input/image-area/CwImageArea.d.ts +0 -53
- package/dist/components/control/input/image-area/CwImageArea.d.ts.map +0 -1
- package/dist/components/control/input/number/CwInputNumber.d.ts +0 -20
- package/dist/components/control/input/number/CwInputNumber.d.ts.map +0 -1
- package/dist/components/control/input/phone/CwInputPhone.d.ts +0 -36
- package/dist/components/control/input/phone/CwInputPhone.d.ts.map +0 -1
- package/dist/components/control/input/text/CwInputText.d.ts +0 -40
- package/dist/components/control/input/text/CwInputText.d.ts.map +0 -1
- package/dist/components/control/input/text-area/CwTextArea.d.ts +0 -24
- package/dist/components/control/input/text-area/CwTextArea.d.ts.map +0 -1
- package/dist/components/control/input/time/CwTime.d.ts +0 -40
- package/dist/components/control/input/time/CwTime.d.ts.map +0 -1
- package/dist/components/control/input/weekday/CwWeekdaySelector.d.ts +0 -53
- package/dist/components/control/input/weekday/CwWeekdaySelector.d.ts.map +0 -1
- package/dist/components/custom/find-airport/CwFindAirportComp.d.ts +0 -35
- package/dist/components/custom/find-airport/CwFindAirportComp.d.ts.map +0 -1
- package/dist/components/custom/scheduler/CwSchedulerComp.d.ts +0 -19
- package/dist/components/custom/scheduler/CwSchedulerComp.d.ts.map +0 -1
- package/dist/components/custom/scheduler/CwSuperSchedulerComp.d.ts +0 -86
- package/dist/components/custom/scheduler/CwSuperSchedulerComp.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/EventRender.d.ts +0 -10
- package/dist/components/custom/scheduler/components/EventRender.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/ResourceListRender.d.ts +0 -20
- package/dist/components/custom/scheduler/components/ResourceListRender.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/ResourceRender.d.ts +0 -14
- package/dist/components/custom/scheduler/components/ResourceRender.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/day_headers/DayHeader.d.ts +0 -11
- package/dist/components/custom/scheduler/components/day_headers/DayHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/day_headers/MonthHeader.d.ts +0 -11
- package/dist/components/custom/scheduler/components/day_headers/MonthHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/day_headers/MyDaysHeader.d.ts +0 -13
- package/dist/components/custom/scheduler/components/day_headers/MyDaysHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/day_headers/WeekHeader.d.ts +0 -11
- package/dist/components/custom/scheduler/components/day_headers/WeekHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/resources_title_list/ResourcesTitleList.d.ts +0 -14
- package/dist/components/custom/scheduler/components/resources_title_list/ResourcesTitleList.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/scheduler_content_area/SchedulerContentArea.d.ts +0 -23
- package/dist/components/custom/scheduler/components/scheduler_content_area/SchedulerContentArea.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/scheduler_header/SchedulerHeader.d.ts +0 -8
- package/dist/components/custom/scheduler/components/scheduler_header/SchedulerHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.d.ts +0 -12
- package/dist/components/custom/scheduler/components/scheduler_timeline/SchedulerTimeLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/time_headers/TimeHeader.d.ts +0 -12
- package/dist/components/custom/scheduler/components/time_headers/TimeHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/time_headers/TimeHeaderRow.d.ts +0 -10
- package/dist/components/custom/scheduler/components/time_headers/TimeHeaderRow.d.ts.map +0 -1
- package/dist/components/custom/scheduler/components/time_line/TimeLine.d.ts +0 -12
- package/dist/components/custom/scheduler/components/time_line/TimeLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/addMinutesToDateFromPx.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/dates/addMinutesToDateFromPx.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDates.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDates.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/getFormatedTimeForHeader.d.ts +0 -7
- package/dist/components/custom/scheduler/logic/dates/getFormatedTimeForHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/getMonthHeaderData.d.ts +0 -10
- package/dist/components/custom/scheduler/logic/dates/getMonthHeaderData.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/getUtcToday.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/dates/getUtcToday.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/getWeekHeaderDataFromWeekRange.d.ts +0 -7
- package/dist/components/custom/scheduler/logic/dates/getWeekHeaderDataFromWeekRange.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/dates/listOfDatesToWeeks.d.ts +0 -8
- package/dist/components/custom/scheduler/logic/dates/listOfDatesToWeeks.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisionType.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisionType.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisions.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/divisions/calculateDivisions.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/filtering/filterEvents.d.ts +0 -3
- package/dist/components/custom/scheduler/logic/filtering/filterEvents.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/filtering/filterResources.d.ts +0 -3
- package/dist/components/custom/scheduler/logic/filtering/filterResources.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/onDrop/OnDrop.d.ts +0 -13
- package/dist/components/custom/scheduler/logic/onDrop/OnDrop.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/pixels/getPixelsForEvent.d.ts +0 -17
- package/dist/components/custom/scheduler/logic/pixels/getPixelsForEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/pixels/heightScheduler.d.ts +0 -3
- package/dist/components/custom/scheduler/logic/pixels/heightScheduler.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/state_handle/doubleClickOnResource.d.ts +0 -4
- package/dist/components/custom/scheduler/logic/state_handle/doubleClickOnResource.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/state_handle/onDragOver.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/state_handle/onDragOver.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/state_handle/onDropEventToResource.d.ts +0 -5
- package/dist/components/custom/scheduler/logic/state_handle/onDropEventToResource.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/strings/compareStrings.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/strings/compareStrings.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/strings/getGUID.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/strings/getGUID.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/ui/checkIfSlotAvailable.d.ts +0 -3
- package/dist/components/custom/scheduler/logic/ui/checkIfSlotAvailable.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/ui/getEventsOfResource.d.ts +0 -4
- package/dist/components/custom/scheduler/logic/ui/getEventsOfResource.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/ui/getTimeHeaders.d.ts +0 -2
- package/dist/components/custom/scheduler/logic/ui/getTimeHeaders.d.ts.map +0 -1
- package/dist/components/custom/scheduler/logic/ui/isAllowedToMove.d.ts +0 -3
- package/dist/components/custom/scheduler/logic/ui/isAllowedToMove.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/CblDragAndDrop.d.ts +0 -11
- package/dist/components/custom/scheduler/state/CblDragAndDrop.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/CwSchedulerProps.d.ts +0 -43
- package/dist/components/custom/scheduler/state/CwSchedulerProps.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/Resource.d.ts +0 -14
- package/dist/components/custom/scheduler/state/Resource.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/State.d.ts +0 -19
- package/dist/components/custom/scheduler/state/State.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/cblEvent.d.ts +0 -18
- package/dist/components/custom/scheduler/state/cblEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/cblEventCompProps.d.ts +0 -7
- package/dist/components/custom/scheduler/state/cblEventCompProps.d.ts.map +0 -1
- package/dist/components/custom/scheduler/state/resourceCompProps2.d.ts +0 -6
- package/dist/components/custom/scheduler/state/resourceCompProps2.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/NewScheduler.d.ts +0 -29
- package/dist/components/custom/scheduler-new/presentation/NewScheduler.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/NewSchedulerUiEvents.d.ts +0 -80
- package/dist/components/custom/scheduler-new/presentation/NewSchedulerUiEvents.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/SchedulerPresenter.d.ts +0 -27
- package/dist/components/custom/scheduler-new/presentation/SchedulerPresenter.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/header/HeaderDivision.d.ts +0 -19
- package/dist/components/custom/scheduler-new/presentation/components/header/HeaderDivision.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/header/HeaderTitle.d.ts +0 -10
- package/dist/components/custom/scheduler-new/presentation/components/header/HeaderTitle.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/header/SchedulerHeader.d.ts +0 -5
- package/dist/components/custom/scheduler-new/presentation/components/header/SchedulerHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/header/SchedulerHeaderState.d.ts +0 -17
- package/dist/components/custom/scheduler-new/presentation/components/header/SchedulerHeaderState.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.d.ts +0 -8
- package/dist/components/custom/scheduler-new/presentation/components/row/BackgroundEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.d.ts +0 -17
- package/dist/components/custom/scheduler-new/presentation/components/row/DefaultRowHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/row/Event.d.ts +0 -34
- package/dist/components/custom/scheduler-new/presentation/components/row/Event.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/row/EventSideDrag.d.ts +0 -8
- package/dist/components/custom/scheduler-new/presentation/components/row/EventSideDrag.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts +0 -27
- package/dist/components/custom/scheduler-new/presentation/components/row/SchedulerRow.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/timeline/DivisionLine.d.ts +0 -10
- package/dist/components/custom/scheduler-new/presentation/components/timeline/DivisionLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/timeline/TimeLine.d.ts +0 -15
- package/dist/components/custom/scheduler-new/presentation/components/timeline/TimeLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/components/timeline/WeekEndLine.d.ts +0 -11
- package/dist/components/custom/scheduler-new/presentation/components/timeline/WeekEndLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/helpers.d.ts +0 -19
- package/dist/components/custom/scheduler-new/presentation/helpers.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/WeekendCalc.d.ts +0 -4
- package/dist/components/custom/scheduler-new/presentation/logic/WeekendCalc.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/dateFromPercentage.d.ts +0 -2
- package/dist/components/custom/scheduler-new/presentation/logic/dateFromPercentage.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/eventIsVisible.d.ts +0 -2
- package/dist/components/custom/scheduler-new/presentation/logic/eventIsVisible.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/getDefaultDivisions.d.ts +0 -6
- package/dist/components/custom/scheduler-new/presentation/logic/getDefaultDivisions.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/getDivisions.d.ts +0 -3
- package/dist/components/custom/scheduler-new/presentation/logic/getDivisions.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/getEventSizes.d.ts +0 -6
- package/dist/components/custom/scheduler-new/presentation/logic/getEventSizes.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/getLinesByDivisions.d.ts +0 -4
- package/dist/components/custom/scheduler-new/presentation/logic/getLinesByDivisions.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/getPercentageFromMouseEvent.d.ts +0 -2
- package/dist/components/custom/scheduler-new/presentation/logic/getPercentageFromMouseEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/separateEventsToInnerRows.d.ts +0 -3
- package/dist/components/custom/scheduler-new/presentation/logic/separateEventsToInnerRows.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/logic/sortByCategoryAndTitle.d.ts +0 -4
- package/dist/components/custom/scheduler-new/presentation/logic/sortByCategoryAndTitle.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/state/ui/SchedulerState.d.ts +0 -12
- package/dist/components/custom/scheduler-new/presentation/state/ui/SchedulerState.d.ts.map +0 -1
- package/dist/components/custom/scheduler-new/presentation/state/ui/WeekRange.d.ts +0 -5
- package/dist/components/custom/scheduler-new/presentation/state/ui/WeekRange.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/CwSchedulerComp2.d.ts +0 -24
- package/dist/components/custom/scheduler-temporal/CwSchedulerComp2.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/CwSuperSchedulerComp.d.ts +0 -86
- package/dist/components/custom/scheduler-temporal/CwSuperSchedulerComp.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/EventRender.d.ts +0 -10
- package/dist/components/custom/scheduler-temporal/components/EventRender.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/ResourceListRender.d.ts +0 -20
- package/dist/components/custom/scheduler-temporal/components/ResourceListRender.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/ResourceRender.d.ts +0 -14
- package/dist/components/custom/scheduler-temporal/components/ResourceRender.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/day_headers/DayHeader.d.ts +0 -11
- package/dist/components/custom/scheduler-temporal/components/day_headers/DayHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/day_headers/MonthHeader.d.ts +0 -11
- package/dist/components/custom/scheduler-temporal/components/day_headers/MonthHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/day_headers/MyDaysHeader.d.ts +0 -13
- package/dist/components/custom/scheduler-temporal/components/day_headers/MyDaysHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/day_headers/WeekHeader.d.ts +0 -11
- package/dist/components/custom/scheduler-temporal/components/day_headers/WeekHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/resources_title_list/ResourcesTitleList.d.ts +0 -14
- package/dist/components/custom/scheduler-temporal/components/resources_title_list/ResourcesTitleList.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/scheduler_content_area/SchedulerContentArea.d.ts +0 -23
- package/dist/components/custom/scheduler-temporal/components/scheduler_content_area/SchedulerContentArea.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/scheduler_header/SchedulerHeader.d.ts +0 -8
- package/dist/components/custom/scheduler-temporal/components/scheduler_header/SchedulerHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/scheduler_timeline/SchedulerTimeLine.d.ts +0 -12
- package/dist/components/custom/scheduler-temporal/components/scheduler_timeline/SchedulerTimeLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/time_headers/TimeHeader.d.ts +0 -12
- package/dist/components/custom/scheduler-temporal/components/time_headers/TimeHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/time_headers/TimeHeaderRow.d.ts +0 -10
- package/dist/components/custom/scheduler-temporal/components/time_headers/TimeHeaderRow.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/components/time_line/TimeLine.d.ts +0 -12
- package/dist/components/custom/scheduler-temporal/components/time_line/TimeLine.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/addMinutesToDateFromPx.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/dates/addMinutesToDateFromPx.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDates.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDates.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/dates/daysBetweenTwoDatesWithoutCeil.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/getFormatedTimeForHeader.d.ts +0 -7
- package/dist/components/custom/scheduler-temporal/logic/dates/getFormatedTimeForHeader.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/getMonthHeaderData.d.ts +0 -10
- package/dist/components/custom/scheduler-temporal/logic/dates/getMonthHeaderData.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/getUtcToday.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/dates/getUtcToday.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/getWeekHeaderDataFromWeekRange.d.ts +0 -7
- package/dist/components/custom/scheduler-temporal/logic/dates/getWeekHeaderDataFromWeekRange.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/dates/listOfDatesToWeeks.d.ts +0 -8
- package/dist/components/custom/scheduler-temporal/logic/dates/listOfDatesToWeeks.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/divisions/calculateDivisionType.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/divisions/calculateDivisionType.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/divisions/calculateDivisions.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/divisions/calculateDivisions.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.d.ts +0 -15
- package/dist/components/custom/scheduler-temporal/logic/filtering/filterAndProcessResources.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/filtering/filterEvents.d.ts +0 -3
- package/dist/components/custom/scheduler-temporal/logic/filtering/filterEvents.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/filtering/filterResources.d.ts +0 -3
- package/dist/components/custom/scheduler-temporal/logic/filtering/filterResources.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/onDrop/OnDrop.d.ts +0 -13
- package/dist/components/custom/scheduler-temporal/logic/onDrop/OnDrop.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.d.ts +0 -17
- package/dist/components/custom/scheduler-temporal/logic/pixels/getPixelsForEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/pixels/heightScheduler.d.ts +0 -3
- package/dist/components/custom/scheduler-temporal/logic/pixels/heightScheduler.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/state_handle/doubleClickOnResource.d.ts +0 -4
- package/dist/components/custom/scheduler-temporal/logic/state_handle/doubleClickOnResource.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/state_handle/onDragOver.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/state_handle/onDragOver.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/state_handle/onDropEventToResource.d.ts +0 -5
- package/dist/components/custom/scheduler-temporal/logic/state_handle/onDropEventToResource.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/state_handle/onResizeEvent.d.ts +0 -4
- package/dist/components/custom/scheduler-temporal/logic/state_handle/onResizeEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/strings/compareStrings.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/strings/compareStrings.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/strings/getGUID.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/strings/getGUID.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.d.ts +0 -3
- package/dist/components/custom/scheduler-temporal/logic/ui/checkIfSlotAvailable.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/ui/getEventsOfResource.d.ts +0 -6
- package/dist/components/custom/scheduler-temporal/logic/ui/getEventsOfResource.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/ui/getTimeHeaders.d.ts +0 -2
- package/dist/components/custom/scheduler-temporal/logic/ui/getTimeHeaders.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/logic/ui/isAllowedToMove.d.ts +0 -3
- package/dist/components/custom/scheduler-temporal/logic/ui/isAllowedToMove.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/state/CblDragAndDrop.d.ts +0 -11
- package/dist/components/custom/scheduler-temporal/state/CblDragAndDrop.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/state/CwSchedulerProps.d.ts +0 -43
- package/dist/components/custom/scheduler-temporal/state/CwSchedulerProps.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/state/Resource.d.ts +0 -14
- package/dist/components/custom/scheduler-temporal/state/Resource.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/state/State.d.ts +0 -25
- package/dist/components/custom/scheduler-temporal/state/State.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/state/cblEvent.d.ts +0 -18
- package/dist/components/custom/scheduler-temporal/state/cblEvent.d.ts.map +0 -1
- package/dist/components/custom/scheduler-temporal/state/cblEventCompProps.d.ts +0 -7
- package/dist/components/custom/scheduler-temporal/state/cblEventCompProps.d.ts.map +0 -1
- package/dist/components/custom/super-scheduler/PinRowHeader.d.ts +0 -15
- package/dist/components/custom/super-scheduler/PinRowHeader.d.ts.map +0 -1
- package/dist/components/custom/super-scheduler/SuperScheduler.d.ts +0 -25
- package/dist/components/custom/super-scheduler/SuperScheduler.d.ts.map +0 -1
- package/dist/components/custom/super-scheduler/SuperSchedulerEvents.d.ts +0 -13
- package/dist/components/custom/super-scheduler/SuperSchedulerEvents.d.ts.map +0 -1
- package/dist/components/custom/super-scheduler/SuperSchedulerPresenter.d.ts +0 -9
- package/dist/components/custom/super-scheduler/SuperSchedulerPresenter.d.ts.map +0 -1
- package/dist/components/display/data/accordion/CwAccordionContainer.d.ts +0 -14
- package/dist/components/display/data/accordion/CwAccordionContainer.d.ts.map +0 -1
- package/dist/components/display/data/generic_tooltip/CwGenericTooltip.d.ts +0 -15
- package/dist/components/display/data/generic_tooltip/CwGenericTooltip.d.ts.map +0 -1
- package/dist/components/display/data/table/CwTable.d.ts +0 -102
- package/dist/components/display/data/table/CwTable.d.ts.map +0 -1
- package/dist/components/display/graphics/icon/CwIcon.d.ts +0 -15
- package/dist/components/display/graphics/icon/CwIcon.d.ts.map +0 -1
- package/dist/components/display/graphics/loading/CwLoading.d.ts +0 -42
- package/dist/components/display/graphics/loading/CwLoading.d.ts.map +0 -1
- package/dist/components/display/graphics/loading-small/CwLoadingSmall.d.ts +0 -18
- package/dist/components/display/graphics/loading-small/CwLoadingSmall.d.ts.map +0 -1
- package/dist/components/display/text/heading/CwHeadingMain.d.ts +0 -3
- package/dist/components/display/text/heading/CwHeadingMain.d.ts.map +0 -1
- package/dist/components/display/text/heading/CwHeadingSecond.d.ts +0 -3
- package/dist/components/display/text/heading/CwHeadingSecond.d.ts.map +0 -1
- package/dist/components/display/text/label/CwLabel.d.ts +0 -28
- package/dist/components/display/text/label/CwLabel.d.ts.map +0 -1
- package/dist/components/display/text/message/CwMessage.d.ts +0 -31
- package/dist/components/display/text/message/CwMessage.d.ts.map +0 -1
- package/dist/components/display/text/tag/CwChip.d.ts +0 -36
- package/dist/components/display/text/tag/CwChip.d.ts.map +0 -1
- package/dist/components/display/text/tag/CwTag.d.ts.map +0 -1
- package/dist/components/display/text/tooltip/CwTooltip.d.ts +0 -8
- package/dist/components/display/text/tooltip/CwTooltip.d.ts.map +0 -1
- package/dist/components/layout/align/CwAlign.d.ts +0 -54
- package/dist/components/layout/align/CwAlign.d.ts.map +0 -1
- package/dist/components/layout/card/CwCard.d.ts +0 -61
- package/dist/components/layout/card/CwCard.d.ts.map +0 -1
- package/dist/components/layout/card/CwCardList.d.ts +0 -32
- package/dist/components/layout/card/CwCardList.d.ts.map +0 -1
- package/dist/components/layout/dialog/CwDialog.d.ts +0 -28
- package/dist/components/layout/dialog/CwDialog.d.ts.map +0 -1
- package/dist/components/layout/dialog/CwDialogManager.d.ts +0 -11
- package/dist/components/layout/dialog/CwDialogManager.d.ts.map +0 -1
- package/dist/components/layout/list/details/CwExpandable.d.ts +0 -23
- package/dist/components/layout/list/details/CwExpandable.d.ts.map +0 -1
- package/dist/components/layout/list/key-value/CwKeyValueList.d.ts +0 -33
- package/dist/components/layout/list/key-value/CwKeyValueList.d.ts.map +0 -1
- package/dist/components/layout/modal/CwModalReportFunctional.d.ts +0 -15
- package/dist/components/layout/modal/CwModalReportFunctional.d.ts.map +0 -1
- package/dist/components/layout/modal/hover/CwModalHover.d.ts +0 -19
- package/dist/components/layout/modal/hover/CwModalHover.d.ts.map +0 -1
- package/dist/components/layout/modal/legacy/cw_modal.d.ts +0 -22
- package/dist/components/layout/modal/legacy/cw_modal.d.ts.map +0 -1
- package/dist/components/layout/modal/legacy/cw_modal_confirm.d.ts +0 -16
- package/dist/components/layout/modal/legacy/cw_modal_confirm.d.ts.map +0 -1
- package/dist/components/layout/modal/legacy/cw_modal_iframe.d.ts +0 -21
- package/dist/components/layout/modal/legacy/cw_modal_iframe.d.ts.map +0 -1
- package/dist/components/layout/modal/legacy/cw_modal_report.d.ts +0 -32
- package/dist/components/layout/modal/legacy/cw_modal_report.d.ts.map +0 -1
- package/dist/components/layout/table/grouped/CwTableGrouped.d.ts +0 -80
- package/dist/components/layout/table/grouped/CwTableGrouped.d.ts.map +0 -1
- package/dist/components/layout/tabs/CwTabs.d.ts +0 -46
- package/dist/components/layout/tabs/CwTabs.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- /package/dist/{components/control/choice → deprecated/components}/dropdown/CwDropdownContainer.d.ts +0 -0
- /package/dist/{components/control/choice/dropdown → src/components/control/choice/deprecated}/CwDropdown.d.ts +0 -0
- /package/dist/{components/control/choice/dropdown → src/components/control/choice/deprecated}/CwDropdownNavigation.d.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -4,14 +4,13 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var client = require('react-dom/client');
|
|
6
6
|
var reactDom = require('react-dom');
|
|
7
|
-
var antd = require('antd');
|
|
8
7
|
var Draggable = require('react-draggable');
|
|
9
8
|
var moment = require('moment');
|
|
10
9
|
var dateFns = require('date-fns');
|
|
11
10
|
var locale = require('date-fns/locale');
|
|
12
11
|
var reactDayPicker = require('react-day-picker');
|
|
13
12
|
require('react-day-picker/dist/style.css');
|
|
14
|
-
var
|
|
13
|
+
var moment$1 = require('moment-timezone');
|
|
15
14
|
var reactWindow = require('react-window');
|
|
16
15
|
|
|
17
16
|
function _interopNamespaceDefault(e) {
|
|
@@ -83,10 +82,6 @@ function CwLabel(props) {
|
|
|
83
82
|
return (jsxRuntime.jsx("label", { className: "cw-label", style: { textAlign: justify, width: labelWidth, height: labelHeight, margin: margin ?? "1px 0 0 0" }, ...labelProps, children: labelProps.children ?? text }));
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
function CwTooltip(CwelltTooltipProps) {
|
|
87
|
-
return (jsxRuntime.jsxs("div", { className: "cwelltTooltip", children: [jsxRuntime.jsx("div", { className: "cwelltTooltipTitle", style: CwelltTooltipProps.tooltipTitleStyle, children: jsxRuntime.jsx("span", { children: CwelltTooltipProps.tooltipTitle }) }), CwelltTooltipProps.children] }));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
85
|
function colorToHSL(color) {
|
|
91
86
|
const hexColor = colorToHEX(color);
|
|
92
87
|
const hex = hexColor.replace('#', '');
|
|
@@ -238,7 +233,7 @@ const CwChip = ({ label, colorScheme = 'info', customColor, variant = 'soft', cl
|
|
|
238
233
|
className,
|
|
239
234
|
closable ? 'cw-chip-closable' : '',
|
|
240
235
|
].filter(Boolean).join(' ');
|
|
241
|
-
return (jsxRuntime.jsxs("span", { className: chipClassNames, "data-color-scheme": colorScheme, "data-variant": variant, style: chipStyle, children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), jsxRuntime.jsx("span", { children: label }), closable && (jsxRuntime.jsx("button", { className: "cw-chip-close-button", onClick: handleClose, "aria-label": "Remove", type: "button", children: jsxRuntime.jsx("span", { className: "cwi-icons cwi-close" }) }))] }));
|
|
236
|
+
return (jsxRuntime.jsxs("span", { className: chipClassNames, "data-color-scheme": colorScheme, "data-variant": variant, style: chipStyle, children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), label && jsxRuntime.jsx("span", { children: label }), closable && (jsxRuntime.jsx("button", { className: "cw-chip-close-button", onClick: handleClose, "aria-label": "Remove", type: "button", children: jsxRuntime.jsx("span", { className: "cwi-icons cwi-close" }) }))] }));
|
|
242
237
|
};
|
|
243
238
|
|
|
244
239
|
const CW_DEFAULT_MESSAGE_DURATION = 2000;
|
|
@@ -639,33 +634,33 @@ function CwLoadingSmall(CwelltLoadingAppointements) {
|
|
|
639
634
|
jsxRuntime.jsx("div", {})) }));
|
|
640
635
|
}
|
|
641
636
|
|
|
642
|
-
var styles$
|
|
637
|
+
var styles$o = {"cw-generic-tooltip-content":"cw-generic-tooltip-module__cw-generic-tooltip-content__la-Si","cw-generic-tooltip":"cw-generic-tooltip-module__cw-generic-tooltip__Ij76M"};
|
|
643
638
|
|
|
644
639
|
// Constants moved outside to prevent recreation
|
|
645
|
-
const margin = 16;
|
|
640
|
+
const margin$1 = 16;
|
|
646
641
|
const defaultPosition = "right";
|
|
647
|
-
const positionOrder = ['right', 'bottom', 'left', 'top'];
|
|
642
|
+
const positionOrder$1 = ['right', 'bottom', 'left', 'top'];
|
|
648
643
|
// Memoized utility functions to prevent recreation
|
|
649
|
-
const calculatePositionForSide = (position, triggerRect, tooltipRect) => {
|
|
644
|
+
const calculatePositionForSide$1 = (position, triggerRect, tooltipRect) => {
|
|
650
645
|
switch (position) {
|
|
651
646
|
case 'left':
|
|
652
647
|
return {
|
|
653
648
|
top: triggerRect.top + (triggerRect.height - tooltipRect.height) / 2,
|
|
654
|
-
left: triggerRect.left - tooltipRect.width - margin
|
|
649
|
+
left: triggerRect.left - tooltipRect.width - margin$1
|
|
655
650
|
};
|
|
656
651
|
case 'right':
|
|
657
652
|
return {
|
|
658
653
|
top: triggerRect.top + (triggerRect.height - tooltipRect.height) / 2,
|
|
659
|
-
left: triggerRect.right + margin
|
|
654
|
+
left: triggerRect.right + margin$1
|
|
660
655
|
};
|
|
661
656
|
case 'top':
|
|
662
657
|
return {
|
|
663
|
-
top: triggerRect.top - tooltipRect.height - margin,
|
|
658
|
+
top: triggerRect.top - tooltipRect.height - margin$1,
|
|
664
659
|
left: triggerRect.left + (triggerRect.width - tooltipRect.width) / 2
|
|
665
660
|
};
|
|
666
661
|
case 'bottom':
|
|
667
662
|
return {
|
|
668
|
-
top: triggerRect.bottom + margin,
|
|
663
|
+
top: triggerRect.bottom + margin$1,
|
|
669
664
|
left: triggerRect.left + (triggerRect.width - tooltipRect.width) / 2
|
|
670
665
|
};
|
|
671
666
|
}
|
|
@@ -706,26 +701,26 @@ const useTooltipPosition = (isVisible, containerRef, preferredPosition, tooltipC
|
|
|
706
701
|
const triggerRect = containerRef.current.getBoundingClientRect();
|
|
707
702
|
const tooltipRect = tooltipElement.getBoundingClientRect();
|
|
708
703
|
// Try preferred position first
|
|
709
|
-
const position = calculatePositionForSide(preferredPosition, triggerRect, tooltipRect);
|
|
704
|
+
const position = calculatePositionForSide$1(preferredPosition, triggerRect, tooltipRect);
|
|
710
705
|
const windowWidth = window.innerWidth;
|
|
711
706
|
const windowHeight = window.innerHeight;
|
|
712
707
|
// Quick bounds check
|
|
713
|
-
if (position.left >= margin &&
|
|
714
|
-
position.top >= margin &&
|
|
715
|
-
position.left + tooltipRect.width <= windowWidth - margin &&
|
|
716
|
-
position.top + tooltipRect.height <= windowHeight - margin) {
|
|
708
|
+
if (position.left >= margin$1 &&
|
|
709
|
+
position.top >= margin$1 &&
|
|
710
|
+
position.left + tooltipRect.width <= windowWidth - margin$1 &&
|
|
711
|
+
position.top + tooltipRect.height <= windowHeight - margin$1) {
|
|
717
712
|
setTooltipState({ position, actualPosition: preferredPosition });
|
|
718
713
|
return;
|
|
719
714
|
}
|
|
720
715
|
// Try other positions if preferred doesn't fit
|
|
721
|
-
for (const pos of positionOrder) {
|
|
716
|
+
for (const pos of positionOrder$1) {
|
|
722
717
|
if (pos === preferredPosition)
|
|
723
718
|
continue;
|
|
724
|
-
const newPosition = calculatePositionForSide(pos, triggerRect, tooltipRect);
|
|
725
|
-
if (newPosition.left >= margin &&
|
|
726
|
-
newPosition.top >= margin &&
|
|
727
|
-
newPosition.left + tooltipRect.width <= windowWidth - margin &&
|
|
728
|
-
newPosition.top + tooltipRect.height <= windowHeight - margin) {
|
|
719
|
+
const newPosition = calculatePositionForSide$1(pos, triggerRect, tooltipRect);
|
|
720
|
+
if (newPosition.left >= margin$1 &&
|
|
721
|
+
newPosition.top >= margin$1 &&
|
|
722
|
+
newPosition.left + tooltipRect.width <= windowWidth - margin$1 &&
|
|
723
|
+
newPosition.top + tooltipRect.height <= windowHeight - margin$1) {
|
|
729
724
|
setTooltipState({ position: newPosition, actualPosition: pos });
|
|
730
725
|
return;
|
|
731
726
|
}
|
|
@@ -743,19 +738,31 @@ const useTooltipPosition = (isVisible, containerRef, preferredPosition, tooltipC
|
|
|
743
738
|
}, [updatePosition]);
|
|
744
739
|
return tooltipState;
|
|
745
740
|
};
|
|
746
|
-
|
|
741
|
+
/**
|
|
742
|
+
* Standalone tooltip component. Each instance manages its own portal,
|
|
743
|
+
* requiring no external dependencies or global setup.
|
|
744
|
+
*
|
|
745
|
+
* Suitable for low-density use cases with few tooltip instances.
|
|
746
|
+
* For high-density scenarios (e.g. schedulers, tables, lists),
|
|
747
|
+
* prefer CwTooltipNew which shares a single DOM portal for better performance.
|
|
748
|
+
*
|
|
749
|
+
* @remarks Not formally deprecated, but CwTooltipNew is now the recommended
|
|
750
|
+
* approach for new implementations. Cannot be deprecated yet due to potential use on projects such as Operon and Improve.
|
|
751
|
+
*
|
|
752
|
+
* @see CwTooltipNew
|
|
753
|
+
*/
|
|
747
754
|
const CwGenericTooltip = ({ children, content = null, position = defaultPosition, dissapearsWhenHover = false, hide = false, overlayStyle = {}, showDelay = 0, displayInline = false, }) => {
|
|
748
755
|
const [isVisible, setIsVisible] = React.useState(false);
|
|
749
756
|
const containerRef = React.useRef(null);
|
|
750
757
|
const { setTooltipTimeout, clearTooltipTimeout } = useTooltipDelay(() => {
|
|
751
758
|
setIsVisible(true);
|
|
752
759
|
}, showDelay);
|
|
753
|
-
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$
|
|
760
|
+
const { position: tooltipPosition, actualPosition } = useTooltipPosition(isVisible, containerRef, position, styles$o["cw-generic-tooltip-content"]);
|
|
754
761
|
// Memoize tooltip content creation
|
|
755
762
|
const tooltipContent = React.useMemo(() => {
|
|
756
763
|
if (hide || !isVisible || !content)
|
|
757
764
|
return null;
|
|
758
|
-
return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$
|
|
765
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { className: styles$o["cw-generic-tooltip-content"], "data-position": actualPosition, "data-visible": isVisible, "data-inline": displayInline, style: {
|
|
759
766
|
position: 'fixed',
|
|
760
767
|
top: `${tooltipPosition.top}px`,
|
|
761
768
|
left: `${tooltipPosition.left}px`,
|
|
@@ -770,9 +777,310 @@ const CwGenericTooltip = ({ children, content = null, position = defaultPosition
|
|
|
770
777
|
clearTooltipTimeout();
|
|
771
778
|
setIsVisible(false);
|
|
772
779
|
}, [clearTooltipTimeout]);
|
|
773
|
-
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$
|
|
780
|
+
return (jsxRuntime.jsxs("div", { ref: containerRef, className: styles$o["cw-generic-tooltip"], onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, children: [tooltipContent, children] }));
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
var styles$n = {"cw-tooltip-content":"cw-tooltip-module__cw-tooltip-content__RZczd","cw-tooltip":"cw-tooltip-module__cw-tooltip__1KYig"};
|
|
784
|
+
|
|
785
|
+
// Constants
|
|
786
|
+
const margin = 16;
|
|
787
|
+
const positionOrder = ['right', 'bottom', 'left', 'top'];
|
|
788
|
+
// Singleton state
|
|
789
|
+
let currentState = {
|
|
790
|
+
isVisible: false,
|
|
791
|
+
content: null,
|
|
792
|
+
triggerRect: null,
|
|
793
|
+
position: "right",
|
|
794
|
+
dissapearsWhenHover: false
|
|
795
|
+
};
|
|
796
|
+
const stateUpdateCallbacks = new Set();
|
|
797
|
+
let hideTimeout;
|
|
798
|
+
// Public API
|
|
799
|
+
const showTooltip = (content, triggerElement, position = "right", dissapearsWhenHover = false) => {
|
|
800
|
+
if (hideTimeout !== undefined) {
|
|
801
|
+
window.clearTimeout(hideTimeout);
|
|
802
|
+
hideTimeout = undefined;
|
|
803
|
+
}
|
|
804
|
+
currentState = {
|
|
805
|
+
isVisible: true,
|
|
806
|
+
content,
|
|
807
|
+
triggerRect: triggerElement.getBoundingClientRect(),
|
|
808
|
+
position,
|
|
809
|
+
dissapearsWhenHover
|
|
810
|
+
};
|
|
811
|
+
stateUpdateCallbacks.forEach((cb) => cb());
|
|
812
|
+
};
|
|
813
|
+
const hideTooltip = (delay = 100) => {
|
|
814
|
+
if (hideTimeout !== undefined) {
|
|
815
|
+
window.clearTimeout(hideTimeout);
|
|
816
|
+
}
|
|
817
|
+
hideTimeout = window.setTimeout(() => {
|
|
818
|
+
hideTimeout = undefined;
|
|
819
|
+
currentState = {
|
|
820
|
+
...currentState,
|
|
821
|
+
isVisible: false
|
|
822
|
+
};
|
|
823
|
+
stateUpdateCallbacks.forEach((cb) => cb());
|
|
824
|
+
}, delay);
|
|
825
|
+
};
|
|
826
|
+
// Position calculation
|
|
827
|
+
const calculatePositionForSide = (position, triggerRect, tooltipRect) => {
|
|
828
|
+
switch (position) {
|
|
829
|
+
case 'left':
|
|
830
|
+
return {
|
|
831
|
+
top: triggerRect.top + (triggerRect.height - tooltipRect.height) / 2,
|
|
832
|
+
left: triggerRect.left - tooltipRect.width - margin
|
|
833
|
+
};
|
|
834
|
+
case 'right':
|
|
835
|
+
return {
|
|
836
|
+
top: triggerRect.top + (triggerRect.height - tooltipRect.height) / 2,
|
|
837
|
+
left: triggerRect.right + margin
|
|
838
|
+
};
|
|
839
|
+
case 'top':
|
|
840
|
+
return {
|
|
841
|
+
top: triggerRect.top - tooltipRect.height - margin,
|
|
842
|
+
left: triggerRect.left + (triggerRect.width - tooltipRect.width) / 2
|
|
843
|
+
};
|
|
844
|
+
case 'bottom':
|
|
845
|
+
return {
|
|
846
|
+
top: triggerRect.bottom + margin,
|
|
847
|
+
left: triggerRect.left + (triggerRect.width - tooltipRect.width) / 2
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
const MANAGER_CONTAINER_CLASS = "cw-tooltip-manager";
|
|
852
|
+
const ensureTooltipManager = () => {
|
|
853
|
+
if (document.querySelector(`.${MANAGER_CONTAINER_CLASS}`))
|
|
854
|
+
return;
|
|
855
|
+
const container = document.createElement("div");
|
|
856
|
+
container.className = MANAGER_CONTAINER_CLASS;
|
|
857
|
+
document.body.appendChild(container);
|
|
858
|
+
const root = client.createRoot(container);
|
|
859
|
+
root.render(jsxRuntime.jsx(CwTooltipManager, {}));
|
|
860
|
+
};
|
|
861
|
+
// Main component
|
|
862
|
+
/**
|
|
863
|
+
* Global tooltip renderer. Manages a single portal instance in the DOM,
|
|
864
|
+
* shared across all CwTooltipNew instances for optimal performance.
|
|
865
|
+
*
|
|
866
|
+
* Mount once at the app root, or let CwTooltipNew handle it automatically
|
|
867
|
+
* via ensureTooltipManager().
|
|
868
|
+
*
|
|
869
|
+
* @see CwTooltipNew
|
|
870
|
+
* @see showTooltip
|
|
871
|
+
* @see hideTooltip
|
|
872
|
+
*/
|
|
873
|
+
const CwTooltipManager = () => {
|
|
874
|
+
const [state, setState] = React.useState(currentState);
|
|
875
|
+
const [tooltipPosition, setTooltipPosition] = React.useState({ top: 0, left: 0 });
|
|
876
|
+
const [actualPosition, setActualPosition] = React.useState("right");
|
|
877
|
+
const [isPositioned, setIsPositioned] = React.useState(false);
|
|
878
|
+
const tooltipRef = React.useRef(null);
|
|
879
|
+
const [isMeasuring, setIsMeasuring] = React.useState(false);
|
|
880
|
+
// Register update callback
|
|
881
|
+
React.useEffect(() => {
|
|
882
|
+
const update = () => {
|
|
883
|
+
setState({ ...currentState });
|
|
884
|
+
if (!currentState.isVisible)
|
|
885
|
+
setIsMeasuring(false);
|
|
886
|
+
};
|
|
887
|
+
stateUpdateCallbacks.add(update);
|
|
888
|
+
return () => {
|
|
889
|
+
stateUpdateCallbacks.delete(update);
|
|
890
|
+
};
|
|
891
|
+
}, []);
|
|
892
|
+
// Function to calculate position
|
|
893
|
+
const calculatePosition = React.useCallback(() => {
|
|
894
|
+
if (!state.isVisible || !state.triggerRect || !tooltipRef.current) {
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
898
|
+
const windowWidth = window.innerWidth;
|
|
899
|
+
const windowHeight = window.innerHeight;
|
|
900
|
+
// Try preferred position first
|
|
901
|
+
let position = calculatePositionForSide(state.position, state.triggerRect, tooltipRect);
|
|
902
|
+
// Check if it fits
|
|
903
|
+
if (position.left >= margin &&
|
|
904
|
+
position.top >= margin &&
|
|
905
|
+
position.left + tooltipRect.width <= windowWidth - margin &&
|
|
906
|
+
position.top + tooltipRect.height <= windowHeight - margin) {
|
|
907
|
+
setTooltipPosition(position);
|
|
908
|
+
setActualPosition(state.position);
|
|
909
|
+
setIsPositioned(true);
|
|
910
|
+
setIsMeasuring(false);
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
// Try other positions
|
|
914
|
+
for (const pos of positionOrder) {
|
|
915
|
+
if (pos === state.position)
|
|
916
|
+
continue;
|
|
917
|
+
const newPosition = calculatePositionForSide(pos, state.triggerRect, tooltipRect);
|
|
918
|
+
if (newPosition.left >= margin &&
|
|
919
|
+
newPosition.top >= margin &&
|
|
920
|
+
newPosition.left + tooltipRect.width <= windowWidth - margin &&
|
|
921
|
+
newPosition.top + tooltipRect.height <= windowHeight - margin) {
|
|
922
|
+
setTooltipPosition(newPosition);
|
|
923
|
+
setActualPosition(pos);
|
|
924
|
+
setIsPositioned(true);
|
|
925
|
+
setIsMeasuring(false);
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
// Fallback if none fit - adjust to fit within viewport
|
|
930
|
+
const triggerRect = state.triggerRect;
|
|
931
|
+
// Calculate available space around the trigger element
|
|
932
|
+
const spaceTop = triggerRect.top;
|
|
933
|
+
const spaceBottom = windowHeight - triggerRect.bottom;
|
|
934
|
+
const spaceLeft = triggerRect.left;
|
|
935
|
+
const spaceRight = windowWidth - triggerRect.right;
|
|
936
|
+
// Find the side with the most space
|
|
937
|
+
let bestPosition;
|
|
938
|
+
const maxSpace = Math.max(spaceTop, spaceBottom, spaceLeft, spaceRight);
|
|
939
|
+
if (maxSpace === spaceRight) {
|
|
940
|
+
bestPosition = 'right';
|
|
941
|
+
}
|
|
942
|
+
else if (maxSpace === spaceBottom) {
|
|
943
|
+
bestPosition = 'bottom';
|
|
944
|
+
}
|
|
945
|
+
else if (maxSpace === spaceLeft) {
|
|
946
|
+
bestPosition = 'left';
|
|
947
|
+
}
|
|
948
|
+
else {
|
|
949
|
+
bestPosition = 'top';
|
|
950
|
+
}
|
|
951
|
+
// Find the coordinates for the best position
|
|
952
|
+
let bestPositionCoords = calculatePositionForSide(bestPosition, triggerRect, tooltipRect);
|
|
953
|
+
// Adjust to fit within the viewport (but without covering the trigger element)
|
|
954
|
+
if (bestPositionCoords.left < margin) {
|
|
955
|
+
bestPositionCoords.left = margin;
|
|
956
|
+
}
|
|
957
|
+
else if (bestPositionCoords.left + tooltipRect.width > windowWidth - margin) {
|
|
958
|
+
bestPositionCoords.left = windowWidth - tooltipRect.width - margin;
|
|
959
|
+
}
|
|
960
|
+
if (bestPositionCoords.top < margin) {
|
|
961
|
+
bestPositionCoords.top = margin;
|
|
962
|
+
}
|
|
963
|
+
else if (bestPositionCoords.top + tooltipRect.height > windowHeight - margin) {
|
|
964
|
+
bestPositionCoords.top = windowHeight - tooltipRect.height - margin;
|
|
965
|
+
}
|
|
966
|
+
setTooltipPosition(bestPositionCoords);
|
|
967
|
+
setActualPosition(bestPosition);
|
|
968
|
+
setIsPositioned(true);
|
|
969
|
+
setIsMeasuring(false);
|
|
970
|
+
}, [state]);
|
|
971
|
+
// Reset isPositioned when state changes (new tooltip)
|
|
972
|
+
// useLayouteffect is used to ensure it runs before the browser paints, preventing flashes of incorrectly positioned tooltips
|
|
973
|
+
React.useLayoutEffect(() => {
|
|
974
|
+
if (state.isVisible) {
|
|
975
|
+
setIsPositioned(false);
|
|
976
|
+
// Calculate position in next frame
|
|
977
|
+
calculatePosition();
|
|
978
|
+
}
|
|
979
|
+
}, [state.isVisible, state.triggerRect, state.content, calculatePosition]);
|
|
980
|
+
// ResizeObserver to reposition when content size changes (e.g., data loads)
|
|
981
|
+
React.useLayoutEffect(() => {
|
|
982
|
+
if (!state.isVisible || !tooltipRef.current) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
986
|
+
setIsMeasuring(true);
|
|
987
|
+
setIsPositioned(false);
|
|
988
|
+
calculatePosition();
|
|
989
|
+
});
|
|
990
|
+
resizeObserver.observe(tooltipRef.current);
|
|
991
|
+
return () => {
|
|
992
|
+
resizeObserver.disconnect();
|
|
993
|
+
};
|
|
994
|
+
}, [state.isVisible, calculatePosition]);
|
|
995
|
+
if (!state.isVisible || !state.content) {
|
|
996
|
+
return null;
|
|
997
|
+
}
|
|
998
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { ref: tooltipRef, className: styles$n["cw-tooltip-content"], "data-position": actualPosition, "data-visible": state.isVisible, style: {
|
|
999
|
+
top: `${tooltipPosition.top}px`,
|
|
1000
|
+
left: `${tooltipPosition.left}px`,
|
|
1001
|
+
opacity: (isPositioned && !isMeasuring) ? 1 : 0,
|
|
1002
|
+
}, onMouseEnter: () => state.dissapearsWhenHover && hideTooltip(), children: state.content }), document.body);
|
|
1003
|
+
};
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Tooltip component backed by the global CwTooltipManager singleton.
|
|
1007
|
+
* More performant than CwGenericTooltip for high-density scenarios (e.g. schedulers)
|
|
1008
|
+
* as it shares a single DOM portal across all instances.
|
|
1009
|
+
*
|
|
1010
|
+
* Self-initializes the Manager if not already mounted via ensureTooltipManager().
|
|
1011
|
+
* Drop-in replacement for CwGenericTooltip with the same API.
|
|
1012
|
+
*
|
|
1013
|
+
* @see CwTooltipManager
|
|
1014
|
+
* @see CwGenericTooltip
|
|
1015
|
+
*/
|
|
1016
|
+
const CwTooltipNew = ({ children, content = null, position = "right", dissapearsWhenHover = false, hide = false, showDelay = 0, overlayStyle = {}, displayInline = false, }) => {
|
|
1017
|
+
const containerRef = React.useRef(null);
|
|
1018
|
+
const timeoutRef = React.useRef();
|
|
1019
|
+
const handleMouseEnter = React.useCallback(() => {
|
|
1020
|
+
if (hide || !content || !containerRef.current)
|
|
1021
|
+
return;
|
|
1022
|
+
if (timeoutRef.current) {
|
|
1023
|
+
window.clearTimeout(timeoutRef.current);
|
|
1024
|
+
}
|
|
1025
|
+
if (showDelay > 0) {
|
|
1026
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
1027
|
+
if (containerRef.current) {
|
|
1028
|
+
showTooltip(content, containerRef.current, position, dissapearsWhenHover);
|
|
1029
|
+
}
|
|
1030
|
+
}, showDelay);
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
showTooltip(content, containerRef.current, position, dissapearsWhenHover);
|
|
1034
|
+
}
|
|
1035
|
+
}, [content, position, showDelay, hide, dissapearsWhenHover]);
|
|
1036
|
+
const handleMouseLeave = React.useCallback(() => {
|
|
1037
|
+
if (timeoutRef.current) {
|
|
1038
|
+
window.clearTimeout(timeoutRef.current);
|
|
1039
|
+
}
|
|
1040
|
+
hideTooltip();
|
|
1041
|
+
}, []);
|
|
1042
|
+
// Cleanup on unmount to prevent memory leaks
|
|
1043
|
+
React.useEffect(() => {
|
|
1044
|
+
return () => {
|
|
1045
|
+
if (timeoutRef.current) {
|
|
1046
|
+
window.clearTimeout(timeoutRef.current);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
}, []);
|
|
1050
|
+
// Hide tooltip when mousedown / drag events
|
|
1051
|
+
React.useEffect(() => {
|
|
1052
|
+
const handleDocumentMouseDown = () => {
|
|
1053
|
+
if (timeoutRef.current) {
|
|
1054
|
+
window.clearTimeout(timeoutRef.current);
|
|
1055
|
+
}
|
|
1056
|
+
hideTooltip();
|
|
1057
|
+
};
|
|
1058
|
+
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
1059
|
+
return () => {
|
|
1060
|
+
document.removeEventListener("mousedown", handleDocumentMouseDown);
|
|
1061
|
+
};
|
|
1062
|
+
}, []);
|
|
1063
|
+
React.useEffect(() => {
|
|
1064
|
+
ensureTooltipManager();
|
|
1065
|
+
}, []);
|
|
1066
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: overlayStyle, "data-inline": displayInline, className: styles$n["cw-tooltip"], children: children }));
|
|
774
1067
|
};
|
|
775
1068
|
|
|
1069
|
+
function CwButton({ text, variant = 'solid', color = 'primary', className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }) {
|
|
1070
|
+
// Build CSS classes based on variant and props
|
|
1071
|
+
let buttonClass = `cw-button-${variant}`;
|
|
1072
|
+
// Add icon class only for icon variant without children
|
|
1073
|
+
if (variant === 'icon' && icon && !children) {
|
|
1074
|
+
buttonClass += ` cwi-${icon}`;
|
|
1075
|
+
}
|
|
1076
|
+
if (className) {
|
|
1077
|
+
buttonClass += ` ${className}`;
|
|
1078
|
+
}
|
|
1079
|
+
const tooltipContent = title || (variant === 'icon' && text ? text : undefined);
|
|
1080
|
+
const buttonElement = (jsxRuntime.jsx("button", { type: "button", className: buttonClass, ...buttonProps, "data-color": color, "aria-label": tooltipContent, children: variant === 'icon' ? null : (children ?? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), text && jsxRuntime.jsx("strong", { children: text })] }))) }));
|
|
1081
|
+
return tooltipContent ? (jsxRuntime.jsx(CwTooltipNew, { content: tooltipContent, position: tooltipPosition, displayInline: true, children: buttonElement })) : (buttonElement);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
776
1084
|
// Reference for draggable modal
|
|
777
1085
|
/**
|
|
778
1086
|
* **Note:** For new development, we recommend using {@link CwDialog} instead. CwModal remains supported for existing code.
|
|
@@ -786,10 +1094,6 @@ function CwModal(custModalProps) {
|
|
|
786
1094
|
const isHide = custModalProps.hideModalActions !== null && custModalProps.hideModalActions !== undefined
|
|
787
1095
|
? custModalProps.hideModalActions
|
|
788
1096
|
: false;
|
|
789
|
-
// [ Show custom button === true ? show : default buttons ]
|
|
790
|
-
const isShowcustButton = custModalProps.ShowcustButton !== null && custModalProps.ShowcustButton !== undefined
|
|
791
|
-
? custModalProps.ShowcustButton
|
|
792
|
-
: false;
|
|
793
1097
|
const cwelltOnMouseOverModal = () => {
|
|
794
1098
|
setModalDisabled(false);
|
|
795
1099
|
};
|
|
@@ -811,13 +1115,12 @@ function CwModal(custModalProps) {
|
|
|
811
1115
|
};
|
|
812
1116
|
return (jsxRuntime.jsx("div", { children: custModalProps.modalState && (jsxRuntime.jsxs("div", { className: custModalProps.classNameModalOverlay + " cwelltModalOverlay", children: [jsxRuntime.jsx("div", { className: "cwelltModalOverlayBg", onClick: custModalProps.onCloseModal }), jsxRuntime.jsx(Draggable, { disabled: isModalDisabled, axis: "both", nodeRef: draggableRef, children: jsxRuntime.jsxs("div", { className: custModalProps.classNameModal + " cwelltContainerModal", ref: draggableRef, style: widthModalDef !== "40em" ? modalStyle.widthCustomStyle : modalStyle.widthDefStyle, children: [jsxRuntime.jsxs("div", { className: "cwelltModalHeader", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: [jsxRuntime.jsx("div", { className: "cwelltModalTitle", children: custModalProps.titleModal }), jsxRuntime.jsx("button", { className: "cwelltBtnCloseModal", onClick: custModalProps.onCloseModal, children: jsxRuntime.jsx("span", { className: "cwelltCloseIcon" }) })] }), jsxRuntime.jsx("div", { className: "cwelltModalBody", children: jsxRuntime.jsx("div", { className: "cwelltContainerModalBody", style: { position: "relative" }, children: custModalProps.children }) }), isHide === false ? (
|
|
813
1117
|
// [ false : show modal ]
|
|
814
|
-
jsxRuntime.
|
|
815
|
-
custModalProps.custButtonClassName, onClick: custModalProps.custButtonClick }) }) })) : (jsxRuntime.jsx("div", {}))] })) : (
|
|
1118
|
+
jsxRuntime.jsx("footer", { className: "legacy-modal-footer", onMouseOver: cwelltOnMouseOverModal, onMouseOut: cwelltOnMouseOutModal, children: jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: custModalProps.onSaveModal, form: custModalProps.formSaveModal, hidden: custModalProps.HideBtnModal, type: custModalProps.HtmlSubmitModal }) })) : (
|
|
816
1119
|
// true [ do not show the modal ]
|
|
817
1120
|
jsxRuntime.jsx("div", { style: { display: "none" } }))] }) })] })) }));
|
|
818
1121
|
}
|
|
819
1122
|
|
|
820
|
-
var styles$
|
|
1123
|
+
var styles$m = {"overlayPositioned":"CwConfirmationPopup-module__overlayPositioned__11qYB","popup":"CwConfirmationPopup-module__popup__ahPjM","message":"CwConfirmationPopup-module__message__MnNL4","buttons":"CwConfirmationPopup-module__buttons__fGYYE","button":"CwConfirmationPopup-module__button__ugYQE","confirmButton":"CwConfirmationPopup-module__confirmButton__rTP4S","cancelButton":"CwConfirmationPopup-module__cancelButton__Ry694"};
|
|
821
1124
|
|
|
822
1125
|
function CwConfirmationPopup(props) {
|
|
823
1126
|
const { isOpen, onConfirm, onCancel, message = "Are you sure you want to proceed?", confirmText = "Confirm", cancelText = "Cancel", placement = 'bottom', children } = props;
|
|
@@ -881,30 +1184,15 @@ function CwConfirmationPopup(props) {
|
|
|
881
1184
|
onCancel();
|
|
882
1185
|
}
|
|
883
1186
|
};
|
|
884
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$
|
|
1187
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderChildren(), isOpen && (jsxRuntime.jsx("div", { className: styles$m.overlayPositioned, onClick: handleOverlayClick, children: jsxRuntime.jsxs("div", { ref: popupRef, className: styles$m.popup, style: {
|
|
885
1188
|
position: 'absolute',
|
|
886
1189
|
top: `${position.top}px`,
|
|
887
1190
|
left: `${position.left}px`,
|
|
888
1191
|
transform: 'none'
|
|
889
|
-
}, children: [jsxRuntime.jsx("p", { className: styles$
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
function CwButton({ text, variant = 'solid', color = 'primary', className = '', icon = "", title, tooltipPosition = "bottom", children, ...buttonProps }) {
|
|
893
|
-
// Build CSS classes based on variant and props
|
|
894
|
-
let buttonClass = `cw-button-${variant}`;
|
|
895
|
-
// Add icon class only for icon variant without children
|
|
896
|
-
if (variant === 'icon' && icon && !children) {
|
|
897
|
-
buttonClass += ` cwi-${icon}`;
|
|
898
|
-
}
|
|
899
|
-
if (className) {
|
|
900
|
-
buttonClass += ` ${className}`;
|
|
901
|
-
}
|
|
902
|
-
const tooltipContent = title || (variant === 'icon' && text ? text : undefined);
|
|
903
|
-
const buttonElement = (jsxRuntime.jsx("button", { type: "button", className: buttonClass, ...buttonProps, "data-color": color, "aria-label": tooltipContent, children: variant === 'icon' ? null : (children ?? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon && jsxRuntime.jsx(CwIcon, { iconId: icon }), text && jsxRuntime.jsx("strong", { children: text })] }))) }));
|
|
904
|
-
return tooltipContent ? (jsxRuntime.jsx(CwGenericTooltip, { content: tooltipContent, position: tooltipPosition, displayInline: true, children: buttonElement })) : (buttonElement);
|
|
1192
|
+
}, children: [jsxRuntime.jsx("p", { className: styles$m.message, children: message }), jsxRuntime.jsxs("div", { className: styles$m.buttons, children: [jsxRuntime.jsx("button", { className: `${styles$m.button} ${styles$m.confirmButton}`, onClick: onConfirm, children: confirmText }), jsxRuntime.jsx("button", { className: `${styles$m.button} ${styles$m.cancelButton}`, onClick: onCancel, children: cancelText })] })] }) }))] }));
|
|
905
1193
|
}
|
|
906
1194
|
|
|
907
|
-
var styles$
|
|
1195
|
+
var styles$l = {"cw-dialog-main":"cw-dialog-module__cw-dialog-main__cHxHt","cw-dialog-button-close":"cw-dialog-module__cw-dialog-button-close__9GRd8"};
|
|
908
1196
|
|
|
909
1197
|
// Helper function to parse size values
|
|
910
1198
|
const parseSize = (size) => {
|
|
@@ -943,7 +1231,7 @@ const convertFromPx = (px, unit) => {
|
|
|
943
1231
|
}
|
|
944
1232
|
};
|
|
945
1233
|
const CwDialog = props => {
|
|
946
|
-
const { customFooter, customHeader, headline, width, height, dialogSize, scrim, onSave, onClose, hideFooter, children, open, autoReposition = false, ...domProps } = props;
|
|
1234
|
+
const { customFooter, customHeader, headline, width, height, dialogSize, scrim, onSave, onClose, hideFooter, children, open, autoReposition = false, disableSave, ...domProps } = props;
|
|
947
1235
|
const dialogRef = React.useRef(null);
|
|
948
1236
|
const [isPressingScrim, setIsPressingScrim] = React.useState(false);
|
|
949
1237
|
const pressTimerRef = React.useRef(0);
|
|
@@ -980,9 +1268,13 @@ const CwDialog = props => {
|
|
|
980
1268
|
heightUnit: parsedHeight.unit,
|
|
981
1269
|
autoHeight: isAutoHeight
|
|
982
1270
|
};
|
|
1271
|
+
const maxWidth = window.innerWidth * 0.9;
|
|
1272
|
+
const maxHeight = window.innerHeight * 0.9;
|
|
1273
|
+
const clampedWidth = Math.min(initialWidthPx, maxWidth);
|
|
1274
|
+
const clampedHeight = Math.min(initialEstimatedHeight, maxHeight);
|
|
983
1275
|
const initialPosition = {
|
|
984
|
-
x: window.document.body.clientWidth / 2 -
|
|
985
|
-
y: window.document.body.clientHeight / 2 -
|
|
1276
|
+
x: Math.max(0, window.document.body.clientWidth / 2 - clampedWidth / 2),
|
|
1277
|
+
y: Math.max(0, window.document.body.clientHeight / 2 - clampedHeight / 2)
|
|
986
1278
|
};
|
|
987
1279
|
return { initialDialogSize, initialPosition };
|
|
988
1280
|
}, [width, height, dialogSize]); // Only recalculate when these props change
|
|
@@ -991,6 +1283,7 @@ const CwDialog = props => {
|
|
|
991
1283
|
const [position, setPosition] = React.useState(initialSetup.initialPosition);
|
|
992
1284
|
const [size, setSize] = React.useState(initialSetup.initialDialogSize);
|
|
993
1285
|
const [dragStart, setDragStart] = React.useState({ x: 0, y: 0 });
|
|
1286
|
+
const userDraggedRef = React.useRef(false);
|
|
994
1287
|
// scrim is true by default
|
|
995
1288
|
const hasScrim = scrim !== false;
|
|
996
1289
|
// Adjust position after the dialog is rendered when using autoHeight
|
|
@@ -1030,6 +1323,35 @@ const CwDialog = props => {
|
|
|
1030
1323
|
resizeObserver?.disconnect();
|
|
1031
1324
|
};
|
|
1032
1325
|
}, [size.autoHeight, open, autoReposition]);
|
|
1326
|
+
// Keep dialog visible when viewport is resized; re-center only if user hasn't dragged
|
|
1327
|
+
const originalWidthPx = initialSetup.initialDialogSize.width;
|
|
1328
|
+
React.useEffect(() => {
|
|
1329
|
+
if (!open)
|
|
1330
|
+
return;
|
|
1331
|
+
userDraggedRef.current = false;
|
|
1332
|
+
const handleWindowResize = () => {
|
|
1333
|
+
const vw = window.innerWidth;
|
|
1334
|
+
const vh = window.innerHeight;
|
|
1335
|
+
const w = Math.min(originalWidthPx, vw * 0.9);
|
|
1336
|
+
setSize(prev => w !== prev.width ? { ...prev, width: w } : prev);
|
|
1337
|
+
if (!userDraggedRef.current) {
|
|
1338
|
+
const dh = dialogRef.current?.offsetHeight ?? 300;
|
|
1339
|
+
setPosition({
|
|
1340
|
+
x: Math.max(0, (vw - w) / 2),
|
|
1341
|
+
y: Math.max(0, (vh - dh) / 2),
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
// Clamp so dialog stays on screen
|
|
1346
|
+
setPosition(prev => ({
|
|
1347
|
+
x: Math.max(0, Math.min(prev.x, vw - w - 8)),
|
|
1348
|
+
y: Math.max(0, Math.min(prev.y, vh - (dialogRef.current?.offsetHeight ?? 300) - 8)),
|
|
1349
|
+
}));
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
window.addEventListener("resize", handleWindowResize);
|
|
1353
|
+
return () => window.removeEventListener("resize", handleWindowResize);
|
|
1354
|
+
}, [open]);
|
|
1033
1355
|
React.useEffect(() => {
|
|
1034
1356
|
const handleMouseMove = (e) => {
|
|
1035
1357
|
if (isDragging) {
|
|
@@ -1111,6 +1433,7 @@ const CwDialog = props => {
|
|
|
1111
1433
|
}, [isDragging, resizeDirection, dragStart, position, size]);
|
|
1112
1434
|
const handleMouseDown = React.useCallback((e) => {
|
|
1113
1435
|
setIsDragging(true);
|
|
1436
|
+
userDraggedRef.current = true;
|
|
1114
1437
|
setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });
|
|
1115
1438
|
}, [position]);
|
|
1116
1439
|
const handleResizeMouseDown = React.useCallback((direction) => (e) => {
|
|
@@ -1142,9 +1465,9 @@ const CwDialog = props => {
|
|
|
1142
1465
|
}
|
|
1143
1466
|
}
|
|
1144
1467
|
}, [open]);
|
|
1145
|
-
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$
|
|
1468
|
+
const header = React.useMemo(() => (jsxRuntime.jsxs("header", { onMouseDown: handleMouseDown, children: [jsxRuntime.jsx("span", { children: headline }), customHeader || (jsxRuntime.jsx("button", { className: styles$l["cw-dialog-button-close"], onClick: onClose }))] })), [handleMouseDown, headline, customHeader, onClose]);
|
|
1146
1469
|
const content = React.useMemo(() => (jsxRuntime.jsx("section", { children: children })), [children]);
|
|
1147
|
-
const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top" })) })), [customFooter, onSave]);
|
|
1470
|
+
const footer = React.useMemo(() => (jsxRuntime.jsx("footer", { children: customFooter || (jsxRuntime.jsx(CwButton, { variant: "icon", icon: "save", title: "Save", onClick: onSave, tooltipPosition: "top", disabled: disableSave })) })), [customFooter, onSave, disableSave]);
|
|
1148
1471
|
const resizeHandles = React.useMemo(() => size.autoHeight
|
|
1149
1472
|
? [
|
|
1150
1473
|
// Only horizontal handles if autoHeight is true
|
|
@@ -1171,7 +1494,7 @@ const CwDialog = props => {
|
|
|
1171
1494
|
: `${convertFromPx(size.height, size.heightUnit)}${size.heightUnit}`;
|
|
1172
1495
|
return { displayWidth, displayHeight };
|
|
1173
1496
|
}, [size.width, size.height, size.widthUnit, size.heightUnit, size.autoHeight]);
|
|
1174
|
-
const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$
|
|
1497
|
+
const dialogContent = (jsxRuntime.jsx("div", { "data-has-scrim": hasScrim, className: styles$l["cw-dialog-main"], onMouseDown: handleScrimMouseDown, onMouseUp: handleScrimMouseUpOrLeave, onMouseLeave: handleScrimMouseUpOrLeave, "data-pressing": isPressingScrim, children: jsxRuntime.jsxs("dialog", { ...domProps, ref: dialogRef, style: {
|
|
1175
1498
|
left: `${position.x}px`,
|
|
1176
1499
|
top: `${position.y}px`,
|
|
1177
1500
|
width: displayDimensions.displayWidth,
|
|
@@ -1202,7 +1525,6 @@ const CwModalReportFunctional = (props) => {
|
|
|
1202
1525
|
};
|
|
1203
1526
|
|
|
1204
1527
|
class CwReportModal extends React__namespace.Component {
|
|
1205
|
-
formRef = React__namespace.createRef();
|
|
1206
1528
|
constructor(props) {
|
|
1207
1529
|
super(props);
|
|
1208
1530
|
this.state = {
|
|
@@ -1219,7 +1541,6 @@ class CwReportModal extends React__namespace.Component {
|
|
|
1219
1541
|
}
|
|
1220
1542
|
render() {
|
|
1221
1543
|
return (jsxRuntime.jsx("div", { id: "modal-report-content", children: this.state.isModal === true ? (jsxRuntime.jsxs(CwDialog, { open: this.props.visible, width: this.props.width, height: this.props.height, headline: this.props.title, onClose: () => {
|
|
1222
|
-
this.formRef?.current?.resetFields();
|
|
1223
1544
|
this.props.SET_MODAL_REPORT_VISIBLE(false);
|
|
1224
1545
|
}, hideFooter: true, className: "modal-report-content", children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", overflowX: "auto", overflowY: "auto" }, children: jsxRuntime.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" && (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("h1", { style: { marginLeft: "2em" }, children: [" ", "Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }) }))] })) : (jsxRuntime.jsxs("div", { children: [this.props.name !== "Empty.pdf" && (jsxRuntime.jsx("embed", { src: "data:application/pdf;base64," + this.props.content, type: "application/pdf", width: "100%", height: "800px" })), this.props.name === "Empty.pdf" && (jsxRuntime.jsxs("div", { children: ["Please add a(n) ", this.props.reportName, " report in ", this.props.moduleSettings, " Settings"] }))] })) }));
|
|
1225
1546
|
}
|
|
@@ -1376,7 +1697,7 @@ function CwAlign(props) {
|
|
|
1376
1697
|
}, children: props.children }));
|
|
1377
1698
|
}
|
|
1378
1699
|
|
|
1379
|
-
var styles$
|
|
1700
|
+
var styles$k = {"card":"cw-card-module__card__HJUT0","clickable":"cw-card-module__clickable__Y-V3X","disabled":"cw-card-module__disabled__0wHh1","loading":"cw-card-module__loading__-fzlx","content":"cw-card-module__content__ma9qy","headerContent":"cw-card-module__headerContent__x4Jfl","footerTags":"cw-card-module__footerTags__80sSW","loadingOverlay":"cw-card-module__loadingOverlay__8-zVV"};
|
|
1380
1701
|
|
|
1381
1702
|
/**
|
|
1382
1703
|
* CwCard - A simple card component for displaying content in a contained format
|
|
@@ -1400,11 +1721,11 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1400
1721
|
// Construct class names using CSS modules
|
|
1401
1722
|
const cardClassNames = [
|
|
1402
1723
|
'cw-card',
|
|
1403
|
-
styles$
|
|
1724
|
+
styles$k.card,
|
|
1404
1725
|
className,
|
|
1405
|
-
clickable ? styles$
|
|
1406
|
-
disabled ? styles$
|
|
1407
|
-
isLoading ? styles$
|
|
1726
|
+
clickable ? styles$k.clickable : '',
|
|
1727
|
+
disabled ? styles$k.disabled : '',
|
|
1728
|
+
isLoading ? styles$k.loading : '',
|
|
1408
1729
|
].filter(Boolean).join(' ');
|
|
1409
1730
|
// Handle click event when card is clickable
|
|
1410
1731
|
const handleClick = () => {
|
|
@@ -1421,15 +1742,15 @@ const CwCard = ({ id, title, subtitle, alignment = 'center', children, footer, o
|
|
|
1421
1742
|
// Determine if footer should be rendered
|
|
1422
1743
|
const hasFooter = hasChips || footer || (hasActions && direction === "row");
|
|
1423
1744
|
// Actions component to reuse
|
|
1424
|
-
const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsxs("div", { className: styles$
|
|
1745
|
+
const ActionsComponent = hasActions && !disabled ? (jsxRuntime.jsxs("div", { className: styles$k.actions, children: [extraActions ?? null, onEdit && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "edit", onClick: onEdit }), onDelete && jsxRuntime.jsx(CwButton, { variant: "icon", icon: "delete", color: "danger", onClick: onDelete })] })) : null;
|
|
1425
1746
|
return (jsxRuntime.jsxs("div", { ...(id && { id }), className: cardClassNames, ...(style && { style }), ...(clickable && {
|
|
1426
1747
|
role: 'button',
|
|
1427
1748
|
tabIndex: 0,
|
|
1428
1749
|
onClick: handleClick,
|
|
1429
|
-
}), "data-variant": variant, "data-direction": direction, children: [hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$
|
|
1750
|
+
}), "data-variant": variant, "data-direction": direction, children: [hasHeader && (jsxRuntime.jsxs("header", { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: styles$k.headerContent, "data-alignment": alignment, children: [title && jsxRuntime.jsx("h5", { children: title }), subtitle && jsxRuntime.jsx("strong", { children: subtitle })] })), direction === "column" && ActionsComponent] })), jsxRuntime.jsx("div", { className: styles$k.content, children: children }), hasFooter && (jsxRuntime.jsxs("footer", { children: [hasChips && (jsxRuntime.jsx("div", { className: styles$k.footerTags, children: chips.map((chip, index) => (jsxRuntime.jsx(CwChip, { label: chip.label, colorScheme: chip.colorScheme, className: styles$k.chip, ...(chip.customColor && { customColor: chip.customColor }), ...(chip.variant && { variant: chip.variant }), ...(chip.icon && { icon: chip.icon }) }, index))) })), footer && (jsxRuntime.jsx("div", { className: styles$k.footerContent, children: footer }))] })), direction === "row" && ActionsComponent, isLoading && (jsxRuntime.jsx("div", { className: styles$k.loadingOverlay, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading, size: "small" }) }))] }));
|
|
1430
1751
|
};
|
|
1431
1752
|
|
|
1432
|
-
var styles$
|
|
1753
|
+
var styles$j = {"cardContainer":"cw-card-list-module__cardContainer__l3YEh","pagination":"cw-card-list-module__pagination__5Ay78","pageInfo":"cw-card-list-module__pageInfo__uiMel","loading":"cw-card-list-module__loading__cYpND","emptyState":"cw-card-list-module__emptyState__RlqiS","sortControls":"cw-card-list-module__sortControls__mWgZA"};
|
|
1433
1754
|
|
|
1434
1755
|
function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', defaultCardWidth = 320, cardGap = 16, isLoading = false, emptyState, sortOptions = [], defaultSortKey, ...htmlProps }) {
|
|
1435
1756
|
const [currentPage, setCurrentPage] = React.useState(1);
|
|
@@ -1463,10 +1784,10 @@ function CwCardList({ items, renderCard, pageSize = 10, layout = 'grid', default
|
|
|
1463
1784
|
'--card-width': `${defaultCardWidth}px`,
|
|
1464
1785
|
'--card-gap': `${cardGap}px`
|
|
1465
1786
|
};
|
|
1466
|
-
return (jsxRuntime.jsxs("div", { ...htmlProps, children: [sortOptions.length > 0 && (jsxRuntime.jsxs("div", { className: styles$
|
|
1787
|
+
return (jsxRuntime.jsxs("div", { ...htmlProps, children: [sortOptions.length > 0 && (jsxRuntime.jsxs("div", { className: styles$j.sortControls, children: [jsxRuntime.jsx("label", { htmlFor: "cardlist-sort-select", children: "Sort by:" }), jsxRuntime.jsx("select", { id: "cardlist-sort-select", value: sortKey, onChange: (e) => handleSortChange(e.target.value), className: styles$j.sortSelect, children: sortOptions.map(option => (jsxRuntime.jsx("option", { value: option.key, children: option.label }, option.key))) }), jsxRuntime.jsx("button", { onClick: () => setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc'), className: `cw-button-icon ${sortDirection === 'asc' ? 'cwi-arrow-up' : 'cwi-arrow-down'}`, title: `Sort ${sortDirection === 'asc' ? 'descending' : 'ascending'}` })] })), isLoading ? (jsxRuntime.jsx("div", { className: styles$j.loading, children: jsxRuntime.jsx(CwLoading, { isLoading: isLoading }) })) : sortedItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$j.emptyState, children: emptyState || jsxRuntime.jsx("p", { children: "No items to display" }) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `${styles$j.cardContainer}`, "data-layout": layout, style: gridStyle, children: visibleItems.map((item, index) => (jsxRuntime.jsx("div", { className: styles$j.cardWrapper, children: renderCard(item, index) }, index))) }), totalPages > 1 && (jsxRuntime.jsxs("div", { className: styles$j.pagination, children: [jsxRuntime.jsx("button", { disabled: currentPage === 1, onClick: () => setCurrentPage(p => Math.max(1, p - 1)), className: "cw-button-icon cwi-chevron-left" }), jsxRuntime.jsxs("span", { className: styles$j.pageInfo, children: [currentPage, " of ", totalPages] }), jsxRuntime.jsx("button", { disabled: currentPage === totalPages, onClick: () => setCurrentPage(p => Math.min(totalPages, p + 1)), className: "cw-button-icon cwi-chevron-right" })] }))] }))] }));
|
|
1467
1788
|
}
|
|
1468
1789
|
|
|
1469
|
-
var styles$
|
|
1790
|
+
var styles$i = {"cw-accordion":"cw-accordion-module__cw-accordion__ErvlW","cw-accordion-body":"cw-accordion-module__cw-accordion-body__xlI8b"};
|
|
1470
1791
|
|
|
1471
1792
|
/**
|
|
1472
1793
|
*
|
|
@@ -1483,7 +1804,7 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
1483
1804
|
setVisible_accordionBody(!isVisible_accordionBody);
|
|
1484
1805
|
};
|
|
1485
1806
|
// #endregion
|
|
1486
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
1807
|
+
return (jsxRuntime.jsxs("div", { className: styles$i["cw-accordion"], style: CwelltAccordionContainerProps.style, "data-open": isVisible_accordionBody, children: [jsxRuntime.jsxs("header", { onClick: () => showAccordionBody(), children: [jsxRuntime.jsx("div", { children: CwelltAccordionContainerProps.desc_text }), jsxRuntime.jsx("button", { className: "cw-button-icon" })] }), jsxRuntime.jsx("div", { className: styles$i["cw-accordion-body"], children: CwelltAccordionContainerProps.children })] }));
|
|
1487
1808
|
}
|
|
1488
1809
|
|
|
1489
1810
|
/**
|
|
@@ -1555,12 +1876,12 @@ function CwAccordionContainer(CwelltAccordionContainerProps) {
|
|
|
1555
1876
|
*
|
|
1556
1877
|
* @returns React component
|
|
1557
1878
|
*/
|
|
1558
|
-
function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10, 20, 50], expandedRowRender, onExpand, className, classNameRow, style, classNameContainer, id, textNoData = "No data available at the moment", rowKey = "key", loading = false, scrollHeight, stickyHeader = false, rowSelection
|
|
1879
|
+
function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10, 20, 50], expandedRowRender, onExpand, className, classNameRow, style, classNameContainer, id, textNoData = "No data available at the moment", rowKey = "key", loading = false, scrollHeight, stickyHeader = false, rowSelection }) {
|
|
1559
1880
|
const [currentPage, setCurrentPage] = React.useState(1);
|
|
1560
1881
|
const [expandedRowKey, setExpandedRowKey] = React.useState(null);
|
|
1561
1882
|
const [sortConfig, setSortConfig] = React.useState({
|
|
1562
1883
|
key: null,
|
|
1563
|
-
direction: "asc"
|
|
1884
|
+
direction: "asc"
|
|
1564
1885
|
});
|
|
1565
1886
|
const [localItemsPerPage, setLocalItemsPerPage] = React.useState(pageSizeOptions[0]);
|
|
1566
1887
|
const [columnWidths, setColumnWidths] = React.useState(() => columns.reduce((acc, col) => {
|
|
@@ -1585,7 +1906,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1585
1906
|
onExpand?.(item);
|
|
1586
1907
|
}, [rowKey, onExpand]);
|
|
1587
1908
|
const handleSort = React.useCallback((columnKey) => {
|
|
1588
|
-
setSortConfig(
|
|
1909
|
+
setSortConfig(prev => {
|
|
1589
1910
|
if (prev.key !== columnKey)
|
|
1590
1911
|
return { key: columnKey, direction: "asc" };
|
|
1591
1912
|
if (prev.direction === "asc")
|
|
@@ -1612,7 +1933,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1612
1933
|
if (typeof aVal === "string" && typeof bVal === "string") {
|
|
1613
1934
|
const comparison = aVal.localeCompare(bVal, undefined, {
|
|
1614
1935
|
sensitivity: "base",
|
|
1615
|
-
numeric: true
|
|
1936
|
+
numeric: true
|
|
1616
1937
|
});
|
|
1617
1938
|
return comparison * (sortConfig.direction === "asc" ? 1 : -1);
|
|
1618
1939
|
}
|
|
@@ -1628,7 +1949,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1628
1949
|
return;
|
|
1629
1950
|
}
|
|
1630
1951
|
const itemKey = item[rowKey];
|
|
1631
|
-
setSelectedKeys(
|
|
1952
|
+
setSelectedKeys(prev => {
|
|
1632
1953
|
const newSet = new Set(prev);
|
|
1633
1954
|
if (rowSelection?.type === "single") {
|
|
1634
1955
|
// Single mode: only one row selected
|
|
@@ -1649,7 +1970,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1649
1970
|
newSet.add(itemKey);
|
|
1650
1971
|
}
|
|
1651
1972
|
}
|
|
1652
|
-
const selectedRows = sortedData.filter(
|
|
1973
|
+
const selectedRows = sortedData.filter(item => newSet.has(item[rowKey]));
|
|
1653
1974
|
// Run after render to avoid "Cannot update a component while rendering another component"
|
|
1654
1975
|
setTimeout(() => {
|
|
1655
1976
|
rowSelection?.onChange?.(Array.from(newSet), selectedRows);
|
|
@@ -1678,7 +1999,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1678
1999
|
const startWidth = e.target.parentElement?.offsetWidth || 0;
|
|
1679
2000
|
const onMouseMove = (moveEvent) => {
|
|
1680
2001
|
const newWidth = Math.max(startWidth + moveEvent.clientX - startX, 50); // min 50px
|
|
1681
|
-
setColumnWidths(
|
|
2002
|
+
setColumnWidths(prev => ({ ...prev, [key]: newWidth }));
|
|
1682
2003
|
};
|
|
1683
2004
|
const onMouseUp = () => {
|
|
1684
2005
|
window.removeEventListener("mousemove", onMouseMove);
|
|
@@ -1691,7 +2012,7 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1691
2012
|
if (stickyHeader || scrollHeight) {
|
|
1692
2013
|
return {
|
|
1693
2014
|
maxHeight: scrollHeight ?? 300,
|
|
1694
|
-
overflowY: "auto"
|
|
2015
|
+
overflowY: "auto"
|
|
1695
2016
|
};
|
|
1696
2017
|
}
|
|
1697
2018
|
return {}; // no height or scroll
|
|
@@ -1707,32 +2028,40 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1707
2028
|
if (!paginatedData || paginatedData.length === 0) {
|
|
1708
2029
|
return (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: getColSpan(), className: "cw-table-cell-empty", style: { textAlign: "center" }, children: textNoData }) }));
|
|
1709
2030
|
}
|
|
1710
|
-
return paginatedData.map(
|
|
2031
|
+
return paginatedData.map(item => {
|
|
1711
2032
|
const itemKey = item[rowKey];
|
|
1712
2033
|
if (!itemKey)
|
|
1713
2034
|
console.warn("Missing row key for item", item);
|
|
1714
2035
|
const isSelected = selectedKeys.has(itemKey);
|
|
1715
|
-
const dynamicClassName = typeof classNameRow === "function"
|
|
2036
|
+
const dynamicClassName = typeof classNameRow === "function"
|
|
2037
|
+
? classNameRow(item)
|
|
2038
|
+
: classNameRow ?? "";
|
|
1716
2039
|
return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("tr", { className: `${dynamicClassName} ${hasClassNameRow(item) ? item.classNameRow : ""} ${isSelected ? "cw-table-row-selected" : ""}`, onClick: (e) => rowSelection && handleRowClick(item, e), style: {
|
|
1717
2040
|
cursor: rowSelection ? "pointer" : "default",
|
|
1718
2041
|
backgroundColor: isSelected ? "var(--cw-color-info-container)" : undefined,
|
|
1719
2042
|
transition: "background-color 0.2s ease",
|
|
1720
|
-
}, children: [expandedRowRender && (jsxRuntime.jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsxRuntime.jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey
|
|
2043
|
+
}, children: [expandedRowRender && (jsxRuntime.jsx("td", { className: "cw-table-col-action cw-table-col-expand", children: jsxRuntime.jsx("button", { onClick: () => handleRowExpand(item), className: `cw-button-icon ${expandedRowKey === itemKey
|
|
2044
|
+
? "cwi-chevron-down"
|
|
2045
|
+
: "cwi-chevron-right"}` }) })), columns.map(col => (jsxRuntime.jsx("td", { className: col.className ?? "", children: col.render ? col.render(item) : col.dataIndex ? String(item[col.dataIndex] ?? "") : "" }, `${itemKey}_${col.key}`)))] }), expandedRowRender && expandedRowKey === itemKey && (jsxRuntime.jsx("tr", { className: "cw-table-row-expanded", children: jsxRuntime.jsx("td", { colSpan: getColSpan(), children: expandedRowRender(item) }) }))] }, String(itemKey)));
|
|
1721
2046
|
});
|
|
1722
2047
|
};
|
|
1723
|
-
return (jsxRuntime.jsxs("div", { id: id, className: `cw-table-container ${classNameContainer ?? ""}`, style: style, children: [jsxRuntime.jsx("div", { style: scrollContainerStyle, children: jsxRuntime.jsxs("table", { className: `cw-table ${className ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { style: stickyHeader
|
|
2048
|
+
return (jsxRuntime.jsxs("div", { id: id, className: `cw-table-container ${classNameContainer ?? ""}`, style: style, children: [jsxRuntime.jsx("div", { style: scrollContainerStyle, children: jsxRuntime.jsxs("table", { className: `cw-table ${className ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { style: stickyHeader
|
|
2049
|
+
? { position: "sticky", top: 0, background: "white", zIndex: 2 }
|
|
2050
|
+
: undefined, children: jsxRuntime.jsxs("tr", { children: [expandedRowRender && jsxRuntime.jsx("th", {}), columns.map(col => (jsxRuntime.jsxs("th", { onClick: () => col.sortable && col.dataIndex && handleSort(col.dataIndex), className: `${col.className ?? ""} ${sortConfig.key === col.dataIndex
|
|
2051
|
+
? sortConfig.direction
|
|
2052
|
+
: ""}`.trim(), style: {
|
|
1724
2053
|
cursor: col.sortable ? "pointer" : "default",
|
|
1725
2054
|
userSelect: "none",
|
|
1726
2055
|
width: columnWidths[col.key] ?? col.width,
|
|
1727
2056
|
...((col.width || columnWidths[col.key]) && {
|
|
1728
2057
|
minWidth: 50,
|
|
1729
|
-
maxWidth: columnWidths[col.key] ?? col.width
|
|
2058
|
+
maxWidth: columnWidths[col.key] ?? col.width
|
|
1730
2059
|
}),
|
|
1731
|
-
}, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsx("span", { children: col.title }), col.sortable && col.dataIndex && (jsxRuntime.jsx(CwIcon, {
|
|
2060
|
+
}, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsx("span", { children: col.title }), col.sortable && col.dataIndex && (jsxRuntime.jsx(CwIcon, { style: { fontSize: "1.25em" }, iconId: sortConfig.key !== col.dataIndex
|
|
1732
2061
|
? "sortable"
|
|
1733
2062
|
: sortConfig.direction === "asc"
|
|
1734
2063
|
? "sortable-asc"
|
|
1735
|
-
: "sortable-desc" }))] }), jsxRuntime.jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }) }), pagination &&
|
|
2064
|
+
: "sortable-desc" }))] }), jsxRuntime.jsx("span", { onMouseDown: (e) => startResize(e, col.key), className: "th-column-resizer" })] }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderTableBody() })] }) }), pagination && data.length > pageSizeOptions[0] && (jsxRuntime.jsxs("footer", { className: "cw-table-pagination", children: [jsxRuntime.jsx("button", { onClick: () => handlePageChange(1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left-double", title: "First" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage - 1), disabled: currentPage === 1 || totalPages === 1, className: "cw-button-icon cwi-chevron-left", title: "Previous" }), jsxRuntime.jsx("input", { type: "text", inputMode: "numeric", value: currentPage, onChange: (e) => {
|
|
1736
2065
|
const value = parseInt(e.target.value, 10);
|
|
1737
2066
|
if (!isNaN(value))
|
|
1738
2067
|
handlePageChange(value);
|
|
@@ -1741,66 +2070,225 @@ function CwTable({ columns, data, pagination = false, pageSizeOptions = [5, 10,
|
|
|
1741
2070
|
if (isNaN(value) || value < 1 || value > totalPages) {
|
|
1742
2071
|
handlePageChange(1);
|
|
1743
2072
|
}
|
|
1744
|
-
}, min: 1, max: totalPages }), jsxRuntime.jsxs("span", { children: ["of ", totalPages] }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right", title: "Next" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right-double", title: "Last" }), jsxRuntime.jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(
|
|
2073
|
+
}, min: 1, max: totalPages }), jsxRuntime.jsxs("span", { children: ["of ", totalPages] }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(currentPage + 1), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right", title: "Next" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(totalPages), disabled: currentPage === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right-double", title: "Last" }), jsxRuntime.jsx("select", { value: localItemsPerPage, onChange: handleItemsPerPageChange, children: pageSizeOptions.map(size => (jsxRuntime.jsxs("option", { value: size, children: [size, " / page"] }, size))) })] }))] }));
|
|
1745
2074
|
}
|
|
1746
2075
|
|
|
2076
|
+
var styles$h = {"dropIndicator":"cw-sortable-table-module__dropIndicator__ov-Jz","dragging":"cw-sortable-table-module__dragging__MrLrz","skeletonRow":"cw-sortable-table-module__skeletonRow__vyD0M","skeleton":"cw-sortable-table-module__skeleton__QGXAD","saveBar":"cw-sortable-table-module__saveBar__3OdoZ cw-flex-row cw-align-center-center cw-gap-small"};
|
|
2077
|
+
|
|
1747
2078
|
/**
|
|
1748
|
-
*
|
|
1749
|
-
*
|
|
1750
|
-
* @param props - Component props to configure columns, data, styles, pagination, expanded rows, and more.
|
|
2079
|
+
* Hook that provides state management for CwSortableTable.
|
|
1751
2080
|
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1758
|
-
* ];
|
|
2081
|
+
* Follows the same pattern as useSortableList:
|
|
2082
|
+
* - The hook only manages STATE (items, hasChanges, save, discard)
|
|
2083
|
+
* - The component manages INTERACTION (drag, drop, calculating new order)
|
|
2084
|
+
* - handleReorder receives the already-reordered array and just stores it
|
|
2085
|
+
* - Changes are only persisted when handleSave is called
|
|
2086
|
+
* - handleDiscard restores the original order
|
|
1759
2087
|
*
|
|
2088
|
+
* @param initialItems - The initial array of items to display
|
|
1760
2089
|
*
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
2090
|
+
* @example
|
|
2091
|
+
* ```tsx
|
|
2092
|
+
* const { items, hasChanges, handleReorder, handleSave, handleDiscard } = useSortableTable(data);
|
|
2093
|
+
* ```
|
|
2094
|
+
*/
|
|
2095
|
+
function useSortableTable(initialItems) {
|
|
2096
|
+
const [items, setItems] = React.useState(initialItems);
|
|
2097
|
+
const [originalItems, setOriginalItems] = React.useState(initialItems);
|
|
2098
|
+
const [hasChanges, setHasChanges] = React.useState(false);
|
|
2099
|
+
// Sync items only when initialItems changes from outside (e.g. after initial fetch).
|
|
2100
|
+
// We skip the sync when there are local unsaved changes to avoid
|
|
2101
|
+
// overwriting the user's reordering work.
|
|
2102
|
+
const prevInitialRef = React.useRef(initialItems);
|
|
2103
|
+
React.useEffect(() => {
|
|
2104
|
+
if (prevInitialRef.current === initialItems)
|
|
2105
|
+
return;
|
|
2106
|
+
prevInitialRef.current = initialItems;
|
|
2107
|
+
if (!hasChanges) {
|
|
2108
|
+
setItems(initialItems);
|
|
2109
|
+
setOriginalItems(initialItems);
|
|
2110
|
+
}
|
|
2111
|
+
}, [initialItems, hasChanges]);
|
|
2112
|
+
// Receives the already-reordered array from the component and stores it.
|
|
2113
|
+
// No splice logic here — same pattern as useSortableList.handleReorder.
|
|
2114
|
+
const handleReorder = React.useCallback((newItems) => {
|
|
2115
|
+
setItems(newItems);
|
|
2116
|
+
setHasChanges(true);
|
|
2117
|
+
}, []);
|
|
2118
|
+
const handleSave = async (onSave) => {
|
|
2119
|
+
await onSave(items);
|
|
2120
|
+
setOriginalItems(items);
|
|
2121
|
+
setHasChanges(false);
|
|
2122
|
+
};
|
|
2123
|
+
const handleDiscard = React.useCallback(() => {
|
|
2124
|
+
setItems(originalItems);
|
|
2125
|
+
setHasChanges(false);
|
|
2126
|
+
}, [originalItems]);
|
|
2127
|
+
return {
|
|
2128
|
+
items,
|
|
2129
|
+
hasChanges,
|
|
2130
|
+
handleReorder,
|
|
2131
|
+
handleSave,
|
|
2132
|
+
handleDiscard,
|
|
2133
|
+
// dragState is managed in the component, same as CwSortableList
|
|
2134
|
+
dragState: { dragSourceIndex: -1, dropTargetIndex: -1 },
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
// ─── Drop indicator row ───────────────────────────────────────────────────────
|
|
2139
|
+
const DropIndicatorRow = ({ colSpan }) => (jsxRuntime.jsx("tr", { className: styles$h.dropIndicator, "aria-hidden": true, children: jsxRuntime.jsx("td", { colSpan: colSpan, children: jsxRuntime.jsx("div", {}) }) }));
|
|
2140
|
+
// ─── Loading skeleton ─────────────────────────────────────────────────────────
|
|
2141
|
+
const LoadingRows = ({ colSpan }) => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 4 }).map((_, i) => (jsxRuntime.jsx("tr", { className: styles$h.skeletonRow, children: jsxRuntime.jsx("td", { colSpan: colSpan, children: jsxRuntime.jsx("div", { className: styles$h.skeleton }) }) }, i))) }));
|
|
2142
|
+
// ─── Component ────────────────────────────────────────────────────────────────
|
|
2143
|
+
/**
|
|
2144
|
+
* CwSortableTable
|
|
1770
2145
|
*
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1773
|
-
*
|
|
1774
|
-
* fetch(`/api/users?page=${tableState.page}&pageSize=${tableState.pageSize}` +
|
|
1775
|
-
* (tableState.sortKey ? `&sortKey=${tableState.sortKey}&sortDirection=${tableState.sortDirection}` : "")
|
|
1776
|
-
* )
|
|
1777
|
-
* .then(res => res.json())
|
|
1778
|
-
* .then(({ items, total }) => {
|
|
1779
|
-
* setData(items);
|
|
1780
|
-
* setTotalItems(total);
|
|
1781
|
-
* })
|
|
1782
|
-
* .finally(() => setLoading(false));
|
|
1783
|
-
* }, [tableState]);
|
|
2146
|
+
* A table with drag-and-drop row reordering and save/discard support.
|
|
2147
|
+
* Shares visual styles with CwTable but is intentionally simpler:
|
|
2148
|
+
* no column sorting, no pagination.
|
|
1784
2149
|
*
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1787
|
-
* data={data}
|
|
1788
|
-
* totalItems={totalItems}
|
|
1789
|
-
* pagination={true}
|
|
1790
|
-
* pageSizeOptions={[5, 10, 20]}
|
|
1791
|
-
* loading={loading}
|
|
1792
|
-
* serverState={tableState}
|
|
1793
|
-
* onChange={setTableState}
|
|
1794
|
-
* rowKey="id"
|
|
1795
|
-
* textNoData="No data available"
|
|
1796
|
-
* />
|
|
2150
|
+
* When the user reorders rows, changes are held locally until they
|
|
2151
|
+
* click Save. A save bar appears automatically when there are pending changes.
|
|
1797
2152
|
*
|
|
1798
|
-
*
|
|
2153
|
+
* Follows the same pattern as CwSortableList:
|
|
2154
|
+
* - All rows are draggable — the handle is visual only
|
|
2155
|
+
* - Reorder is calculated in onDragEnd using lastValidDropIndex
|
|
2156
|
+
* - draggedItem is tracked in state, not via dataTransfer
|
|
1799
2157
|
*/
|
|
1800
|
-
function
|
|
1801
|
-
const
|
|
1802
|
-
|
|
1803
|
-
|
|
2158
|
+
function CwSortableTable({ columns, data, rowKey = "key", onReorder, loading = false, textNoData = "No data available", className, tableClassName, maxHeight, showHandle = true, style, saveLabel = "Save order", discardLabel = "Discard", }) {
|
|
2159
|
+
const { items, hasChanges, handleReorder, handleSave, handleDiscard, } = useSortableTable(data);
|
|
2160
|
+
// Drag state lives in the component, same as CwSortableList
|
|
2161
|
+
const [draggedItem, setDraggedItem] = React.useState(null);
|
|
2162
|
+
const [dropIndicatorIndex, setDropIndicatorIndex] = React.useState(null);
|
|
2163
|
+
const [lastValidDropIndex, setLastValidDropIndex] = React.useState(null);
|
|
2164
|
+
// Total columns = handle column (optional) + user columns
|
|
2165
|
+
const totalCols = columns.length + (showHandle ? 1 : 0);
|
|
2166
|
+
const containerStyle = {
|
|
2167
|
+
...style,
|
|
2168
|
+
...(maxHeight ? { maxHeight, overflowY: "auto" } : {}),
|
|
2169
|
+
};
|
|
2170
|
+
// ── Drag handlers — replicating CwSortableList pattern exactly ──────────
|
|
2171
|
+
const cleanupDragState = () => {
|
|
2172
|
+
setDraggedItem(null);
|
|
2173
|
+
setDropIndicatorIndex(null);
|
|
2174
|
+
setLastValidDropIndex(null);
|
|
2175
|
+
};
|
|
2176
|
+
const handleDragStart = (e, item) => {
|
|
2177
|
+
setDraggedItem(item);
|
|
2178
|
+
setLastValidDropIndex(null);
|
|
2179
|
+
e.dataTransfer.effectAllowed = "move";
|
|
2180
|
+
};
|
|
2181
|
+
const handleDragOver = (e, index) => {
|
|
2182
|
+
e.preventDefault();
|
|
2183
|
+
if (!draggedItem)
|
|
2184
|
+
return;
|
|
2185
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
2186
|
+
const elementCenterY = rect.top + rect.height / 2;
|
|
2187
|
+
const dropIndex = e.clientY < elementCenterY ? index : index + 1;
|
|
2188
|
+
if (dropIndicatorIndex !== dropIndex) {
|
|
2189
|
+
setDropIndicatorIndex(dropIndex);
|
|
2190
|
+
setLastValidDropIndex(dropIndex);
|
|
2191
|
+
}
|
|
2192
|
+
};
|
|
2193
|
+
const handleDragEnd = () => {
|
|
2194
|
+
if (draggedItem && lastValidDropIndex !== null) {
|
|
2195
|
+
const dragIndex = items.findIndex(item => item[rowKey] === draggedItem[rowKey]);
|
|
2196
|
+
if (dragIndex !== lastValidDropIndex && dragIndex !== lastValidDropIndex - 1) {
|
|
2197
|
+
const newItems = [...items];
|
|
2198
|
+
const [draggedElement] = newItems.splice(dragIndex, 1);
|
|
2199
|
+
let finalIndex = lastValidDropIndex;
|
|
2200
|
+
if (dragIndex < finalIndex)
|
|
2201
|
+
finalIndex -= 1;
|
|
2202
|
+
newItems.splice(finalIndex, 0, draggedElement);
|
|
2203
|
+
handleReorder(newItems);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
cleanupDragState();
|
|
2207
|
+
};
|
|
2208
|
+
// ── Render helpers ──────────────────────────────────────────────────────
|
|
2209
|
+
const renderCell = (item, col) => {
|
|
2210
|
+
if (col.render)
|
|
2211
|
+
return col.render(item);
|
|
2212
|
+
if (col.dataIndex) {
|
|
2213
|
+
const value = item[col.dataIndex];
|
|
2214
|
+
return value != null ? String(value) : "";
|
|
2215
|
+
}
|
|
2216
|
+
return "";
|
|
2217
|
+
};
|
|
2218
|
+
const renderBody = () => {
|
|
2219
|
+
if (loading) {
|
|
2220
|
+
return jsxRuntime.jsx(LoadingRows, { colSpan: totalCols });
|
|
2221
|
+
}
|
|
2222
|
+
if (!items || items.length === 0) {
|
|
2223
|
+
return (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: totalCols, className: "cw-table-cell-empty", style: { textAlign: "center" }, children: textNoData }) }));
|
|
2224
|
+
}
|
|
2225
|
+
return items.map((item, index) => {
|
|
2226
|
+
const key = item[rowKey];
|
|
2227
|
+
const isDragging = draggedItem?.[rowKey] === key;
|
|
2228
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols })), jsxRuntime.jsxs("tr", { draggable: true, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, className: isDragging ? styles$h.dragging : "", children: [showHandle && (jsxRuntime.jsx("td", { className: "cw-table-col-action", children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots", color: "neutral", style: { opacity: 0.75 } }) })), columns.map(col => (jsxRuntime.jsx("td", { className: col.className ?? "", style: col.width ? { width: col.width } : undefined, children: renderCell(item, col) }, `${String(key)}_${col.key}`)))] }), index === items.length - 1 && dropIndicatorIndex === items.length && (jsxRuntime.jsx(DropIndicatorRow, { colSpan: totalCols }))] }, String(key)));
|
|
2229
|
+
});
|
|
2230
|
+
};
|
|
2231
|
+
// ── Render ──────────────────────────────────────────────────────────────
|
|
2232
|
+
return (jsxRuntime.jsxs("div", { className: `cw-table-container ${className ?? ""}`, style: containerStyle, children: [jsxRuntime.jsxs("table", { className: `cw-table cw-sortable-table ${tableClassName ?? ""}`, style: { width: "100%" }, children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsxs("tr", { children: [showHandle && jsxRuntime.jsx("th", { className: "cw-table-col-action" }), columns.map(col => (jsxRuntime.jsx("th", { className: col.className ?? "", style: col.width ? { width: col.width, minWidth: 50 } : undefined, children: col.title }, col.key)))] }) }), jsxRuntime.jsx("tbody", { children: renderBody() })] }), hasChanges && (jsxRuntime.jsxs("footer", { className: styles$h.saveBar, children: [jsxRuntime.jsx(CwButton, { variant: "outline", color: "neutral", icon: "undo", text: discardLabel, onClick: handleDiscard }), jsxRuntime.jsx(CwButton, { variant: "solid", color: "primary", icon: "save", text: saveLabel, onClick: () => handleSave(onReorder) })] }))] }));
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
/**
|
|
2236
|
+
* A reusable and customizable table component (server-side pagination and sorting).
|
|
2237
|
+
*
|
|
2238
|
+
* @param props - Component props to configure columns, data, styles, pagination, expanded rows, and more.
|
|
2239
|
+
*
|
|
2240
|
+
* @example
|
|
2241
|
+
* // --- Component ---
|
|
2242
|
+
* const columns: Column<User>[] = [
|
|
2243
|
+
* { title: "Name", dataIndex: "name", key: "name", sortable: true },
|
|
2244
|
+
* { title: "Age", dataIndex: "age", key: "age", sortable: true },
|
|
2245
|
+
* { title: "Address", dataIndex: "address", key: "address" }
|
|
2246
|
+
* ];
|
|
2247
|
+
*
|
|
2248
|
+
*
|
|
2249
|
+
* const [tableState, setTableState] = useState<ServerSideTableState<User>>({
|
|
2250
|
+
* page: 1,
|
|
2251
|
+
* pageSize: 5,
|
|
2252
|
+
* sortKey: null,
|
|
2253
|
+
* sortDirection: null
|
|
2254
|
+
* });
|
|
2255
|
+
* const [data, setData] = useState<User[]>([]);
|
|
2256
|
+
* const [totalItems, setTotalItems] = useState(0);
|
|
2257
|
+
* const [loading, setLoading] = useState(false);
|
|
2258
|
+
*
|
|
2259
|
+
* // Fetch simulation on table state change
|
|
2260
|
+
* useEffect(() => {
|
|
2261
|
+
* setLoading(true);
|
|
2262
|
+
* fetch(`/api/users?page=${tableState.page}&pageSize=${tableState.pageSize}` +
|
|
2263
|
+
* (tableState.sortKey ? `&sortKey=${tableState.sortKey}&sortDirection=${tableState.sortDirection}` : "")
|
|
2264
|
+
* )
|
|
2265
|
+
* .then(res => res.json())
|
|
2266
|
+
* .then(({ items, total }) => {
|
|
2267
|
+
* setData(items);
|
|
2268
|
+
* setTotalItems(total);
|
|
2269
|
+
* })
|
|
2270
|
+
* .finally(() => setLoading(false));
|
|
2271
|
+
* }, [tableState]);
|
|
2272
|
+
*
|
|
2273
|
+
* <CwTableServerSide<User>
|
|
2274
|
+
* columns={columns}
|
|
2275
|
+
* data={data}
|
|
2276
|
+
* totalItems={totalItems}
|
|
2277
|
+
* pagination={true}
|
|
2278
|
+
* pageSizeOptions={[5, 10, 20]}
|
|
2279
|
+
* loading={loading}
|
|
2280
|
+
* serverState={tableState}
|
|
2281
|
+
* onChange={setTableState}
|
|
2282
|
+
* rowKey="id"
|
|
2283
|
+
* textNoData="No data available"
|
|
2284
|
+
* />
|
|
2285
|
+
*
|
|
2286
|
+
* @returns React component
|
|
2287
|
+
*/
|
|
2288
|
+
function CwTableServerSide({ columns, data, totalItems, pagination = false, pageSizeOptions = [5, 10, 20, 50], expandedRowRender, onExpand, className, classNameRow, style, classNameContainer, id, textNoData = "No data available at the moment", rowKey = "key", loading = false, scrollHeight, stickyHeader = false, rowSelection, onChange, serverState, }) {
|
|
2289
|
+
const [internalState, setInternalState] = React.useState({
|
|
2290
|
+
page: 1,
|
|
2291
|
+
pageSize: pageSizeOptions[0],
|
|
1804
2292
|
sortKey: null,
|
|
1805
2293
|
sortDirection: null,
|
|
1806
2294
|
});
|
|
@@ -1949,7 +2437,7 @@ function CwTableServerSide({ columns, data, totalItems, pagination = false, page
|
|
|
1949
2437
|
}, min: 1, max: totalPages }), jsxRuntime.jsxs("span", { children: ["of ", totalPages] }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(state.page + 1), disabled: state.page === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right", title: "Next" }), jsxRuntime.jsx("button", { onClick: () => handlePageChange(totalPages), disabled: state.page === totalPages || totalPages === 1, className: "cw-button-icon cwi-chevron-right-double", title: "Last" }), jsxRuntime.jsx("select", { value: state.pageSize, onChange: handleItemsPerPageChange, children: pageSizeOptions.map((size) => (jsxRuntime.jsxs("option", { value: size, children: [size, " / page"] }, size))) })] }))] }));
|
|
1950
2438
|
}
|
|
1951
2439
|
|
|
1952
|
-
var styles$
|
|
2440
|
+
var styles$g = {"cw-tabs":"cw-tabs-module__cw-tabs__1pmji","badge":"cw-tabs-module__badge__AmVxW","cw-tabs-content":"cw-tabs-module__cw-tabs-content__HTp8d"};
|
|
1953
2441
|
|
|
1954
2442
|
const TabIcon = ({ icon }) => {
|
|
1955
2443
|
if (!icon)
|
|
@@ -1999,7 +2487,7 @@ function CwTabs(CwTabsProps) {
|
|
|
1999
2487
|
const tabsListStyle = position === 'left' && CwTabsProps.tabsListWidth
|
|
2000
2488
|
? { minWidth: CwTabsProps.tabsListWidth }
|
|
2001
2489
|
: undefined;
|
|
2002
|
-
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, className: styles$
|
|
2490
|
+
return (jsxRuntime.jsxs("div", { id: CwTabsProps.id, className: styles$g['cw-tabs'] + (CwTabsProps.className ? ` ${CwTabsProps.className}` : "") + "", style: CwTabsProps.style, "data-tabs-position": position, children: [jsxRuntime.jsx("ul", { style: tabsListStyle, children: CwTabsProps.tabs.map(tab => (jsxRuntime.jsxs("li", { className: `${tab.key === activeTab ? "cw-tab-active" : ""}`, onClick: () => handleTabClick(tab), "data-active": tab.key === activeTab, children: [jsxRuntime.jsx(TabIcon, { icon: tab.icon }), tab.title, (tab.badge !== undefined || tab.badgeColor) && (jsxRuntime.jsx("span", { className: styles$g['badge'], style: tab.badgeColor ? { backgroundColor: tab.badgeColor, color: getContrastColor(tab.badgeColor) } : undefined, children: tab.badge }))] }, tab.key))) }), jsxRuntime.jsx("div", { className: styles$g['cw-tabs-content'], children: activeTab !== null && CwTabsProps.tabs.find(tab => tab.key === activeTab)?.content })] }));
|
|
2003
2491
|
}
|
|
2004
2492
|
|
|
2005
2493
|
/**
|
|
@@ -2026,6 +2514,48 @@ const CwExpandable = ({ briefing, onToggle, onOpen, onClose, children, ...detail
|
|
|
2026
2514
|
return (jsxRuntime.jsx("div", { className: "cw-expandable", children: jsxRuntime.jsxs("details", { ref: myRef, ...detailsProps, children: [jsxRuntime.jsx("summary", { children: briefing }), children && jsxRuntime.jsx("section", { children: children })] }) }));
|
|
2027
2515
|
};
|
|
2028
2516
|
|
|
2517
|
+
var styles$f = {"cw-master-detail":"cw-master-detail-module__cw-master-detail__O8-FA","resizer":"cw-master-detail-module__resizer__hvGhL","detail":"cw-master-detail-module__detail__BG4Dm","detail-empty":"cw-master-detail-module__detail-empty__KFScK"};
|
|
2518
|
+
|
|
2519
|
+
const CwMasterDetail = ({ id, className, style, items, selectedKey, onSelect, detailContent, emptyDetail, searchPlaceholder = 'Search...', onSearch, masterHeader, masterFooter, masterWidth: initialWidth = 320, minMasterWidth = 240, maxMasterWidth = 500, resizable = true, showSearch = true, }) => {
|
|
2520
|
+
const [masterWidth, setMasterWidth] = React.useState(initialWidth);
|
|
2521
|
+
const [isResizing, setIsResizing] = React.useState(false);
|
|
2522
|
+
const containerRef = React.useRef(null);
|
|
2523
|
+
const handleMouseDown = React.useCallback((e) => {
|
|
2524
|
+
if (!resizable)
|
|
2525
|
+
return;
|
|
2526
|
+
e.preventDefault();
|
|
2527
|
+
setIsResizing(true);
|
|
2528
|
+
}, [resizable]);
|
|
2529
|
+
React.useEffect(() => {
|
|
2530
|
+
if (!isResizing)
|
|
2531
|
+
return;
|
|
2532
|
+
const handleMouseMove = (e) => {
|
|
2533
|
+
if (!containerRef.current)
|
|
2534
|
+
return;
|
|
2535
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
2536
|
+
const newWidth = Math.max(minMasterWidth, Math.min(maxMasterWidth, e.clientX - rect.left));
|
|
2537
|
+
setMasterWidth(newWidth);
|
|
2538
|
+
};
|
|
2539
|
+
const handleMouseUp = () => {
|
|
2540
|
+
setIsResizing(false);
|
|
2541
|
+
};
|
|
2542
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
2543
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
2544
|
+
document.body.style.cursor = 'col-resize';
|
|
2545
|
+
document.body.style.userSelect = 'none';
|
|
2546
|
+
return () => {
|
|
2547
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
2548
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
2549
|
+
document.body.style.cursor = '';
|
|
2550
|
+
document.body.style.userSelect = '';
|
|
2551
|
+
};
|
|
2552
|
+
}, [isResizing, minMasterWidth, maxMasterWidth]);
|
|
2553
|
+
const rootClassName = [styles$f['cw-master-detail'], className].filter(Boolean).join(' ');
|
|
2554
|
+
return (jsxRuntime.jsxs("div", { id: id, ref: containerRef, className: rootClassName, style: style, children: [jsxRuntime.jsxs("aside", { style: { width: masterWidth, minWidth: masterWidth }, children: [showSearch && (jsxRuntime.jsx("search", { children: jsxRuntime.jsx("input", { type: "text", placeholder: searchPlaceholder, onChange: (e) => onSearch?.(e.target.value) }) })), masterHeader && (jsxRuntime.jsx("header", { children: masterHeader })), jsxRuntime.jsx("ul", { children: items.map((item) => (jsxRuntime.jsx("li", { "data-selected": item.key === selectedKey, "data-disabled": item.disabled, onClick: () => onSelect?.(item.key), children: item.content }, item.key))) }), masterFooter && (jsxRuntime.jsx("footer", { children: masterFooter }))] }), resizable && (jsxRuntime.jsx("div", { className: styles$f.resizer, "data-resizing": isResizing, onMouseDown: handleMouseDown })), jsxRuntime.jsx("section", { className: styles$f.detail, children: selectedKey && detailContent
|
|
2555
|
+
? detailContent
|
|
2556
|
+
: (jsxRuntime.jsx("div", { className: styles$f['detail-empty'], children: emptyDetail ?? 'Select an item to view details' })) })] }));
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2029
2559
|
/**
|
|
2030
2560
|
* A component for displaying key-value pairs in a definition list format
|
|
2031
2561
|
* Used for read-only display of structured data
|
|
@@ -2047,9 +2577,9 @@ const CwKeyValueList = ({ items, className = "", emptyValue = "-", direction = "
|
|
|
2047
2577
|
: emptyValue })] }, item.key))) }));
|
|
2048
2578
|
};
|
|
2049
2579
|
|
|
2050
|
-
var styles$
|
|
2580
|
+
var styles$e = {"sortableList":"cw-sortable-list-module__sortableList__PyLO-","sortableItem":"cw-sortable-list-module__sortableItem__FAnn2","readOnly":"cw-sortable-list-module__readOnly__r7GcH","dragging":"cw-sortable-list-module__dragging__MD715","moved":"cw-sortable-list-module__moved__sE6-N","expandedContent":"cw-sortable-list-module__expandedContent__Kocna","sortableHandle":"cw-sortable-list-module__sortableHandle__HvYBK","sortableContent":"cw-sortable-list-module__sortableContent__C6JhR","sortableTitle":"cw-sortable-list-module__sortableTitle__EgWXr","sortableExtraContent":"cw-sortable-list-module__sortableExtraContent__s4LSv","sortableActions":"cw-sortable-list-module__sortableActions__gwQOU","dropIndicator":"cw-sortable-list-module__dropIndicator__MNSF-","emptyMessage":"cw-sortable-list-module__emptyMessage__gMpaL"};
|
|
2051
2581
|
|
|
2052
|
-
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, }) {
|
|
2582
|
+
function CwSortableList({ items, onReorder, renderItem, className = '', movedItems = new Set(), emptyMessage = "No elements to show", readOnly = false, maxHeight = "300px", }) {
|
|
2053
2583
|
const [draggedItem, setDraggedItem] = React.useState(null);
|
|
2054
2584
|
const [dropIndicatorIndex, setDropIndicatorIndex] = React.useState(null);
|
|
2055
2585
|
const [lastValidDropIndex, setLastValidDropIndex] = React.useState(null);
|
|
@@ -2110,15 +2640,15 @@ function CwSortableList({ items, onReorder, renderItem, className = '', movedIte
|
|
|
2110
2640
|
}
|
|
2111
2641
|
};
|
|
2112
2642
|
if (items.length === 0) {
|
|
2113
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
2643
|
+
return (jsxRuntime.jsx("div", { className: `${styles$e.sortableList} ${styles$e.emptyState} ${className}`, children: jsxRuntime.jsx("div", { className: styles$e.emptyMessage, children: emptyMessage }) }));
|
|
2114
2644
|
}
|
|
2115
|
-
return (jsxRuntime.jsx("div", { className: `${styles$
|
|
2645
|
+
return (jsxRuntime.jsx("div", { className: `${styles$e.sortableList} ${className}`, style: { maxHeight }, children: items.map((item, index) => {
|
|
2116
2646
|
const { title, extraContent, actions, showHandle = true, expandedContent } = renderItem(item);
|
|
2117
2647
|
const isDragging = draggedItem?.id === item.id;
|
|
2118
2648
|
const isMoved = movedItems.has(item.id);
|
|
2119
2649
|
const canExpand = Boolean(expandedContent);
|
|
2120
2650
|
const isExpanded = expandedItems.has(item.id);
|
|
2121
|
-
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$
|
|
2651
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [dropIndicatorIndex === index && jsxRuntime.jsx("div", { className: styles$e.dropIndicator }), jsxRuntime.jsxs("div", { className: `${styles$e.sortableItem} ${isDragging ? styles$e.dragging : ''} ${isMoved ? styles$e.moved : ''} ${readOnly ? styles$e.readOnly : ''}`, draggable: !readOnly, onDragStart: (e) => handleDragStart(e, item), onDragOver: (e) => handleDragOver(e, index), onDragEnd: handleDragEnd, children: [jsxRuntime.jsxs("header", { children: [canExpand ? (jsxRuntime.jsx(CwButton, { variant: "icon", onClick: () => toggleExpanded(item.id), type: "button", title: isExpanded ? "Collapse" : "Expand", icon: isExpanded ? "chevron-up" : "chevron-down" })) : showHandle ? (jsxRuntime.jsx("div", { className: styles$e.sortableHandle, children: jsxRuntime.jsx(CwIcon, { iconId: "grip-dots" }) })) : null, jsxRuntime.jsxs("div", { className: styles$e.sortableContent, children: [jsxRuntime.jsx("div", { className: styles$e.sortableTitle, children: title }), extraContent && jsxRuntime.jsx("div", { className: styles$e.sortableExtraContent, children: extraContent })] }), jsxRuntime.jsx("div", { className: styles$e.sortableActions, children: actions })] }), isExpanded && expandedContent && (jsxRuntime.jsx("div", { className: styles$e.expandedContent, children: expandedContent }))] }), !readOnly && dropIndicatorIndex === items.length && index === items.length - 1 && (jsxRuntime.jsx("div", { className: styles$e.dropIndicator }))] }, item.id));
|
|
2122
2652
|
}) }));
|
|
2123
2653
|
}
|
|
2124
2654
|
|
|
@@ -2295,7 +2825,7 @@ function CwFileUpload(fileUploadProps) {
|
|
|
2295
2825
|
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "row", children: [jsxRuntime.jsx("input", { className: "cw-button", type: "file", accept: fileUploadProps.accept, readOnly: true, placeholder: "No file selected...", onChange: handleFileChange }), previewURL && (jsxRuntime.jsx("div", { className: "row", children: jsxRuntime.jsx("img", { src: previewURL, alt: "Preview", style: { maxWidth: "200px", maxHeight: "200px" } }) }))] }), error && jsxRuntime.jsx("div", { className: "row error", children: error }), jsxRuntime.jsx("div", { className: "row", children: jsxRuntime.jsxs("label", { children: ["Please note: File/image has to be in ", fileUploadProps.acceptString, " format", fileUploadProps.sizeString && `, ${fileUploadProps.sizeString}`] }) })] }));
|
|
2296
2826
|
}
|
|
2297
2827
|
|
|
2298
|
-
var styles$
|
|
2828
|
+
var styles$d = {"fileUploadContainer":"cw-file-upload-multiple-module__fileUploadContainer__liEc1","hiddenInput":"cw-file-upload-multiple-module__hiddenInput__TZBBI","uploadArea":"cw-file-upload-multiple-module__uploadArea__DdOhs","uploadAreaDisabled":"cw-file-upload-multiple-module__uploadAreaDisabled__VWeFX","uploadTitle":"cw-file-upload-multiple-module__uploadTitle__gjRk8","uploadSubtitle":"cw-file-upload-multiple-module__uploadSubtitle__Z0S5t","filesContainer":"cw-file-upload-multiple-module__filesContainer__g44PY","fileItem":"cw-file-upload-multiple-module__fileItem__w27Dg","fileIcon":"cw-file-upload-multiple-module__fileIcon__iJJUX","fileExtension":"cw-file-upload-multiple-module__fileExtension__vOuHv","fileInfo":"cw-file-upload-multiple-module__fileInfo__R5ZTv","fileName":"cw-file-upload-multiple-module__fileName__DjepK","fileSize":"cw-file-upload-multiple-module__fileSize__b8GSm","smallButton":"cw-file-upload-multiple-module__smallButton__siUAh"};
|
|
2299
2829
|
|
|
2300
2830
|
function CwFileUploadMultiple(fileUploadProps) {
|
|
2301
2831
|
const fileInputRef = React.useRef(null);
|
|
@@ -2446,12 +2976,12 @@ function CwFileUploadMultiple(fileUploadProps) {
|
|
|
2446
2976
|
}
|
|
2447
2977
|
}
|
|
2448
2978
|
};
|
|
2449
|
-
return (jsxRuntime.jsxs("div", { className: `${styles$
|
|
2979
|
+
return (jsxRuntime.jsxs("div", { className: `${styles$d.fileUploadContainer} ${fileUploadProps.className}`, children: [jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", name: fileUploadProps.name, accept: fileUploadProps.accept, multiple: fileUploadProps.multiple, onChange: handleFileSelectInternal, disabled: fileUploadProps.disabled, "aria-label": "files", className: styles$d.hiddenInput }), selectedFiles.length === 0 && !existingFile ? (jsxRuntime.jsxs("div", { className: `${styles$d.uploadArea} ${fileUploadProps.disabled ? styles$d.uploadAreaDisabled : ''}`, onDragOver: handleDragOver, onDrop: handleDrop, onClick: !fileUploadProps.disabled ? handleButtonClick : undefined, children: [jsxRuntime.jsx(CwIcon, { iconId: "upload" }), jsxRuntime.jsx("p", { className: `${styles$d.uploadTitle}`, children: fileUploadProps.disabled ? 'Upload disabled' : 'Click to upload or drag and drop' }), jsxRuntime.jsxs("p", { className: `${styles$d.uploadSubtitle}`, children: [fileUploadProps.accept ? `Accepted files: ${fileUploadProps.accept}` : 'All file types accepted', !fileUploadProps.multiple && ' (Single file only)'] })] })) : selectedFiles.length === 0 && existingFile ? (jsxRuntime.jsxs("div", { className: styles$d.filesContainer, children: [jsxRuntime.jsxs("div", { className: styles$d.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$d.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$d.fileExtension, children: getFileExtension(existingFile) })] }), jsxRuntime.jsx("div", { className: styles$d.fileInfo, children: jsxRuntime.jsx("p", { className: styles$d.fileName, children: existingFile }) }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => {
|
|
2450
2980
|
setExistingFile(undefined);
|
|
2451
2981
|
if (fileUploadProps.onSelect) {
|
|
2452
2982
|
fileUploadProps.onSelect(null);
|
|
2453
2983
|
}
|
|
2454
|
-
}, disabled: fileUploadProps.disabled, className: styles$
|
|
2984
|
+
}, disabled: fileUploadProps.disabled, className: styles$d.smallButton })] }), jsxRuntime.jsx(CwButton, { text: "Change File", icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled })] })) : (jsxRuntime.jsxs("div", { className: styles$d.filesContainer, children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center", children: [jsxRuntime.jsxs("small", { className: styles$d.filesCount, children: [selectedFiles.length, " file", selectedFiles.length !== 1 ? 's' : '', " selected"] }), jsxRuntime.jsx(CwButton, { onClick: removeAllFiles, disabled: fileUploadProps.disabled, color: "danger", variant: "outline", icon: "delete", text: "Clear all" })] }), selectedFiles.map((file, index) => (jsxRuntime.jsxs("div", { className: styles$d.fileItem, children: [jsxRuntime.jsxs("div", { className: styles$d.fileIcon, children: [jsxRuntime.jsx(CwIcon, { iconId: "page" }), jsxRuntime.jsx("span", { className: styles$d.fileExtension, children: getFileExtension(file.name) })] }), jsxRuntime.jsxs("div", { className: styles$d.fileInfo, children: [jsxRuntime.jsx("p", { className: styles$d.fileName, children: file.name }), jsxRuntime.jsxs("p", { className: styles$d.fileSize, children: [(file.size / 1024).toFixed(1), " KB"] })] }), jsxRuntime.jsx(CwButton, { variant: "icon", icon: "close", color: "neutral", onClick: () => removeFile(index), className: styles$d.smallButton })] }, index))), fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: "Add More Files", icon: "plus", variant: "outline", onClick: handleButtonClick, disabled: fileUploadProps.disabled })), !fileUploadProps.multiple && (jsxRuntime.jsx(CwButton, { text: "Change File", icon: "refresh", onClick: handleButtonClick, disabled: fileUploadProps.disabled }))] }))] }));
|
|
2455
2985
|
}
|
|
2456
2986
|
|
|
2457
2987
|
function CwInput(CwInputProps) {
|
|
@@ -2494,7 +3024,7 @@ function CwDigit(props) {
|
|
|
2494
3024
|
return (jsxRuntime.jsx("div", { className: "cw-input-text", children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsx("input", { type: "number", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
|
|
2495
3025
|
}
|
|
2496
3026
|
|
|
2497
|
-
var styles$
|
|
3027
|
+
var styles$c = {"colorPreview":"cw-color-picker-module__colorPreview__ylJcD","hueBar":"cw-color-picker-module__hueBar__bFhyC","hueBarSlider":"cw-color-picker-module__hueBarSlider__D53IV","colorPickerInteractiveArea":"cw-color-picker-module__colorPickerInteractiveArea__KZFR1","colorArea":"cw-color-picker-module__colorArea__xgpSE","colorAreaOverlay":"cw-color-picker-module__colorAreaOverlay__pmgOc","hueBackground":"cw-color-picker-module__hueBackground__Mks78","whiteGradient":"cw-color-picker-module__whiteGradient__Bt-fU","blackGradient":"cw-color-picker-module__blackGradient__VnEKJ","colorAreaCursor":"cw-color-picker-module__colorAreaCursor__lotg3"};
|
|
2498
3028
|
|
|
2499
3029
|
const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }) => {
|
|
2500
3030
|
const [rgb, setRgb] = React.useState({ r: 255, g: 255, b: 255 });
|
|
@@ -2697,15 +3227,15 @@ const CwColorPicker = ({ initialColor, onChange, previewText = "Color preview" }
|
|
|
2697
3227
|
// Calculate background color for the main area based on current hue
|
|
2698
3228
|
const hueColor = hsvToRgb(hsv.h, 100, 100);
|
|
2699
3229
|
const hueHex = rgbToHex(hueColor.r, hueColor.g, hueColor.b);
|
|
2700
|
-
return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$
|
|
3230
|
+
return (jsxRuntime.jsxs("div", { className: "cw-flex-column cw-gap-small", children: [jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-between-center cw-gap-small", children: [jsxRuntime.jsx("div", { className: styles$c.colorPreview, style: { backgroundColor: hexColor, color: getContrastColor(hexColor) }, children: previewText }), jsxRuntime.jsx("button", { type: "button", className: "cw-button", onClick: toggleInputMode, style: { minWidth: "3ch" }, children: inputMode === 'hex' ? 'RGB' : 'HEX' })] }), jsxRuntime.jsx("div", { className: "color-inputs-row", children: inputMode === 'hex' ? (jsxRuntime.jsx("input", { type: "text", value: hexColor, onChange: handleHexChange })) : (jsxRuntime.jsxs("div", { className: "cw-grid-base-3 cw-gap-small", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "R:" }), jsxRuntime.jsx("input", { type: "number", name: "r", min: "0", max: "255", value: rgb.r, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "G:" }), jsxRuntime.jsx("input", { type: "number", name: "g", min: "0", max: "255", value: rgb.g, onChange: handleRgbChange })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "B:" }), jsxRuntime.jsx("input", { type: "number", name: "b", min: "0", max: "255", value: rgb.b, onChange: handleRgbChange })] })] })) }), jsxRuntime.jsxs("div", { className: styles$c.colorPickerInteractiveArea, children: [jsxRuntime.jsx("div", { className: styles$c.hueBar, ref: hueBarRef, onClick: handleHueBarClick, children: jsxRuntime.jsx("div", { className: styles$c.hueBarSlider, style: { top: `${(360 - hsv.h) / 360 * 100}%` } }) }), jsxRuntime.jsxs("div", { className: styles$c.colorArea, ref: colorAreaRef, onClick: handleColorAreaClick, children: [jsxRuntime.jsxs("div", { className: styles$c.colorAreaOverlay, children: [jsxRuntime.jsx("div", { className: styles$c.hueBackground, style: { backgroundColor: hueHex } }), jsxRuntime.jsx("div", { className: styles$c.whiteGradient }), jsxRuntime.jsx("div", { className: styles$c.blackGradient })] }), jsxRuntime.jsx("div", { className: styles$c.colorAreaCursor, style: {
|
|
2701
3231
|
left: `${hsv.s}%`,
|
|
2702
3232
|
top: `${100 - hsv.v}%`
|
|
2703
3233
|
} })] })] })] }));
|
|
2704
3234
|
};
|
|
2705
3235
|
|
|
2706
|
-
var styles$
|
|
3236
|
+
var styles$b = {"container":"cw-input-color-module__container__x7gpk","selectColor":"cw-input-color-module__selectColor__DTo3V","disabled":"cw-input-color-module__disabled__O1fK5","readOnly":"cw-input-color-module__readOnly__HL-Bz","colorDropdown":"cw-input-color-module__colorDropdown__pX2bc"};
|
|
2707
3237
|
|
|
2708
|
-
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, width = '4rem', height = '2rem' }) => {
|
|
3238
|
+
const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled = false, readOnly = false, width = '4rem', height = '2rem', labelProps, layoutProps, }) => {
|
|
2709
3239
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2710
3240
|
const containerRef = React.useRef(null);
|
|
2711
3241
|
const dropdownRef = React.useRef(null);
|
|
@@ -2754,7 +3284,7 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
2754
3284
|
};
|
|
2755
3285
|
}, [isOpen]);
|
|
2756
3286
|
const handleToggle = () => {
|
|
2757
|
-
if (disabled)
|
|
3287
|
+
if (disabled || readOnly)
|
|
2758
3288
|
return;
|
|
2759
3289
|
setIsOpen(prev => !prev);
|
|
2760
3290
|
};
|
|
@@ -2836,11 +3366,11 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
2836
3366
|
break;
|
|
2837
3367
|
}
|
|
2838
3368
|
};
|
|
2839
|
-
return (jsxRuntime.jsxs(
|
|
3369
|
+
return (jsxRuntime.jsxs("div", { className: `cw-input-color ${styles$b.container}`, "data-direction": layoutProps?.direction ?? "row", "data-align": layoutProps?.align, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps })), jsxRuntime.jsx("div", { ref: containerRef, onClick: handleToggle, className: `${styles$b.selectColor} ${disabled ? styles$b.disabled : ''} ${readOnly ? styles$b.readOnly : ''}`, style: {
|
|
2840
3370
|
width,
|
|
2841
3371
|
height,
|
|
2842
3372
|
backgroundColor: value,
|
|
2843
|
-
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$
|
|
3373
|
+
}, "aria-label": "Open color picker", "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-readonly": readOnly, role: "button", tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown }), isOpen && reactDom.createPortal(jsxRuntime.jsx("div", { ref: dropdownRef, className: styles$b.colorDropdown, style: dropdownStyle, role: "dialog", "aria-modal": "true", "aria-label": "Color picker", children: jsxRuntime.jsx(CwColorPicker, { initialColor: value, onChange: handleColorChange, previewText: previewText }) }), document.body)] }));
|
|
2844
3374
|
};
|
|
2845
3375
|
|
|
2846
3376
|
/**
|
|
@@ -2859,15 +3389,20 @@ const CwInputColor = ({ value, onChange, previewText = "Color preview", disabled
|
|
|
2859
3389
|
* iconProps={{ id: "home" }}
|
|
2860
3390
|
* labelProps={{ children: "Name", width: "100px" }}
|
|
2861
3391
|
* buttonProps={{ children: "Ok", onclick:()=>{alert("hi")} }}
|
|
3392
|
+
* feedback={{ type: "danger", message: "This field is required" }}
|
|
2862
3393
|
* />
|
|
2863
3394
|
* ```
|
|
2864
3395
|
*/
|
|
2865
3396
|
function CwInputText(props) {
|
|
2866
|
-
const { alignProps, buttonProps, iconProps, labelProps, className, ...inputProps } = props;
|
|
3397
|
+
const { alignProps, buttonProps, iconProps, labelProps, className, feedback, ...inputProps } = props;
|
|
3398
|
+
const feedbackMessages = feedback
|
|
3399
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
3400
|
+
: [];
|
|
2867
3401
|
const containerClassName = className
|
|
2868
3402
|
? `cw-input-text ${className}`
|
|
2869
3403
|
: "cw-input-text";
|
|
2870
|
-
|
|
3404
|
+
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
3405
|
+
return (jsxRuntime.jsxs("div", { className: containerClassName, "data-direction": flexDirection, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { className: "cw-input-button", children: [jsxRuntime.jsx("input", { type: props.type ?? "text", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] })] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
2871
3406
|
}
|
|
2872
3407
|
|
|
2873
3408
|
/**
|
|
@@ -2902,8 +3437,13 @@ function CwInputNumber(CwInputNumberProps) {
|
|
|
2902
3437
|
}
|
|
2903
3438
|
|
|
2904
3439
|
function CwTextArea(props) {
|
|
2905
|
-
const { alignProps, buttonProps, iconProps, labelProps, resize, ...textareaProps } = props;
|
|
2906
|
-
|
|
3440
|
+
const { alignProps, buttonProps, iconProps, labelProps, resize, feedback, style, ...textareaProps } = props;
|
|
3441
|
+
const feedbackMessages = feedback
|
|
3442
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
3443
|
+
: [];
|
|
3444
|
+
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
3445
|
+
const dataDirection = { 'data-direction': flexDirection };
|
|
3446
|
+
return (jsxRuntime.jsxs("div", { className: "cw-text-area", ...dataDirection, style: style, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsx("textarea", { ...textareaProps, itemProp: textareaProps.required === true ? "required" : "", style: { resize: resize } }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
2907
3447
|
}
|
|
2908
3448
|
|
|
2909
3449
|
/**
|
|
@@ -2931,7 +3471,7 @@ function CwInputDate(props) {
|
|
|
2931
3471
|
return (jsxRuntime.jsx("div", { className: "cw-input-date", children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: inputProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsx("input", { type: "date", ...inputProps }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] }) }));
|
|
2932
3472
|
}
|
|
2933
3473
|
|
|
2934
|
-
var classes = {"datePicker":"cw-input-date-picker-
|
|
3474
|
+
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"};
|
|
2935
3475
|
|
|
2936
3476
|
const CwInputDatePicker = ({ value, onChange }) => {
|
|
2937
3477
|
const [isCalendarOpen, setIsCalendarOpen] = React.useState(false);
|
|
@@ -3333,7 +3873,7 @@ const CwImageArea = React.forwardRef((props, ref) => {
|
|
|
3333
3873
|
});
|
|
3334
3874
|
CwImageArea.displayName = "CwImageArea";
|
|
3335
3875
|
|
|
3336
|
-
var styles$
|
|
3876
|
+
var styles$a = {"cw-weekday-selector":"cw-weekday-selector-module__cw-weekday-selector__Iz4GZ"};
|
|
3337
3877
|
|
|
3338
3878
|
/**
|
|
3339
3879
|
* This class represents a week where days can be selected or unselected
|
|
@@ -3473,9 +4013,17 @@ const CwWeekdaySelector = ({ value = "", onChange, disabled = false }) => {
|
|
|
3473
4013
|
setSelectedDays(newWeekdays);
|
|
3474
4014
|
onChange?.(newWeekdays.toString());
|
|
3475
4015
|
};
|
|
3476
|
-
return (jsxRuntime.jsx("div", { className: styles$
|
|
4016
|
+
return (jsxRuntime.jsx("div", { className: styles$a["cw-weekday-selector"], children: Weekdays.getFullWeek().map(day => (jsxRuntime.jsx("input", { type: "checkbox", "data-day": day, checked: selectedDays.toArray().includes(day), onChange: (e) => handleChange(day, e.target.checked), disabled: disabled }, day))) }));
|
|
3477
4017
|
};
|
|
3478
4018
|
|
|
4019
|
+
var styles$9 = {"check-container":"cw-check-module__check-container__4nscZ","checkbox-group-container":"cw-check-module__checkbox-group-container__WMNbG"};
|
|
4020
|
+
|
|
4021
|
+
function CwCheck(props) {
|
|
4022
|
+
const { labelProps, labelText, iconProps, alignment = "row", className, ...inputProps } = props;
|
|
4023
|
+
const displayText = labelText || labelProps?.text;
|
|
4024
|
+
return (jsxRuntime.jsx("div", { className: `cw-check ${styles$9["check-container"]}${className ? ` ${className}` : ''}`, children: jsxRuntime.jsxs("label", { "data-direction": alignment, children: [jsxRuntime.jsx("input", { type: "checkbox", ...inputProps }), displayText && (jsxRuntime.jsxs("span", { className: "cw-icon-text", children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), displayText] }))] }) }));
|
|
4025
|
+
}
|
|
4026
|
+
|
|
3479
4027
|
function CwCheckbox(CwCheckboxProps) {
|
|
3480
4028
|
const handleChange = (e) => {
|
|
3481
4029
|
CwCheckboxProps.onChange?.(e.target.checked);
|
|
@@ -3491,6 +4039,23 @@ function CwCheckbox(CwCheckboxProps) {
|
|
|
3491
4039
|
: "cw_checkboxContent cwellt_flex_row" + " " + CwCheckboxProps.classNameContainer, style: CwCheckboxProps.styleContainer, children: [inputElement, CwCheckboxProps.labelName ? (jsxRuntime.jsx("label", { htmlFor: CwCheckboxProps.id, className: CwCheckboxProps.labelClassName, children: CwCheckboxProps.labelName })) : null] }));
|
|
3492
4040
|
}
|
|
3493
4041
|
|
|
4042
|
+
function CwCheckboxGroup({ options, value = [], onChange, labelProps, alignProps, required, disabled, optionsAlignment = "row", className, feedback, }) {
|
|
4043
|
+
const handleChange = (optionValue, checked) => {
|
|
4044
|
+
if (checked) {
|
|
4045
|
+
onChange([...value, optionValue]);
|
|
4046
|
+
}
|
|
4047
|
+
else {
|
|
4048
|
+
onChange(value.filter(v => v !== optionValue));
|
|
4049
|
+
}
|
|
4050
|
+
};
|
|
4051
|
+
const feedbackMessages = feedback
|
|
4052
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4053
|
+
: [];
|
|
4054
|
+
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
4055
|
+
const dataDirection = { 'data-direction': flexDirection };
|
|
4056
|
+
return (jsxRuntime.jsxs("div", { className: `cw-checkbox-group ${styles$9["checkbox-group-container"]}${className ? ` ${className}` : ''}`, ...dataDirection, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsx("div", { className: `${optionsAlignment === "row" ? "cw-flex-column cw-gap-small" : "cw-flex-row cw-flex-wrap"}`, children: options.map((option) => (jsxRuntime.jsx(CwCheck, { labelText: option.label, checked: value.includes(option.value), disabled: disabled || option.disabled, alignment: optionsAlignment, onChange: (e) => handleChange(option.value, e.target.checked) }, option.value))) })] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-color": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
4057
|
+
}
|
|
4058
|
+
|
|
3494
4059
|
function CwToggle(props) {
|
|
3495
4060
|
const { labelProps, labelText, iconProps, alignment = "row", className, style, ...inputProps } = props;
|
|
3496
4061
|
const displayText = labelText || labelProps?.text;
|
|
@@ -3540,10 +4105,13 @@ function CwOption(props) {
|
|
|
3540
4105
|
* </CwSelect>
|
|
3541
4106
|
*/
|
|
3542
4107
|
function CwSelect(props) {
|
|
3543
|
-
const { alignProps, labelProps, buttonProps, iconProps, placeholder, children, style, ...selectProps } = props;
|
|
3544
|
-
const
|
|
3545
|
-
|
|
3546
|
-
|
|
4108
|
+
const { alignProps, labelProps, buttonProps, iconProps, placeholder, feedback, children, style, className, ...selectProps } = props;
|
|
4109
|
+
const feedbackMessages = feedback
|
|
4110
|
+
? Array.isArray(feedback) ? feedback : [feedback]
|
|
4111
|
+
: [];
|
|
4112
|
+
const flexDirection = alignProps?.flexDirection ?? "row";
|
|
4113
|
+
const dataDirection = { 'data-direction': flexDirection };
|
|
4114
|
+
return (jsxRuntime.jsxs("div", { className: `cw-select${className ? ` ${className}` : ''}`, ...dataDirection, style: style, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: selectProps.required === true ? "required" : "", children: [labelProps && (jsxRuntime.jsxs(CwLabel, { ...labelProps, children: [iconProps && jsxRuntime.jsx(CwIcon, { ...iconProps }), labelProps.text] })), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-gap-small cw-flex-grow", children: [jsxRuntime.jsxs("select", { ...selectProps, children: [placeholder && jsxRuntime.jsx(CwOption, { value: "", children: placeholder }), children] }), buttonProps && jsxRuntime.jsx(CwButton, { ...buttonProps })] })] }), feedbackMessages.map((feedbackItem, index) => (jsxRuntime.jsx("p", { className: "cw-input-info", "data-type": feedbackItem.type, children: feedbackItem.message }, index)))] }));
|
|
3547
4115
|
}
|
|
3548
4116
|
|
|
3549
4117
|
function CwDropdownFilter(props) {
|
|
@@ -3571,13 +4139,13 @@ function itemsToMultiFilterTags(items, nameKey, valueKey, category, primaryColor
|
|
|
3571
4139
|
return result;
|
|
3572
4140
|
}
|
|
3573
4141
|
|
|
3574
|
-
var styles$8 = {"cw-multifilter-tag":"cw-multi-filter-tag-
|
|
4142
|
+
var styles$8 = {"cw-multifilter-tag":"cw-multi-filter-tag-module__cw-multifilter-tag__Epda-"};
|
|
3575
4143
|
|
|
3576
4144
|
const CwMultiFilterTag = props => {
|
|
3577
4145
|
const { ID, Name, Value, Category, Removable, PrimaryColor, Selectable, Selected } = props;
|
|
3578
4146
|
const backgroundColor = `rgb(${PrimaryColor.r},${PrimaryColor.g},${PrimaryColor.b})`;
|
|
3579
4147
|
const isOutlineMode = Selected && !Removable;
|
|
3580
|
-
return (jsxRuntime.jsx("li", { className: styles$8["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: Name, onClick: () => {
|
|
4148
|
+
return (jsxRuntime.jsx("li", { className: styles$8["cw-multifilter-tag"], id: ID, "data-value": Value, "data-category": Category, "data-selected": !!Selected, title: props.tooltip ?? Name, onClick: () => {
|
|
3581
4149
|
if (Selectable)
|
|
3582
4150
|
props.OnSelect?.(props);
|
|
3583
4151
|
}, children: jsxRuntime.jsx(CwChip, { label: Name, colorScheme: "custom", customColor: backgroundColor, variant: isOutlineMode ? "outline" : "soft", closable: Removable, onClose: () => props.OnRemove?.(props),
|
|
@@ -3587,7 +4155,7 @@ const CwMultiFilterTag = props => {
|
|
|
3587
4155
|
} : undefined }) }));
|
|
3588
4156
|
};
|
|
3589
4157
|
|
|
3590
|
-
var styles$7 = {"cw-multi-filter-catalog-container":"cw-multi-filter-
|
|
4158
|
+
var styles$7 = {"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"};
|
|
3591
4159
|
|
|
3592
4160
|
/**
|
|
3593
4161
|
* A multiple filter selector, a MULTI-SELECT even. Allows users to select and filter items based on tags.
|
|
@@ -3835,14 +4403,23 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
|
|
|
3835
4403
|
}, children: [jsxRuntime.jsxs("div", { onClick: handleDivClick, className: styles$7["cw-multi-filter-search"], style: isPanelOpen ? { outline: "1px solid var(--cw-color-primary)", outlineOffset: "-2px" } : {}, children: [jsxRuntime.jsxs("ul", { id: id + "_selected_filters", children: [Array.from(selectedTags).map(tag => (React.createElement(CwMultiFilterTag, { ...tag, key: tag.ID, Selectable: false, Removable: true, OnRemove: () => removeTag(tag.ID) }))), jsxRuntime.jsx("input", { type: "text", id: id + "_input", ref: inputRef, value: inputTextValue, spellCheck: false, onFocus: () => setIsPanelOpen(true), onChange: e => handleInputText(e.target.value), autoComplete: "off", placeholder: "Write to filter", onKeyDown: e => {
|
|
3836
4404
|
switch (e.key) {
|
|
3837
4405
|
case "Enter":
|
|
3838
|
-
case "Tab":
|
|
4406
|
+
case "Tab": {
|
|
3839
4407
|
if (inputTextValue.trim().length > 0 && filteredTags.size > 0) {
|
|
3840
|
-
const
|
|
4408
|
+
const input = inputTextValue.trim().toLowerCase();
|
|
4409
|
+
const tagsArr = Array.from(filteredTags);
|
|
4410
|
+
let foundTag = tagsArr.find(tag => tag.Name.trim().toLowerCase() === input);
|
|
4411
|
+
if (!foundTag) {
|
|
4412
|
+
foundTag = tagsArr.find(tag => tag.Name.trim().toLowerCase().startsWith(input));
|
|
4413
|
+
}
|
|
4414
|
+
if (!foundTag) {
|
|
4415
|
+
foundTag = tagsArr[0];
|
|
4416
|
+
}
|
|
3841
4417
|
if (foundTag) {
|
|
3842
4418
|
addTag(foundTag);
|
|
3843
4419
|
}
|
|
3844
4420
|
}
|
|
3845
4421
|
break;
|
|
4422
|
+
}
|
|
3846
4423
|
case "Backspace": {
|
|
3847
4424
|
if (inputTextValue === "" && selectedTags.size > 0) {
|
|
3848
4425
|
removeTag(Array.from(selectedTags).toReversed()[0].ID);
|
|
@@ -3872,7 +4449,22 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
|
|
|
3872
4449
|
: {
|
|
3873
4450
|
backgroundColor: getColor(category).primary,
|
|
3874
4451
|
color: getColor(category).onPrimary,
|
|
3875
|
-
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsxRuntime.jsx("ul", { children: Array.from(filteredTags)
|
|
4452
|
+
}, onClick: () => handleClickCategory(category), children: category }, category)))] }), jsxRuntime.jsx("ul", { children: Array.from(filteredTags)
|
|
4453
|
+
.sort((a, b) => {
|
|
4454
|
+
const input = inputTextValue.trim().toLowerCase();
|
|
4455
|
+
const aName = a.Name.trim().toLowerCase();
|
|
4456
|
+
const bName = b.Name.trim().toLowerCase();
|
|
4457
|
+
if (aName === input && bName !== input)
|
|
4458
|
+
return -1;
|
|
4459
|
+
if (bName === input && aName !== input)
|
|
4460
|
+
return 1;
|
|
4461
|
+
if (aName.startsWith(input) && !bName.startsWith(input))
|
|
4462
|
+
return -1;
|
|
4463
|
+
if (bName.startsWith(input) && !aName.startsWith(input))
|
|
4464
|
+
return 1;
|
|
4465
|
+
return 0;
|
|
4466
|
+
})
|
|
4467
|
+
.map((props) => (jsxRuntime.jsx(CwMultiFilterTag, { ...props, Selectable: true, Removable: false, Selected: Array.from(selectedTags).some(p => p.ID === props.ID), OnSelect: () => {
|
|
3876
4468
|
if (Array.from(selectedTags).some(p => p.ID === props.ID))
|
|
3877
4469
|
removeTag(props.ID);
|
|
3878
4470
|
else
|
|
@@ -3880,7 +4472,7 @@ const CwMultiFilter = ({ allTags, id, onChangeSelectedTags, selectedTags, style
|
|
|
3880
4472
|
} }, props.ID))) })] })] }));
|
|
3881
4473
|
};
|
|
3882
4474
|
|
|
3883
|
-
var styles$6 = {"tree-container":"cw-tree-view-
|
|
4475
|
+
var styles$6 = {"tree-container":"cw-tree-view-module__tree-container__NN-HJ","tree-wrapper":"cw-tree-view-module__tree-wrapper__keBZI","tree-item":"cw-tree-view-module__tree-item__prE9N","tree-node":"cw-tree-view-module__tree-node__wfro9","selected":"cw-tree-view-module__selected__XJQ0w","non-selectable":"cw-tree-view-module__non-selectable__YuPSx","tree-children":"cw-tree-view-module__tree-children__ji8CZ","empty-state":"cw-tree-view-module__empty-state__yvRjo","tree-label":"cw-tree-view-module__tree-label__ss3Nf","tree-spacer":"cw-tree-view-module__tree-spacer__E9Ud2"};
|
|
3884
4476
|
|
|
3885
4477
|
function CwTreeView({ data, onSelect, allowParentSelection = false, selectedId: initialSelectedId = null }) {
|
|
3886
4478
|
const [expanded, setExpanded] = React.useState(new Set());
|
|
@@ -4065,7 +4657,7 @@ function CwSearchInput(optionsProps) {
|
|
|
4065
4657
|
return (jsxRuntime.jsxs("div", { className: `cw-search-input ${className || ""}`, style: style, id: id, ...otherProps, "data-direction": direction, children: [jsxRuntime.jsxs(CwAlign, { ...alignProps, children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-search-input-wrapper", children: [jsxRuntime.jsx("input", { type: "text", value: searchText, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, placeholder: placeholder, className: "cw-input-search", disabled: disabled }), isLoading && (jsxRuntime.jsx("div", { className: "cw-search-input-loading", children: jsxRuntime.jsx(CwIcon, { iconId: "spinner" }) })), jsxRuntime.jsx("div", { className: "cw-search-input-icons", children: searchText && !disabled && !isLoading ? (jsxRuntime.jsx(CwButton, { type: "button", onClick: handleClearClick, "aria-label": "Clear search", variant: "icon", icon: "close", color: "neutral" })) : (iconProps ? jsxRuntime.jsx(CwIcon, { ...iconProps }) : jsxRuntime.jsx(CwIcon, { iconId: "search" })) })] })] }), showDropdown && filteredOptions.length > 0 && (jsxRuntime.jsx("div", { className: "cw-input-search-dropdown", children: jsxRuntime.jsx("ul", { children: filteredOptions.map((option) => (jsxRuntime.jsx("li", { onClick: () => handleOptionSelect(option), onMouseDown: (e) => e.preventDefault(), children: renderOption ? renderOption(option) : option.description }, option.id))) }) }))] }));
|
|
4066
4658
|
}
|
|
4067
4659
|
|
|
4068
|
-
var styles$5 = {"menu":"cw-context-menu-
|
|
4660
|
+
var styles$5 = {"menu":"cw-context-menu-module__menu__tXmun","item":"cw-context-menu-module__item__-ko8L","arrow":"cw-context-menu-module__arrow__LHZmQ"};
|
|
4069
4661
|
|
|
4070
4662
|
const ARROW_SIZE = 8;
|
|
4071
4663
|
const SAFETY_MARGIN = 8;
|
|
@@ -4314,14 +4906,102 @@ function CwBtnDelete({ cw_btnOnclick, cw_btn_disabled, onClick, disabled, ...res
|
|
|
4314
4906
|
return (jsxRuntime.jsx(CwButton, { ...rest, variant: "icon", icon: "delete", color: "danger", onClick: onClick ?? cw_btnOnclick, disabled: disabled ?? cw_btn_disabled }));
|
|
4315
4907
|
}
|
|
4316
4908
|
|
|
4317
|
-
var styles$4 = {"pickerWrapper":"cw-pickers-base-
|
|
4909
|
+
var styles$4 = {"pickerWrapper":"cw-pickers-base-module__pickerWrapper__Fb9Zo","pickerIcons":"cw-pickers-base-module__pickerIcons__dyd2-","pickerPopup":"cw-pickers-base-module__pickerPopup__dkxJo"};
|
|
4910
|
+
|
|
4911
|
+
/**
|
|
4912
|
+
* Renders a picker popup in a portal so it escapes overflow containers.
|
|
4913
|
+
* Positions itself relative to the anchor element.
|
|
4914
|
+
*/
|
|
4915
|
+
function usePickerPopup({ anchorRef, isOpen, onClose, position = "left-bottom" }) {
|
|
4916
|
+
const popupRef = React.useRef(null);
|
|
4917
|
+
const [style, setStyle] = React.useState({ position: "fixed", top: 0, left: 0, zIndex: 1000 });
|
|
4918
|
+
const reposition = React.useCallback(() => {
|
|
4919
|
+
const anchor = anchorRef.current;
|
|
4920
|
+
const popup = popupRef.current;
|
|
4921
|
+
if (!anchor || !popup)
|
|
4922
|
+
return;
|
|
4923
|
+
const rect = anchor.getBoundingClientRect();
|
|
4924
|
+
const popupRect = popup.getBoundingClientRect();
|
|
4925
|
+
// Determine vertical placement
|
|
4926
|
+
const preferTop = position.includes("top");
|
|
4927
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
4928
|
+
const spaceAbove = rect.top;
|
|
4929
|
+
const popupH = popupRect.height || 300; // fallback for first render
|
|
4930
|
+
let top;
|
|
4931
|
+
if (preferTop && spaceAbove >= popupH) {
|
|
4932
|
+
top = rect.top - popupH;
|
|
4933
|
+
}
|
|
4934
|
+
else if (!preferTop && spaceBelow >= popupH + 4) {
|
|
4935
|
+
top = rect.bottom + 4;
|
|
4936
|
+
}
|
|
4937
|
+
else {
|
|
4938
|
+
// Flip if preferred side doesn't fit
|
|
4939
|
+
top = spaceBelow >= popupH + 4 ? rect.bottom + 4 : rect.top - popupH;
|
|
4940
|
+
}
|
|
4941
|
+
// Determine horizontal placement
|
|
4942
|
+
let left;
|
|
4943
|
+
if (position.includes("right")) {
|
|
4944
|
+
left = rect.right - (popupRect.width || rect.width);
|
|
4945
|
+
}
|
|
4946
|
+
else {
|
|
4947
|
+
left = rect.left;
|
|
4948
|
+
}
|
|
4949
|
+
// Clamp to viewport
|
|
4950
|
+
left = Math.max(4, Math.min(left, window.innerWidth - (popupRect.width || 200) - 4));
|
|
4951
|
+
top = Math.max(4, top);
|
|
4952
|
+
setStyle({ position: "fixed", top, left, zIndex: 1000 });
|
|
4953
|
+
}, [anchorRef, position]);
|
|
4954
|
+
// Reposition on open + observe scroll/resize on all ancestors
|
|
4955
|
+
React.useEffect(() => {
|
|
4956
|
+
if (!isOpen)
|
|
4957
|
+
return;
|
|
4958
|
+
reposition();
|
|
4959
|
+
// Re-measure after the popup renders to get its actual size
|
|
4960
|
+
requestAnimationFrame(reposition);
|
|
4961
|
+
const handleUpdate = () => reposition();
|
|
4962
|
+
window.addEventListener("resize", handleUpdate);
|
|
4963
|
+
window.addEventListener("scroll", handleUpdate, true); // capture phase catches all scrollable ancestors
|
|
4964
|
+
return () => {
|
|
4965
|
+
window.removeEventListener("resize", handleUpdate);
|
|
4966
|
+
window.removeEventListener("scroll", handleUpdate, true);
|
|
4967
|
+
};
|
|
4968
|
+
}, [isOpen, reposition]);
|
|
4969
|
+
// Close on outside click — checks both anchor and popup
|
|
4970
|
+
React.useEffect(() => {
|
|
4971
|
+
if (!isOpen)
|
|
4972
|
+
return;
|
|
4973
|
+
const handleMouseDown = (e) => {
|
|
4974
|
+
const target = e.target;
|
|
4975
|
+
if (anchorRef.current?.contains(target) ||
|
|
4976
|
+
popupRef.current?.contains(target))
|
|
4977
|
+
return;
|
|
4978
|
+
onClose();
|
|
4979
|
+
};
|
|
4980
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
4981
|
+
return () => document.removeEventListener("mousedown", handleMouseDown);
|
|
4982
|
+
}, [isOpen, onClose, anchorRef]);
|
|
4983
|
+
const renderPopup = React.useCallback((children) => {
|
|
4984
|
+
if (!isOpen)
|
|
4985
|
+
return null;
|
|
4986
|
+
return reactDom.createPortal(children, document.body);
|
|
4987
|
+
}, [isOpen]);
|
|
4988
|
+
return { popupRef, popupStyle: style, renderPopup };
|
|
4989
|
+
}
|
|
4318
4990
|
|
|
4319
4991
|
function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabledMatcher, defaultMonth, labelProps, alignProps, placeholder = "Select a date", displayFormat = "dd.MM.yyyy", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, }) {
|
|
4320
4992
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
4321
4993
|
const [inputValue, setInputValue] = React.useState("");
|
|
4322
4994
|
const containerRef = React.useRef(null);
|
|
4995
|
+
const wrapperRef = React.useRef(null);
|
|
4323
4996
|
const inputRef = React.useRef(null);
|
|
4324
4997
|
const prevValueRef = React.useRef(undefined);
|
|
4998
|
+
const handleClose = React.useCallback(() => setIsOpen(false), []);
|
|
4999
|
+
const { popupRef, popupStyle, renderPopup } = usePickerPopup({
|
|
5000
|
+
anchorRef: wrapperRef,
|
|
5001
|
+
isOpen,
|
|
5002
|
+
onClose: handleClose,
|
|
5003
|
+
position: popupPosition,
|
|
5004
|
+
});
|
|
4325
5005
|
// Parse date from string based on format
|
|
4326
5006
|
const parseDate = React.useCallback((dateString, formatStr) => {
|
|
4327
5007
|
try {
|
|
@@ -4404,20 +5084,6 @@ function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabl
|
|
|
4404
5084
|
}
|
|
4405
5085
|
}
|
|
4406
5086
|
}, [value, displayFormat]);
|
|
4407
|
-
// Close calendar when clicking outside
|
|
4408
|
-
React.useEffect(() => {
|
|
4409
|
-
const handleClickOutside = (event) => {
|
|
4410
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
4411
|
-
setIsOpen(false);
|
|
4412
|
-
}
|
|
4413
|
-
};
|
|
4414
|
-
if (isOpen) {
|
|
4415
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
4416
|
-
}
|
|
4417
|
-
return () => {
|
|
4418
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
4419
|
-
};
|
|
4420
|
-
}, [isOpen]);
|
|
4421
5087
|
const handleDaySelect = React.useCallback((date) => {
|
|
4422
5088
|
onChange(date);
|
|
4423
5089
|
setIsOpen(false);
|
|
@@ -4493,14 +5159,14 @@ function CwDatePicker({ value, onChange, minDate, maxDate, disabledDates, disabl
|
|
|
4493
5159
|
...(maxDate ? [{ after: maxDate }] : []),
|
|
4494
5160
|
...(disabledMatcher ? [disabledMatcher] : []),
|
|
4495
5161
|
], [disabledDates, minDate, maxDate, disabledMatcher]);
|
|
4496
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }),
|
|
5162
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: styles$4.pickerPopup, style: popupStyle, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: value || undefined, defaultMonth: defaultMonth || value || undefined, onSelect: handleDaySelect, disabled: disabledDays, numberOfMonths: numberOfMonths, modifiers: {
|
|
4497
5163
|
today: new Date(),
|
|
4498
5164
|
}, modifiersClassNames: {
|
|
4499
5165
|
today: "rdp-day-today",
|
|
4500
5166
|
} }), showTodayButton && (jsxRuntime.jsx("footer", { className: "cw-flex-row cw-align-right-center", children: jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: handleTodayClick, text: "Today" }) }))] }))] })] }) }));
|
|
4501
5167
|
}
|
|
4502
5168
|
|
|
4503
|
-
var rangeStyles = {"rangeWrapper":"cw-range-picker-
|
|
5169
|
+
var rangeStyles = {"rangeWrapper":"cw-range-picker-module__rangeWrapper__1nIVs","rangePopup":"cw-range-picker-module__rangePopup__E5jd1","presetList":"cw-range-picker-module__presetList__INiLo"};
|
|
4504
5170
|
|
|
4505
5171
|
const PRESET_LIBRARY = {
|
|
4506
5172
|
// === PAST DAYS ===
|
|
@@ -4777,9 +5443,20 @@ function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, d
|
|
|
4777
5443
|
const [inputToValue, setInputToValue] = React.useState("");
|
|
4778
5444
|
const [focusedInput, setFocusedInput] = React.useState();
|
|
4779
5445
|
const containerRef = React.useRef(null);
|
|
5446
|
+
const wrapperRef = React.useRef(null);
|
|
4780
5447
|
const inputFromRef = React.useRef(null);
|
|
4781
5448
|
const inputToRef = React.useRef(null);
|
|
4782
5449
|
const prevValueRef = React.useRef(undefined);
|
|
5450
|
+
const handleClose = React.useCallback(() => {
|
|
5451
|
+
setIsOpen(false);
|
|
5452
|
+
setFocusedInput(undefined);
|
|
5453
|
+
}, []);
|
|
5454
|
+
const { popupRef, popupStyle, renderPopup } = usePickerPopup({
|
|
5455
|
+
anchorRef: wrapperRef,
|
|
5456
|
+
isOpen,
|
|
5457
|
+
onClose: handleClose,
|
|
5458
|
+
position: popupPosition,
|
|
5459
|
+
});
|
|
4783
5460
|
// Calculate presets to render
|
|
4784
5461
|
const presetsToRender = React.useMemo(() => {
|
|
4785
5462
|
let presets = [];
|
|
@@ -4888,21 +5565,6 @@ function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, d
|
|
|
4888
5565
|
}
|
|
4889
5566
|
}
|
|
4890
5567
|
}, [value, displayFormat]);
|
|
4891
|
-
// Close calendar when clicking outside
|
|
4892
|
-
React.useEffect(() => {
|
|
4893
|
-
const handleClickOutside = (event) => {
|
|
4894
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
4895
|
-
setIsOpen(false);
|
|
4896
|
-
setFocusedInput(undefined);
|
|
4897
|
-
}
|
|
4898
|
-
};
|
|
4899
|
-
if (isOpen) {
|
|
4900
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
4901
|
-
}
|
|
4902
|
-
return () => {
|
|
4903
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
4904
|
-
};
|
|
4905
|
-
}, [isOpen]);
|
|
4906
5568
|
const handleRangeSelect = React.useCallback((range, // El rango sugerido por react-day-picker
|
|
4907
5569
|
selectedDay) => {
|
|
4908
5570
|
let newRange;
|
|
@@ -5123,14 +5785,14 @@ function CwDateRangePicker({ value, onChange, minDate, maxDate, disabledDates, d
|
|
|
5123
5785
|
}
|
|
5124
5786
|
return undefined;
|
|
5125
5787
|
}, [value]);
|
|
5126
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, "data-focused": focusedInput === 'from' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, "data-focused": focusedInput === 'to' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }),
|
|
5788
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-rangepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: rangeStyles.rangeWrapper, children: [jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputFromRef, type: "text", value: inputFromValue, placeholder: placeholderFrom, onChange: handleInputFromChange, onBlur: () => handleInputBlur('from'), onClick: handleInputFromClick, onKeyDown: (e) => handleInputKeyDown(e, 'from'), disabled: disabled, required: required, "data-focused": focusedInput === 'from' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.from && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearFrom, tabIndex: -1, "aria-label": "Clear from date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), jsxRuntime.jsx(CwIcon, { iconId: "arrow-right", size: "medium" }), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputToRef, type: "text", value: inputToValue, placeholder: placeholderTo, onChange: handleInputToChange, onBlur: () => handleInputBlur('to'), onClick: handleInputToClick, onKeyDown: (e) => handleInputKeyDown(e, 'to'), disabled: disabled, required: required, "data-focused": focusedInput === 'to' }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value?.to && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClearTo, tabIndex: -1, "aria-label": "Clear to date" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar" })) })] }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${rangeStyles.rangePopup}`, style: popupStyle, children: [showPresets && presetsToRender.length > 0 && (jsxRuntime.jsx("div", { className: rangeStyles.presetList, children: presetsToRender.map((preset) => (jsxRuntime.jsx("button", { type: "button", onClick: (e) => handlePresetClick(preset, e), children: preset.label }, preset.key))) })), jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "range", selected: selectedRange, onSelect: handleRangeSelect, disabled: disabledDays, numberOfMonths: numberOfMonths, defaultMonth: defaultMonth || value?.from || undefined, modifiers: {
|
|
5127
5789
|
today: new Date(),
|
|
5128
5790
|
}, modifiersClassNames: {
|
|
5129
5791
|
today: "rdp-day-today",
|
|
5130
5792
|
} })] }))] })] }) }));
|
|
5131
5793
|
}
|
|
5132
5794
|
|
|
5133
|
-
var timeStyles = {"timePickerPopup":"cw-time-picker-
|
|
5795
|
+
var timeStyles = {"timePickerPopup":"cw-time-picker-module__timePickerPopup__BN63t","timePickerList":"cw-time-picker-module__timePickerList__E88pr","selected":"cw-time-picker-module__selected__qVnfL","hasIcons":"cw-time-picker-module__hasIcons__ZiGUf","notIcons":"cw-time-picker-module__notIcons__3icu1"};
|
|
5134
5796
|
|
|
5135
5797
|
const isMobileDevice = () => {
|
|
5136
5798
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
@@ -5139,8 +5801,16 @@ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelP
|
|
|
5139
5801
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
5140
5802
|
const [inputValue, setInputValue] = React.useState("");
|
|
5141
5803
|
const containerRef = React.useRef(null);
|
|
5804
|
+
const wrapperRef = React.useRef(null);
|
|
5142
5805
|
const inputRef = React.useRef(null);
|
|
5143
5806
|
const selectedItemRef = React.useRef(null);
|
|
5807
|
+
const handleClose = React.useCallback(() => setIsOpen(false), []);
|
|
5808
|
+
const { popupRef, popupStyle, renderPopup } = usePickerPopup({
|
|
5809
|
+
anchorRef: wrapperRef,
|
|
5810
|
+
isOpen,
|
|
5811
|
+
onClose: handleClose,
|
|
5812
|
+
position: popupPosition,
|
|
5813
|
+
});
|
|
5144
5814
|
// Sync input value with prop value
|
|
5145
5815
|
React.useEffect(() => {
|
|
5146
5816
|
if (value) {
|
|
@@ -5168,20 +5838,6 @@ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelP
|
|
|
5168
5838
|
return options;
|
|
5169
5839
|
};
|
|
5170
5840
|
const timeOptions = generateTimeOptions();
|
|
5171
|
-
// Close dropdown when clicking outside
|
|
5172
|
-
React.useEffect(() => {
|
|
5173
|
-
const handleClickOutside = (event) => {
|
|
5174
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
5175
|
-
setIsOpen(false);
|
|
5176
|
-
}
|
|
5177
|
-
};
|
|
5178
|
-
if (isOpen) {
|
|
5179
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
5180
|
-
}
|
|
5181
|
-
return () => {
|
|
5182
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
5183
|
-
};
|
|
5184
|
-
}, [isOpen]);
|
|
5185
5841
|
// Scroll to selected time when opening dropdown
|
|
5186
5842
|
React.useEffect(() => {
|
|
5187
5843
|
if (isOpen && selectedItemRef.current) {
|
|
@@ -5292,13 +5948,40 @@ function CwTimePicker({ value, onChange, interval = 15, minTime, maxTime, labelP
|
|
|
5292
5948
|
return (jsxRuntime.jsx("div", { className: `cw-timepicker cw-timepicker-native ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsx("div", { className: styles$4.pickerWrapper, children: jsxRuntime.jsx("input", { type: "time", value: displayValue, onChange: handleNativeChange, min: minTime, max: maxTime, step: interval * 60, disabled: disabled, required: required, placeholder: placeholder, className: "cw-timepicker-native" }) })] }) }));
|
|
5293
5949
|
}
|
|
5294
5950
|
// Custom time picker
|
|
5295
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 5, className: showClear ? timeStyles.hasIcons : timeStyles.notIcons }), showClear && (jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsxRuntime.jsx(CwIcon, { iconId: "clock" })) })),
|
|
5951
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-timepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 5, className: showClear ? timeStyles.hasIcons : timeStyles.notIcons }), showClear && (jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", icon: "close", color: "neutral", onClick: handleClear, tabIndex: -1, "aria-label": "Clear time" })) : (jsxRuntime.jsx(CwIcon, { iconId: "clock" })) })), renderPopup(jsxRuntime.jsx("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${timeStyles.timePickerPopup}`, style: popupStyle, children: jsxRuntime.jsx("div", { className: timeStyles.timePickerList, children: timeOptions.map((time) => {
|
|
5296
5952
|
const isSelected = time === value;
|
|
5297
5953
|
return (jsxRuntime.jsx("button", { ref: isSelected ? selectedItemRef : null, type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
5298
5954
|
}) }) }))] })] }) }));
|
|
5299
5955
|
}
|
|
5300
5956
|
|
|
5301
|
-
|
|
5957
|
+
/**
|
|
5958
|
+
* Converts a Date to a new Date whose local year/month/day
|
|
5959
|
+
* reflect the date in the given UTC offset.
|
|
5960
|
+
*
|
|
5961
|
+
* This is necessary because date-fns format() and DayPicker
|
|
5962
|
+
* always use the browser's local timezone. By "shifting" the date,
|
|
5963
|
+
* we ensure the correct date displays regardless of browser timezone.
|
|
5964
|
+
*
|
|
5965
|
+
* @param date - The original Date object
|
|
5966
|
+
* @param timezoneOffset - Numeric offset in hours (e.g., 0 for UTC, 1 for CET, -5 for EST, 5.5 for IST)
|
|
5967
|
+
* @returns A new Date with local fields matching the target timezone's date
|
|
5968
|
+
*/
|
|
5969
|
+
function getDateInOffset(date, timezoneOffset) {
|
|
5970
|
+
const m = moment$1(date).utcOffset(timezoneOffset * 60);
|
|
5971
|
+
return new Date(m.year(), m.month(), m.date());
|
|
5972
|
+
}
|
|
5973
|
+
/**
|
|
5974
|
+
* Gets the time string (HH:mm) for a Date in the given UTC offset.
|
|
5975
|
+
*
|
|
5976
|
+
* @param date - The original Date object
|
|
5977
|
+
* @param timezoneOffset - Numeric offset in hours (e.g., 0 for UTC, 1 for CET, -5 for EST, 5.5 for IST)
|
|
5978
|
+
* @returns Time string in "HH:mm" format for the given offset
|
|
5979
|
+
*/
|
|
5980
|
+
function getTimeInOffset(date, timezoneOffset) {
|
|
5981
|
+
return moment$1(date).utcOffset(timezoneOffset * 60).format("HH:mm");
|
|
5982
|
+
}
|
|
5983
|
+
|
|
5984
|
+
function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, datePlaceholder = "dd.MM.yyyy", timePlaceholder = "HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showNowButton = false, timezoneOffset, }) {
|
|
5302
5985
|
// ========================================
|
|
5303
5986
|
// PROPS NORMALIZATION
|
|
5304
5987
|
// ========================================
|
|
@@ -5330,10 +6013,32 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
5330
6013
|
const normalizedMinDateTime = React.useMemo(() => normalizeDateTime(minDateTime, 'minDateTime'), [minDateTime, normalizeDateTime]);
|
|
5331
6014
|
const normalizedMaxDateTime = React.useMemo(() => normalizeDateTime(maxDateTime, 'maxDateTime'), [maxDateTime, normalizeDateTime]);
|
|
5332
6015
|
// ========================================
|
|
6016
|
+
// HELPERS CON MOMENT
|
|
6017
|
+
// ========================================
|
|
6018
|
+
/**
|
|
6019
|
+
* Convert a Date to a "display date" whose local year/month/day
|
|
6020
|
+
* reflect the date in the target timezone offset.
|
|
6021
|
+
* When timezoneOffset is undefined, returns the date as-is.
|
|
6022
|
+
*/
|
|
6023
|
+
const toDisplayDate = React.useCallback((date) => {
|
|
6024
|
+
return timezoneOffset !== undefined
|
|
6025
|
+
? getDateInOffset(date, timezoneOffset)
|
|
6026
|
+
: date;
|
|
6027
|
+
}, [timezoneOffset]);
|
|
6028
|
+
/**
|
|
6029
|
+
* Get the time string (HH:mm) for a Date, adjusted for timezone offset.
|
|
6030
|
+
* When timezoneOffset is undefined, uses local time.
|
|
6031
|
+
*/
|
|
6032
|
+
const toDisplayTime = React.useCallback((date) => {
|
|
6033
|
+
return timezoneOffset !== undefined
|
|
6034
|
+
? getTimeInOffset(date, timezoneOffset)
|
|
6035
|
+
: `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
|
|
6036
|
+
}, [timezoneOffset]);
|
|
6037
|
+
// ========================================
|
|
5333
6038
|
// INTERNAL STATE
|
|
5334
6039
|
// ========================================
|
|
5335
|
-
const [selectedDate, setSelectedDate] = React.useState(value);
|
|
5336
|
-
const [selectedTime, setSelectedTime] = React.useState(value ?
|
|
6040
|
+
const [selectedDate, setSelectedDate] = React.useState(value ? toDisplayDate(value) : undefined);
|
|
6041
|
+
const [selectedTime, setSelectedTime] = React.useState(value ? toDisplayTime(value) : undefined);
|
|
5337
6042
|
// Track previous value to detect external changes
|
|
5338
6043
|
const prevValueRef = React.useRef(undefined);
|
|
5339
6044
|
// ========================================
|
|
@@ -5348,28 +6053,24 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
5348
6053
|
const combineDateTime = React.useCallback((date, time) => {
|
|
5349
6054
|
if (!date)
|
|
5350
6055
|
return undefined;
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
return undefined;
|
|
5358
|
-
if (normalizedMaxDateTime && combined > normalizedMaxDateTime)
|
|
5359
|
-
return undefined;
|
|
5360
|
-
return combined;
|
|
6056
|
+
const [hours, minutes] = (time ?? "00:00").split(':').map(Number);
|
|
6057
|
+
let m;
|
|
6058
|
+
if (timezoneOffset !== undefined) {
|
|
6059
|
+
// Interpretamos los valores como pertenecientes al offset especificado
|
|
6060
|
+
m = moment$1.utc([date.getFullYear(), date.getMonth(), date.getDate(), hours, minutes]);
|
|
6061
|
+
m.utcOffset(timezoneOffset * 60, true);
|
|
5361
6062
|
}
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
combined.
|
|
6063
|
+
else {
|
|
6064
|
+
m = moment$1(date).hours(hours).minutes(minutes).seconds(0).milliseconds(0);
|
|
6065
|
+
}
|
|
6066
|
+
const combined = m.toDate();
|
|
5366
6067
|
// Validate against min/max datetime
|
|
5367
6068
|
if (normalizedMinDateTime && combined < normalizedMinDateTime)
|
|
5368
6069
|
return undefined;
|
|
5369
6070
|
if (normalizedMaxDateTime && combined > normalizedMaxDateTime)
|
|
5370
6071
|
return undefined;
|
|
5371
6072
|
return combined;
|
|
5372
|
-
}, [normalizedMinDateTime, normalizedMaxDateTime]);
|
|
6073
|
+
}, [normalizedMinDateTime, normalizedMaxDateTime, timezoneOffset]);
|
|
5373
6074
|
/**
|
|
5374
6075
|
* Calculate dynamic time restrictions based on selected date
|
|
5375
6076
|
*
|
|
@@ -5383,33 +6084,38 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
5383
6084
|
const calculateTimeRestrictions = React.useCallback((selectedDate) => {
|
|
5384
6085
|
if (!selectedDate)
|
|
5385
6086
|
return { minTime, maxTime };
|
|
5386
|
-
//
|
|
5387
|
-
|
|
6087
|
+
// selectedDate is already a "display date" (shifted for timezone),
|
|
6088
|
+
// so we compare using local date fields via moment (no utcOffset needed here)
|
|
6089
|
+
const mSelected = moment$1(selectedDate);
|
|
5388
6090
|
let calculatedMinTime = minTime;
|
|
5389
6091
|
let calculatedMaxTime = maxTime;
|
|
5390
6092
|
// If selected date matches minDateTime date, restrict minimum time
|
|
5391
6093
|
if (normalizedMinDateTime) {
|
|
5392
|
-
const
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
calculatedMinTime =
|
|
6094
|
+
const mMin = timezoneOffset !== undefined
|
|
6095
|
+
? moment$1(getDateInOffset(normalizedMinDateTime, timezoneOffset))
|
|
6096
|
+
: moment$1(normalizedMinDateTime);
|
|
6097
|
+
if (mSelected.isSame(mMin, 'day')) {
|
|
6098
|
+
calculatedMinTime = timezoneOffset !== undefined
|
|
6099
|
+
? getTimeInOffset(normalizedMinDateTime, timezoneOffset)
|
|
6100
|
+
: moment$1(normalizedMinDateTime).format("HH:mm");
|
|
5397
6101
|
}
|
|
5398
6102
|
}
|
|
5399
6103
|
// If selected date matches maxDateTime date, restrict maximum time
|
|
5400
6104
|
if (normalizedMaxDateTime) {
|
|
5401
|
-
const
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
calculatedMaxTime =
|
|
6105
|
+
const mMax = timezoneOffset !== undefined
|
|
6106
|
+
? moment$1(getDateInOffset(normalizedMaxDateTime, timezoneOffset))
|
|
6107
|
+
: moment$1(normalizedMaxDateTime);
|
|
6108
|
+
if (mSelected.isSame(mMax, 'day')) {
|
|
6109
|
+
calculatedMaxTime = timezoneOffset !== undefined
|
|
6110
|
+
? getTimeInOffset(normalizedMaxDateTime, timezoneOffset)
|
|
6111
|
+
: moment$1(normalizedMaxDateTime).format("HH:mm");
|
|
5406
6112
|
}
|
|
5407
6113
|
}
|
|
5408
6114
|
return {
|
|
5409
6115
|
minTime: calculatedMinTime,
|
|
5410
6116
|
maxTime: calculatedMaxTime
|
|
5411
6117
|
};
|
|
5412
|
-
}, [normalizedMinDateTime, normalizedMaxDateTime, minTime, maxTime]);
|
|
6118
|
+
}, [normalizedMinDateTime, normalizedMaxDateTime, minTime, maxTime, timezoneOffset]);
|
|
5413
6119
|
// Calculate current time restrictions based on selected date
|
|
5414
6120
|
// Recalculates whenever selectedDate or the calculation function changes
|
|
5415
6121
|
const timeRestrictions = React.useMemo(() => calculateTimeRestrictions(selectedDate), [selectedDate, calculateTimeRestrictions]);
|
|
@@ -5429,15 +6135,15 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
5429
6135
|
if (currentTime !== prevTime) {
|
|
5430
6136
|
prevValueRef.current = value;
|
|
5431
6137
|
if (value) {
|
|
5432
|
-
setSelectedDate(value);
|
|
5433
|
-
setSelectedTime(
|
|
6138
|
+
setSelectedDate(toDisplayDate(value));
|
|
6139
|
+
setSelectedTime(toDisplayTime(value));
|
|
5434
6140
|
}
|
|
5435
6141
|
else {
|
|
5436
6142
|
setSelectedDate(undefined);
|
|
5437
6143
|
setSelectedTime(undefined);
|
|
5438
6144
|
}
|
|
5439
6145
|
}
|
|
5440
|
-
}, [value]);
|
|
6146
|
+
}, [value, toDisplayDate, toDisplayTime]);
|
|
5441
6147
|
// ========================================
|
|
5442
6148
|
// EVENT HANDLERS
|
|
5443
6149
|
// ========================================
|
|
@@ -5506,16 +6212,20 @@ function CwDateTimePicker({ value, onChange, minDateTime, maxDateTime, disabledD
|
|
|
5506
6212
|
onChange(now);
|
|
5507
6213
|
}
|
|
5508
6214
|
}, [normalizedMinDateTime, normalizedMaxDateTime, onChange]);
|
|
5509
|
-
// Extract min/max date from normalized datetime for DatePicker
|
|
5510
|
-
const minDate = normalizedMinDateTime;
|
|
5511
|
-
const maxDate = normalizedMaxDateTime;
|
|
5512
6215
|
// ========================================
|
|
5513
6216
|
// RENDER
|
|
5514
6217
|
// ========================================
|
|
5515
|
-
|
|
6218
|
+
// Shift min/max dates for CwDatePicker display (it uses local timezone internally)
|
|
6219
|
+
const displayMinDate = React.useMemo(() => normalizedMinDateTime && timezoneOffset !== undefined
|
|
6220
|
+
? getDateInOffset(normalizedMinDateTime, timezoneOffset)
|
|
6221
|
+
: normalizedMinDateTime, [normalizedMinDateTime, timezoneOffset]);
|
|
6222
|
+
const displayMaxDate = React.useMemo(() => normalizedMaxDateTime && timezoneOffset !== undefined
|
|
6223
|
+
? getDateInOffset(normalizedMaxDateTime, timezoneOffset)
|
|
6224
|
+
: normalizedMaxDateTime, [normalizedMaxDateTime, timezoneOffset]);
|
|
6225
|
+
return jsxRuntime.jsx("div", { className: `cw-datetimepicker cw-datetimepicker-separate ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: "cw-flex-row cw-align-left-center cw-gap-small", children: [jsxRuntime.jsx(CwDatePicker, { value: selectedDate, onChange: handleDateChange, minDate: displayMinDate, maxDate: displayMaxDate, disabledDates: disabledDates, disabledMatcher: disabledMatcher, placeholder: datePlaceholder, disabled: disabled, required: required, showClear: showClear, numberOfMonths: numberOfMonths, popupPosition: popupPosition }), jsxRuntime.jsx(CwTimePicker, { value: selectedTime, onChange: handleTimeChange, interval: timeInterval, minTime: timeRestrictions.minTime, maxTime: timeRestrictions.maxTime, placeholder: timePlaceholder, disabled: disabled, required: required, showClear: showClear, popupPosition: popupPosition }), showNowButton && (jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", onClick: handleNowClick, disabled: disabled, title: "Set to current date and time", text: "Now" }))] })] }) });
|
|
5516
6226
|
}
|
|
5517
6227
|
|
|
5518
|
-
var compactStyles = {"compactPopup":"cw-datetime-compact-
|
|
6228
|
+
var compactStyles = {"compactPopup":"cw-datetime-compact-module__compactPopup__GiuNY","calendarWrapper":"cw-datetime-compact-module__calendarWrapper__P4Nlq","timeWrapper":"cw-datetime-compact-module__timeWrapper__uMe-A","compactTimeList":"cw-datetime-compact-module__compactTimeList__MzSQT"};
|
|
5519
6229
|
|
|
5520
6230
|
function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, disabledDates, disabledMatcher, timeInterval = 15, minTime, maxTime, labelProps, alignProps, placeholder = "dd.mm.yyyy HH:mm", disabled, required, className, showClear = true, popupPosition = "left-bottom", numberOfMonths = 1, showTodayButton = false, }) {
|
|
5521
6231
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -5523,9 +6233,17 @@ function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, di
|
|
|
5523
6233
|
const [selectedDate, setSelectedDate] = React.useState(value);
|
|
5524
6234
|
const [selectedTime, setSelectedTime] = React.useState("");
|
|
5525
6235
|
const containerRef = React.useRef(null);
|
|
6236
|
+
const wrapperRef = React.useRef(null);
|
|
5526
6237
|
const inputRef = React.useRef(null);
|
|
5527
6238
|
const timeListRef = React.useRef(null);
|
|
5528
6239
|
const prevValueRef = React.useRef(value);
|
|
6240
|
+
const handleClose = React.useCallback(() => setIsOpen(false), []);
|
|
6241
|
+
const { popupRef, popupStyle, renderPopup } = usePickerPopup({
|
|
6242
|
+
anchorRef: wrapperRef,
|
|
6243
|
+
isOpen,
|
|
6244
|
+
onClose: handleClose,
|
|
6245
|
+
position: popupPosition,
|
|
6246
|
+
});
|
|
5529
6247
|
// Generate time options based on interval - memoized
|
|
5530
6248
|
const timeOptions = React.useMemo(() => {
|
|
5531
6249
|
const options = [];
|
|
@@ -5618,20 +6336,6 @@ function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, di
|
|
|
5618
6336
|
}
|
|
5619
6337
|
}
|
|
5620
6338
|
}, [value]);
|
|
5621
|
-
// Close popup when clicking outside
|
|
5622
|
-
React.useEffect(() => {
|
|
5623
|
-
const handleClickOutside = (event) => {
|
|
5624
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
5625
|
-
setIsOpen(false);
|
|
5626
|
-
}
|
|
5627
|
-
};
|
|
5628
|
-
if (isOpen) {
|
|
5629
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
5630
|
-
}
|
|
5631
|
-
return () => {
|
|
5632
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
5633
|
-
};
|
|
5634
|
-
}, [isOpen]);
|
|
5635
6339
|
// Scroll to selected time when opening
|
|
5636
6340
|
React.useEffect(() => {
|
|
5637
6341
|
if (isOpen && selectedTime && timeListRef.current) {
|
|
@@ -5678,1233 +6382,90 @@ function CwDateTimePickerCompact({ value, onChange, minDateTime, maxDateTime, di
|
|
|
5678
6382
|
onChange(undefined);
|
|
5679
6383
|
setInputValue("");
|
|
5680
6384
|
setSelectedDate(undefined);
|
|
5681
|
-
setSelectedTime("");
|
|
5682
|
-
}, [onChange]);
|
|
5683
|
-
const handleInputClick = React.useCallback(() => {
|
|
5684
|
-
if (!disabled) {
|
|
5685
|
-
setIsOpen(true);
|
|
5686
|
-
}
|
|
5687
|
-
}, [disabled]);
|
|
5688
|
-
const handleInputChange = React.useCallback((e) => {
|
|
5689
|
-
const newValue = e.target.value;
|
|
5690
|
-
setInputValue(newValue);
|
|
5691
|
-
// Try to parse the full datetime string: dd.MM.yyyy HH:mm
|
|
5692
|
-
if (newValue.length >= 16) {
|
|
5693
|
-
validateAndSetDateTime(newValue);
|
|
5694
|
-
}
|
|
5695
|
-
else if (newValue === "") {
|
|
5696
|
-
onChange(undefined);
|
|
5697
|
-
setSelectedDate(undefined);
|
|
5698
|
-
setSelectedTime("");
|
|
5699
|
-
}
|
|
5700
|
-
}, [validateAndSetDateTime, onChange]);
|
|
5701
|
-
const handleInputBlur = React.useCallback(() => {
|
|
5702
|
-
// Try to parse if there's text
|
|
5703
|
-
if (inputValue && inputValue.trim() !== "") {
|
|
5704
|
-
const parsed = parseDateTime(inputValue);
|
|
5705
|
-
if (parsed && !isNaN(parsed.getTime())) {
|
|
5706
|
-
const isValid = (!minDateTime || parsed >= minDateTime) &&
|
|
5707
|
-
(!maxDateTime || parsed <= maxDateTime);
|
|
5708
|
-
if (isValid) {
|
|
5709
|
-
onChange(parsed);
|
|
5710
|
-
const dateStr = dateFns.format(parsed, "dd.MM.yyyy", { locale: locale.enGB });
|
|
5711
|
-
const timeStr = dateFns.format(parsed, "HH:mm", { locale: locale.enGB });
|
|
5712
|
-
setInputValue(`${dateStr} ${timeStr}`);
|
|
5713
|
-
setSelectedDate(parsed);
|
|
5714
|
-
setSelectedTime(timeStr);
|
|
5715
|
-
return;
|
|
5716
|
-
}
|
|
5717
|
-
}
|
|
5718
|
-
}
|
|
5719
|
-
// Sync with current value
|
|
5720
|
-
if (value) {
|
|
5721
|
-
const dateStr = dateFns.format(value, "dd.MM.yyyy", { locale: locale.enGB });
|
|
5722
|
-
const timeStr = dateFns.format(value, "HH:mm", { locale: locale.enGB });
|
|
5723
|
-
setInputValue(`${dateStr} ${timeStr}`);
|
|
5724
|
-
}
|
|
5725
|
-
else {
|
|
5726
|
-
setInputValue("");
|
|
5727
|
-
}
|
|
5728
|
-
}, [inputValue, parseDateTime, minDateTime, maxDateTime, onChange, value]);
|
|
5729
|
-
const handleInputKeyDown = React.useCallback((e) => {
|
|
5730
|
-
if (e.key === "Enter") {
|
|
5731
|
-
e.preventDefault();
|
|
5732
|
-
inputRef.current?.blur();
|
|
5733
|
-
setIsOpen(false);
|
|
5734
|
-
}
|
|
5735
|
-
else if (e.key === "Escape") {
|
|
5736
|
-
setIsOpen(false);
|
|
5737
|
-
inputRef.current?.blur();
|
|
5738
|
-
}
|
|
5739
|
-
}, []);
|
|
5740
|
-
const handleNowClick = React.useCallback(() => {
|
|
5741
|
-
const now = new Date();
|
|
5742
|
-
// Check if now is within allowed range
|
|
5743
|
-
const isNowValid = (!minDateTime || now >= minDateTime) &&
|
|
5744
|
-
(!maxDateTime || now <= maxDateTime);
|
|
5745
|
-
if (isNowValid) {
|
|
5746
|
-
onChange(now);
|
|
5747
|
-
setIsOpen(false);
|
|
5748
|
-
}
|
|
5749
|
-
}, [minDateTime, maxDateTime, onChange]);
|
|
5750
|
-
// Memoize disabled days
|
|
5751
|
-
const disabledDays = React.useMemo(() => [
|
|
5752
|
-
...(disabledDates || []),
|
|
5753
|
-
...(minDateTime ? [{ before: minDateTime }] : []),
|
|
5754
|
-
...(maxDateTime ? [{ after: maxDateTime }] : []),
|
|
5755
|
-
...(disabledMatcher ? [disabledMatcher] : []),
|
|
5756
|
-
], [disabledDates, minDateTime, maxDateTime, disabledMatcher]);
|
|
5757
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 16, style: { width: "24ch" } }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar-time" })) }), isOpen && (jsxRuntime.jsxs("div", { className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, "data-position": popupPosition, children: [jsxRuntime.jsxs("div", { className: compactStyles.calendarWrapper, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, modifiers: {
|
|
5758
|
-
today: new Date(),
|
|
5759
|
-
}, modifiersClassNames: {
|
|
5760
|
-
today: "rdp-day-today",
|
|
5761
|
-
} }), showTodayButton && (jsxRuntime.jsx("footer", { className: "cw-flex-row cw-align-center-center", children: jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", icon: "check-big", onClick: handleNowClick, text: "Now" }) }))] }), jsxRuntime.jsxs("div", { className: compactStyles.timeWrapper, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwIcon, { iconId: "clock", size: "medium" }), jsxRuntime.jsx("span", { children: "Time" })] }), jsxRuntime.jsx("div", { ref: timeListRef, className: `${timeStyles.timePickerList} ${compactStyles.compactTimeList}`, children: timeOptions.map((time) => {
|
|
5762
|
-
const isSelected = time === selectedTime;
|
|
5763
|
-
return (jsxRuntime.jsx("button", { type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
5764
|
-
}) })] })] }))] })] }) }));
|
|
5765
|
-
}
|
|
5766
|
-
|
|
5767
|
-
const ResourcesTitleList$1 = ({ resources, canBePinned, includesPinned, onCrewPinning, onClickResourceContextMenu, ResourceTitleComponent }) => {
|
|
5768
|
-
return (jsxRuntime.jsx("td", { className: "resourceArea", style: { width: "100px" }, children: resources.map((r, _i) => (jsxRuntime.jsxs("div", { className: "resource CwelltFunctionDescription", style: { height: r.maxTop }, children: [(canBePinned || includesPinned) && (jsxRuntime.jsx(PinButton$1, { canBePinned: canBePinned, resource: r, onCrewPinning: onCrewPinning })), jsxRuntime.jsx(ResourceTitleComponent, { resource: r, handleOnClickResourceContextMenu: (e) => {
|
|
5769
|
-
if (onClickResourceContextMenu) {
|
|
5770
|
-
onClickResourceContextMenu(e, r);
|
|
5771
|
-
}
|
|
5772
|
-
} })] }, r.id.toString()))) }));
|
|
5773
|
-
};
|
|
5774
|
-
const PinButton$1 = ({ canBePinned, resource, onCrewPinning }) => {
|
|
5775
|
-
const buttonProps = canBePinned
|
|
5776
|
-
? {
|
|
5777
|
-
id: "cbl_pinL",
|
|
5778
|
-
onClick: () => onCrewPinning(resource, ""),
|
|
5779
|
-
children: jsxRuntime.jsx("span", { className: "cbl_pin", style: { visibility: "visible" } })
|
|
5780
|
-
}
|
|
5781
|
-
: {
|
|
5782
|
-
id: "cbl_pinLess45deg",
|
|
5783
|
-
onClick: () => onCrewPinning(resource, "remove"),
|
|
5784
|
-
children: jsxRuntime.jsx("span", { className: "cbl_pinLess45deg cbl_pin", style: { color: "black", visibility: "visible" } })
|
|
5785
|
-
};
|
|
5786
|
-
return jsxRuntime.jsx("button", { className: "cw-button-icon cw-icon-pin", ...buttonProps });
|
|
5787
|
-
};
|
|
5788
|
-
|
|
5789
|
-
const doubleClickOnResource$1 = (props, resource) => {
|
|
5790
|
-
if (props.scheduler_handleDblClickOnResourceInScheduler) {
|
|
5791
|
-
props.scheduler_handleDblClickOnResourceInScheduler(resource);
|
|
5792
|
-
}
|
|
5793
|
-
};
|
|
5794
|
-
|
|
5795
|
-
let CblDragAndDrop$2 = class CblDragAndDrop {
|
|
5796
|
-
fromId;
|
|
5797
|
-
toId;
|
|
5798
|
-
data;
|
|
5799
|
-
droppedOnDate;
|
|
5800
|
-
resizeFromStart;
|
|
5801
|
-
resizeFromEnd;
|
|
5802
|
-
isCtrlKey;
|
|
5803
|
-
constructor(fromId, toId, data, droppedOnDate = null, resizeFromStart = null, resizeFromEnd = null, isCtrlKey = null) {
|
|
5804
|
-
this.fromId = fromId;
|
|
5805
|
-
this.toId = toId;
|
|
5806
|
-
this.data = data;
|
|
5807
|
-
this.droppedOnDate = droppedOnDate;
|
|
5808
|
-
this.resizeFromStart = resizeFromStart;
|
|
5809
|
-
this.resizeFromEnd = resizeFromEnd;
|
|
5810
|
-
this.isCtrlKey = isCtrlKey;
|
|
5811
|
-
}
|
|
5812
|
-
};
|
|
5813
|
-
|
|
5814
|
-
const BIRTHDATE$1 = 15;
|
|
5815
|
-
const NOT_WORKING$1 = 16;
|
|
5816
|
-
const REST_TIME$1 = 10;
|
|
5817
|
-
const MAX_FLIGHT_DUTY_PERIOD$1 = 11;
|
|
5818
|
-
const DUTY_REGULATION$1 = 20;
|
|
5819
|
-
const unHandleableEvents$1 = [REST_TIME$1, MAX_FLIGHT_DUTY_PERIOD$1, NOT_WORKING$1, DUTY_REGULATION$1];
|
|
5820
|
-
const getEventStyle$1 = (event, reslTime) => {
|
|
5821
|
-
const baseStyle = {
|
|
5822
|
-
left: event.leftPx,
|
|
5823
|
-
width: event.width,
|
|
5824
|
-
top: event.top,
|
|
5825
|
-
overflow: "hidden",
|
|
5826
|
-
zIndex: event.isFullHeight ? 4 : 5,
|
|
5827
|
-
};
|
|
5828
|
-
if (event.data.eventType === BIRTHDATE$1) {
|
|
5829
|
-
return {
|
|
5830
|
-
...baseStyle,
|
|
5831
|
-
height: event.isFullHeight ? "100%" : "auto",
|
|
5832
|
-
marginTop: event.isFullHeight ? -1 * event.top : 0,
|
|
5833
|
-
pointerEvents: "none",
|
|
5834
|
-
borderBottom: "solid 1px rgba(0, 0, 0, 0.4)",
|
|
5835
|
-
backgroundColor: event.data.category.color || "orange",
|
|
5836
|
-
display: "flex",
|
|
5837
|
-
opacity: 0.3,
|
|
5838
|
-
alignItems: "flex-end",
|
|
5839
|
-
};
|
|
5840
|
-
}
|
|
5841
|
-
if ([REST_TIME$1, MAX_FLIGHT_DUTY_PERIOD$1, DUTY_REGULATION$1].includes(event.data.eventType)) {
|
|
5842
|
-
return {
|
|
5843
|
-
...baseStyle,
|
|
5844
|
-
zIndex: event.isFullHeight ? 4 : 6,
|
|
5845
|
-
marginTop: event.isFullHeight ? -1 * event.top : 0,
|
|
5846
|
-
borderRadius: "0px",
|
|
5847
|
-
backgroundColor: event.data.category.color || "grey",
|
|
5848
|
-
opacity: 0.3,
|
|
5849
|
-
borderBottom: event.data.eventType === DUTY_REGULATION$1 ? "solid 1px rgba(0, 0, 0, 0.4)" : "",
|
|
5850
|
-
};
|
|
5851
|
-
}
|
|
5852
|
-
return {
|
|
5853
|
-
...baseStyle,
|
|
5854
|
-
height: event.isFullHeight ? "100%" : "auto",
|
|
5855
|
-
marginTop: event.isFullHeight ? -1 * event.top : 0,
|
|
5856
|
-
borderRadius: reslTime <= 0.99 ? "3px" : "5px",
|
|
5857
|
-
minWidth: reslTime <= 1.5 ? "5px" : "",
|
|
5858
|
-
maxWidth: reslTime <= 1.5 ? "25px" : "",
|
|
5859
|
-
};
|
|
5860
|
-
};
|
|
5861
|
-
const EventRender$1 = ({ event, schedulerProps }) => {
|
|
5862
|
-
const dateStart = new Date(event.data.start);
|
|
5863
|
-
const dateEnd = new Date(event.data.end);
|
|
5864
|
-
const reslTime = (dateEnd.getTime() - dateStart.getTime()) / 3600000;
|
|
5865
|
-
const eventStyle = getEventStyle$1(event, reslTime);
|
|
5866
|
-
const onClickEvent = (e) => {
|
|
5867
|
-
if (!unHandleableEvents$1.includes(event.data.eventType)) {
|
|
5868
|
-
e.stopPropagation();
|
|
5869
|
-
const props = schedulerProps;
|
|
5870
|
-
props.scheduler_handleCblEventClick.call(props.parent, event, schedulerProps.id);
|
|
5871
|
-
}
|
|
5872
|
-
};
|
|
5873
|
-
const onRightClickEvent = (e) => {
|
|
5874
|
-
if (!unHandleableEvents$1.includes(event.data.eventType)) {
|
|
5875
|
-
e.stopPropagation();
|
|
5876
|
-
const props = schedulerProps;
|
|
5877
|
-
if (props.scheduler_handleCblEventClickRight) {
|
|
5878
|
-
props.scheduler_handleCblEventClickRight.call(props.parent, event, schedulerProps.id);
|
|
5879
|
-
}
|
|
5880
|
-
}
|
|
5881
|
-
};
|
|
5882
|
-
const safeHandleDragStart = (e, isLeft, isRight) => {
|
|
5883
|
-
if (!unHandleableEvents$1.includes(event.data.eventType)) {
|
|
5884
|
-
handleDragStart(e, isLeft, isRight);
|
|
5885
|
-
}
|
|
5886
|
-
};
|
|
5887
|
-
const handleDragStart = (e, isResizeFromStart, isResizeFromEnd) => {
|
|
5888
|
-
if (!unHandleableEvents$1.includes(event.data.eventType)) {
|
|
5889
|
-
[].forEach.call(document.querySelectorAll(".ant-tooltip"), function (el) {
|
|
5890
|
-
el.style.visibility = "hidden";
|
|
5891
|
-
});
|
|
5892
|
-
// We don't know in which case is necessary
|
|
5893
|
-
if (e.target !== e.currentTarget) {
|
|
5894
|
-
// e.preventDefault();
|
|
5895
|
-
return;
|
|
5896
|
-
}
|
|
5897
|
-
const isResize = isResizeFromStart || isResizeFromEnd;
|
|
5898
|
-
const isAllowed = !event.isReadOnly && (isResize ? event.isResizable : event.isDraggable);
|
|
5899
|
-
if (!isAllowed) {
|
|
5900
|
-
e.preventDefault();
|
|
5901
|
-
return;
|
|
5902
|
-
}
|
|
5903
|
-
const cblDragNDrop = new CblDragAndDrop$2(schedulerProps.id, null, [event], null, isResizeFromStart, isResizeFromEnd);
|
|
5904
|
-
if (!isResize) {
|
|
5905
|
-
e.dataTransfer.dropEffect = e.ctrlKey ? "copy" : "link";
|
|
5906
|
-
}
|
|
5907
|
-
e.dataTransfer.setData("data", JSON.stringify(cblDragNDrop));
|
|
5908
|
-
}
|
|
5909
|
-
};
|
|
5910
|
-
const handleDoubleClick = (e) => {
|
|
5911
|
-
if (!unHandleableEvents$1.includes(event.data.eventType)) {
|
|
5912
|
-
e.preventDefault();
|
|
5913
|
-
e.stopPropagation();
|
|
5914
|
-
const props = schedulerProps;
|
|
5915
|
-
props.scheduler_handleCblEventDoubleClick.call(props.parent, event, schedulerProps.id);
|
|
5916
|
-
}
|
|
5917
|
-
};
|
|
5918
|
-
const onClickContextMenu = (e) => {
|
|
5919
|
-
if (!unHandleableEvents$1.includes(event.data.eventType)) {
|
|
5920
|
-
const props = schedulerProps;
|
|
5921
|
-
if (props.scheduler_handleOnClickEventContextMenu) {
|
|
5922
|
-
props.scheduler_handleOnClickEventContextMenu(e, event);
|
|
5923
|
-
}
|
|
5924
|
-
}
|
|
5925
|
-
};
|
|
5926
|
-
const renderBirthdayEvent = () => (jsxRuntime.jsxs("div", { className: `fc-timeline-event cwellt_timeline_event cwellt_event_bday ${event.selected ? "cblEventSelected" : ""}`, style: eventStyle, children: [jsxRuntime.jsx("span", { className: "cwi-icons cwi-birthday", style: { visibility: "visible" } }), event.data.subject && jsxRuntime.jsx("span", { style: { lineHeight: "1em" }, children: event.data.subject })] }, event.id));
|
|
5927
|
-
const renderRegularEvent = () => (jsxRuntime.jsxs("div", { draggable: ![10, 11, 16, 20, 21].includes(event.data.eventType), className: "fc-timeline-event cwellt_timeline_event cwellt_timeline_event_opstool " +
|
|
5928
|
-
(event.selected === true ? "cblEventSelected " : "") +
|
|
5929
|
-
(event.data.eventType === REST_TIME$1 ||
|
|
5930
|
-
event.data.eventType === MAX_FLIGHT_DUTY_PERIOD$1 ||
|
|
5931
|
-
event.data.eventType === DUTY_REGULATION$1
|
|
5932
|
-
? " cwellt_event_bhnd_appt "
|
|
5933
|
-
: " "), style: eventStyle, onClick: onClickEvent, onContextMenu: onRightClickEvent, onDragStart: (e) => safeHandleDragStart(e, false, false), onDoubleClick: handleDoubleClick, children: [schedulerProps.scheduler_handleCblEventResize &&
|
|
5934
|
-
!event.isReadOnly &&
|
|
5935
|
-
!unHandleableEvents$1.includes(event.data.eventType) && (jsxRuntime.jsx("span", { draggable: true, onDragStart: (e) => handleDragStart(e, true, false), style: {
|
|
5936
|
-
position: "absolute",
|
|
5937
|
-
cursor: "e-resize",
|
|
5938
|
-
zIndex: 10,
|
|
5939
|
-
left: "0",
|
|
5940
|
-
border: "solid 1px rgba(46,49,49,0.5)",
|
|
5941
|
-
}, children: "\u200B" })), jsxRuntime.jsx(schedulerProps.cblEventComp, { cblEvent: event, handleOnClickEventContextMenu: onClickContextMenu }, event.id), schedulerProps.scheduler_handleCblEventResize &&
|
|
5942
|
-
!event.isReadOnly &&
|
|
5943
|
-
!unHandleableEvents$1.includes(event.data.eventType) && (jsxRuntime.jsx("span", { draggable: true, onDragStart: (e) => handleDragStart(e, false, true), style: {
|
|
5944
|
-
position: "absolute",
|
|
5945
|
-
right: "0",
|
|
5946
|
-
cursor: "e-resize",
|
|
5947
|
-
zIndex: 10,
|
|
5948
|
-
border: "solid 1px rgba(46,49,49,0.5)",
|
|
5949
|
-
marginTop: "-25px",
|
|
5950
|
-
}, children: "\u200B" }))] }, event.id));
|
|
5951
|
-
const render = event.data.eventType === BIRTHDATE$1 ? renderBirthdayEvent() : renderRegularEvent();
|
|
5952
|
-
return render;
|
|
5953
|
-
};
|
|
5954
|
-
|
|
5955
|
-
const addMinutesToDateFromPx$1 = (originalDate, leftPx, minutesPerPx) => {
|
|
5956
|
-
const minutes = leftPx / minutesPerPx;
|
|
5957
|
-
const datePlusMinutes = new Date(originalDate.getTime() + minutes * 60000);
|
|
5958
|
-
return datePlusMinutes;
|
|
5959
|
-
};
|
|
5960
|
-
|
|
5961
|
-
const onDropEventToResource$1 = (props, cblDragNDrop, resource) => {
|
|
5962
|
-
props.scheduler_handleOnDropCblEventsOnResource.call(props.parent, cblDragNDrop, resource);
|
|
5963
|
-
};
|
|
5964
|
-
|
|
5965
|
-
const handleOnResize = (props, cblDragNDrop) => {
|
|
5966
|
-
props.scheduler_handleCblEventResize?.call(props.parent, cblDragNDrop);
|
|
5967
|
-
};
|
|
5968
|
-
|
|
5969
|
-
const isAllowedToMove$1 = (data, resData, cblDragNDrop) => {
|
|
5970
|
-
if (data?.eventType !== 1) {
|
|
5971
|
-
return true;
|
|
5972
|
-
}
|
|
5973
|
-
const allowedMoves = [
|
|
5974
|
-
{ from: "acftsScheduler", to: "flightsPairingsScheduler" },
|
|
5975
|
-
{ from: "flightsScheduler", to: "crewAssignmentsScheduler" },
|
|
5976
|
-
{ from: "opstoolScheduler", to: "opstoolScheduler" },
|
|
5977
|
-
{ from: "opstoolScheduler", to: "opstoolSchedulerVirtual" },
|
|
5978
|
-
{ from: "opstoolSchedulerVirtual", to: "opstoolScheduler" },
|
|
5979
|
-
{ from: "opstoolSchedulerVirtual", to: "opstoolSchedulerVirtual" },
|
|
5980
|
-
{ from: "vacationsScheduler", to: "vacationsScheduler" }
|
|
5981
|
-
];
|
|
5982
|
-
const crewControllAllowedMove = allowedMoves.some(move => move.from === cblDragNDrop.fromId && move.to === cblDragNDrop.toId);
|
|
5983
|
-
if (crewControllAllowedMove) {
|
|
5984
|
-
return true;
|
|
5985
|
-
}
|
|
5986
|
-
return data.Crew !== resData.Crewmember_Id;
|
|
5987
|
-
};
|
|
5988
|
-
|
|
5989
|
-
const OnDrop$1 = ({ e, resource, id, contentArea, state, schedulerProps }) => {
|
|
5990
|
-
e.dataTransfer.dropEffect = "move";
|
|
5991
|
-
const cblDragNDrop = JSON.parse(e.dataTransfer.getData("data"));
|
|
5992
|
-
if (!cblDragNDrop.data || !cblDragNDrop.data[0]) {
|
|
5993
|
-
return;
|
|
5994
|
-
}
|
|
5995
|
-
cblDragNDrop.toId = id;
|
|
5996
|
-
const obj = cblDragNDrop.data[0];
|
|
5997
|
-
cblDragNDrop.isCtrlKey = e.ctrlKey;
|
|
5998
|
-
const isResizeEvent = cblDragNDrop.resizeFromStart === true || cblDragNDrop.resizeFromEnd === true;
|
|
5999
|
-
if (isResizeEvent) {
|
|
6000
|
-
// Resize
|
|
6001
|
-
if (obj.data === undefined || obj.data.eventType === 1) {
|
|
6002
|
-
return;
|
|
6003
|
-
}
|
|
6004
|
-
const _eventX = e.clientX;
|
|
6005
|
-
const _caLeft = contentArea?.getBoundingClientRect()?.left ?? 0;
|
|
6006
|
-
const leftPos = _eventX - _caLeft;
|
|
6007
|
-
const datetime = addMinutesToDateFromPx$1(state.startDate, leftPos, state.minutePx);
|
|
6008
|
-
cblDragNDrop.droppedOnDate = datetime;
|
|
6009
|
-
handleOnResize(schedulerProps, cblDragNDrop);
|
|
6010
|
-
return;
|
|
6011
|
-
}
|
|
6012
|
-
// Drag & Drop
|
|
6013
|
-
if (!isAllowedToMove$1(obj.data, resource.data, cblDragNDrop)) {
|
|
6014
|
-
return;
|
|
6015
|
-
}
|
|
6016
|
-
const d = e.clientX - (contentArea?.getBoundingClientRect()?.left ?? 0);
|
|
6017
|
-
const date = new Date(state.startDate.getTime() + (d / state.minutePx) * 60000);
|
|
6018
|
-
cblDragNDrop.droppedOnDate = date;
|
|
6019
|
-
onDropEventToResource$1(schedulerProps, cblDragNDrop, resource);
|
|
6020
|
-
};
|
|
6021
|
-
|
|
6022
|
-
const onDragOver$1 = (e) => {
|
|
6023
|
-
if (e.ctrlKey === true) {
|
|
6024
|
-
e.dataTransfer.dropEffect = "copy";
|
|
6025
|
-
}
|
|
6026
|
-
else {
|
|
6027
|
-
e.dataTransfer.dropEffect = "link";
|
|
6028
|
-
}
|
|
6029
|
-
e.preventDefault();
|
|
6030
|
-
};
|
|
6031
|
-
|
|
6032
|
-
const arePropsEqual$1 = (prevProps, nextProps) => {
|
|
6033
|
-
return prevProps.res.events === nextProps.res.events && prevProps.isInViewport === nextProps.isInViewport;
|
|
6034
|
-
};
|
|
6035
|
-
const ResourceRender$1 = React.memo(({ res, schedulerProps, contentArea, state }) => {
|
|
6036
|
-
return (jsxRuntime.jsx("div", { style: {
|
|
6037
|
-
backgroundColor: "#F9F8F8",
|
|
6038
|
-
height: res.maxTop,
|
|
6039
|
-
width: "100%",
|
|
6040
|
-
position: "relative",
|
|
6041
|
-
borderBottom: "1px solid rgb(255,255,255)",
|
|
6042
|
-
}, onDragOver: (e) => onDragOver$1(e), onDrop: (e) => {
|
|
6043
|
-
OnDrop$1({
|
|
6044
|
-
e,
|
|
6045
|
-
resource: res,
|
|
6046
|
-
id: schedulerProps.id,
|
|
6047
|
-
contentArea,
|
|
6048
|
-
state,
|
|
6049
|
-
schedulerProps,
|
|
6050
|
-
});
|
|
6051
|
-
}, className: "cwellt_divRow_schContent", children: res.events.map((evnt) => (jsxRuntime.jsx(EventRender$1, { event: evnt, schedulerProps: schedulerProps }, evnt.id))) }, res.id));
|
|
6052
|
-
}, arePropsEqual$1);
|
|
6053
|
-
|
|
6054
|
-
const ResourceListRender$1 = ({ resources, schedulerProps, state, contentArea, onClickContextMenu, crewAssignmentSchedulerContextMenu, }) => {
|
|
6055
|
-
return (jsxRuntime.jsx(React.Fragment, { children: resources.map((r, _i) => (jsxRuntime.jsx(antd.Dropdown, { placement: "topLeft", dropdownRender: () => {
|
|
6056
|
-
return (jsxRuntime.jsx(antd.Menu, { style: { pointerEvents: "auto" }, onClick: (e) => {
|
|
6057
|
-
onClickContextMenu(e, r);
|
|
6058
|
-
}, children: crewAssignmentSchedulerContextMenu?.map((m) => (jsxRuntime.jsxs(antd.Menu.Item, { children: [jsxRuntime.jsx("span", { className: m.icon, style: { color: m.color } }), jsxRuntime.jsx("span", { className: "cwellt_contextMenu", children: m.text })] }, m.key))) }));
|
|
6059
|
-
}, trigger: ["contextMenu"], children: jsxRuntime.jsx("span", { onDoubleClick: () => doubleClickOnResource$1(schedulerProps, r), id: schedulerProps.id + "_" + r.id, children: jsxRuntime.jsx(ResourceRender$1, { res: r, schedulerProps: schedulerProps, contentArea: contentArea, state: state, isInViewport: r.isInViewport }, r.id) }) }, r.id))) }));
|
|
6060
|
-
};
|
|
6061
|
-
|
|
6062
|
-
const TimeLine$2 = ({ id, toolTipTitle, marginLeft, color = "rgba(255,0,0,.6)", pixels = 2, height = "100%", zIndex = 1, }) => {
|
|
6063
|
-
return (jsxRuntime.jsx(antd.Tooltip, { title: toolTipTitle, children: jsxRuntime.jsx("div", { id: id, style: {
|
|
6064
|
-
borderLeft: `${pixels}px solid ${color}`,
|
|
6065
|
-
marginLeft: marginLeft,
|
|
6066
|
-
width: "0px",
|
|
6067
|
-
height: height,
|
|
6068
|
-
position: "absolute",
|
|
6069
|
-
zIndex: zIndex,
|
|
6070
|
-
} }) }));
|
|
6071
|
-
};
|
|
6072
|
-
|
|
6073
|
-
const SchedulerContentArea$1 = ({ now, showTimeline, timeLineLeftPx, timeSeparatorLeftPx, resources, scheduler, contextMenuContents, onEmptyClick, setContentArea, onClickContextMenu, }) => {
|
|
6074
|
-
return (jsxRuntime.jsxs("td", { className: "contentArea", style: { width: "100%", overflow: "hidden", position: "relative" }, ref: (reference) => {
|
|
6075
|
-
if (reference) {
|
|
6076
|
-
setContentArea(reference);
|
|
6077
|
-
}
|
|
6078
|
-
}, children: [showTimeline && (jsxRuntime.jsx(TimeLine$2, { id: scheduler.props.id + "_timeline", marginLeft: timeLineLeftPx, zIndex: 8, toolTipTitle: moment(now).format("HH:mm") })), timeSeparatorLeftPx.map((pixels) => {
|
|
6079
|
-
return jsxRuntime.jsx(TimeLine$2, { marginLeft: pixels, color: "rgba(255,255,255,0.7)" });
|
|
6080
|
-
}), jsxRuntime.jsx("span", { onClick: () => {
|
|
6081
|
-
if (onEmptyClick) {
|
|
6082
|
-
onEmptyClick(scheduler.props.id);
|
|
6083
|
-
}
|
|
6084
|
-
}, children: jsxRuntime.jsx(ResourceListRender$1, { resources: resources, state: scheduler.state, schedulerProps: scheduler.props, contentArea: scheduler.contentArea, onClickContextMenu: onClickContextMenu, crewAssignmentSchedulerContextMenu: contextMenuContents }) })] }));
|
|
6085
|
-
};
|
|
6086
|
-
|
|
6087
|
-
const daysBetweenTwoDates$1 = (date1, date2) => {
|
|
6088
|
-
const diff = Math.abs(date1.getTime() - date2.getTime());
|
|
6089
|
-
let diffDays = 0;
|
|
6090
|
-
const startOffset = Math.abs(date1.getTimezoneOffset());
|
|
6091
|
-
const endOffset = Math.abs(date2.getTimezoneOffset());
|
|
6092
|
-
// Summer: +1 -> +2, true
|
|
6093
|
-
// Winter: +2 -> -1, false
|
|
6094
|
-
if (startOffset > endOffset) {
|
|
6095
|
-
diffDays = Math.floor(diff / (1000 * 3600 * 24));
|
|
6096
|
-
}
|
|
6097
|
-
else {
|
|
6098
|
-
diffDays = Math.ceil(diff / (1000 * 3600 * 24));
|
|
6099
|
-
}
|
|
6100
|
-
return diffDays;
|
|
6101
|
-
};
|
|
6102
|
-
|
|
6103
|
-
const calculateDivisionType$1 = (start, end) => {
|
|
6104
|
-
const diffDays = daysBetweenTwoDates$1(start, end);
|
|
6105
|
-
if (diffDays <= 15) {
|
|
6106
|
-
return "d";
|
|
6107
|
-
}
|
|
6108
|
-
else if (diffDays <= 30) {
|
|
6109
|
-
return "w";
|
|
6110
|
-
}
|
|
6111
|
-
else {
|
|
6112
|
-
return "m";
|
|
6113
|
-
}
|
|
6114
|
-
};
|
|
6115
|
-
|
|
6116
|
-
const getMonthHeaderData$1 = (dates, maxWidth) => {
|
|
6117
|
-
if (dates.length === 0)
|
|
6118
|
-
return [];
|
|
6119
|
-
const dayWidth = maxWidth / dates.length;
|
|
6120
|
-
const ranges = getMonthRanges$1(dates);
|
|
6121
|
-
return ranges.map((range) => {
|
|
6122
|
-
return {
|
|
6123
|
-
monthFormatted: range.start.getMonth() + 1 + "." + range.start.getFullYear(),
|
|
6124
|
-
width: dayWidth * range.daysLong,
|
|
6125
|
-
};
|
|
6126
|
-
});
|
|
6127
|
-
};
|
|
6128
|
-
const getMonthRanges$1 = (dates) => {
|
|
6129
|
-
const firstDay = dates[0];
|
|
6130
|
-
const lastDay = dates[dates.length - 1];
|
|
6131
|
-
let currentDate = new Date(firstDay);
|
|
6132
|
-
const ranges = [];
|
|
6133
|
-
while (currentDate <= lastDay) {
|
|
6134
|
-
const rangeStart = new Date(currentDate);
|
|
6135
|
-
let rangeEnd = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
6136
|
-
if (rangeEnd >= lastDay) {
|
|
6137
|
-
rangeEnd = lastDay;
|
|
6138
|
-
}
|
|
6139
|
-
ranges.push({
|
|
6140
|
-
start: rangeStart,
|
|
6141
|
-
daysLong: getDaysBetweenDates$1(rangeStart, rangeEnd),
|
|
6142
|
-
});
|
|
6143
|
-
currentDate = new Date(rangeEnd.getFullYear(), rangeEnd.getMonth() + 1, 1);
|
|
6144
|
-
}
|
|
6145
|
-
return ranges;
|
|
6146
|
-
};
|
|
6147
|
-
const getDaysBetweenDates$1 = (startDate, endDate) => {
|
|
6148
|
-
const timeDifference = endDate.getTime() - startDate.getTime();
|
|
6149
|
-
return Math.floor(timeDifference / (1000 * 60 * 60 * 24)) + 1;
|
|
6150
|
-
};
|
|
6151
|
-
|
|
6152
|
-
const getWeekHeaderDataFromWeekRange$1 = (weekRange, maxWidth, dateFormatter) => weekRange.map(week => {
|
|
6153
|
-
const numberOfDaysInScheduler = weekRange
|
|
6154
|
-
.flatMap(element => {
|
|
6155
|
-
return element.days;
|
|
6156
|
-
})
|
|
6157
|
-
.reduce((el1, el2) => {
|
|
6158
|
-
return el1 + el2;
|
|
6159
|
-
});
|
|
6160
|
-
return {
|
|
6161
|
-
formattedString: getStringForWeekRange$1(week, dateFormatter),
|
|
6162
|
-
width: getWidthForWeekRange$1(maxWidth, week.days, numberOfDaysInScheduler)
|
|
6163
|
-
};
|
|
6164
|
-
});
|
|
6165
|
-
const getStringForWeekRange$1 = (weekRange, dateFormatter) => weekRange.days == 1
|
|
6166
|
-
? dateFormatter(weekRange.start)
|
|
6167
|
-
: `${dateFormatter(weekRange.start)} - ${dateFormatter(weekRange.end)}`;
|
|
6168
|
-
const getWidthForWeekRange$1 = (maxWidth, weekDays, monthDays) => {
|
|
6169
|
-
const dayWidth = maxWidth / monthDays;
|
|
6170
|
-
return dayWidth * weekDays;
|
|
6171
|
-
};
|
|
6172
|
-
|
|
6173
|
-
// stringRange: `${formatter(date)} - ${formatter(end)}`,
|
|
6174
|
-
const listOfDatesToWeekRangeList$1 = (dates) => {
|
|
6175
|
-
if (dates.length === 0) {
|
|
6176
|
-
return [];
|
|
6177
|
-
}
|
|
6178
|
-
const datesToReturn = [];
|
|
6179
|
-
dates.forEach((date, index) => {
|
|
6180
|
-
const dayOfWeek = date.getDay();
|
|
6181
|
-
const isFirstDay = index === 0;
|
|
6182
|
-
const isLastDay = index === dates.length - 1;
|
|
6183
|
-
const isSunday = dayOfWeek === 0;
|
|
6184
|
-
const isMonday = dayOfWeek === 1;
|
|
6185
|
-
if (isFirstDay && !isSunday) {
|
|
6186
|
-
datesToReturn.push(createWeekRange$1(date, 8 - dayOfWeek));
|
|
6187
|
-
return;
|
|
6188
|
-
}
|
|
6189
|
-
if (isLastDay && !isSunday) {
|
|
6190
|
-
if (!isMonday) {
|
|
6191
|
-
datesToReturn.pop();
|
|
6192
|
-
}
|
|
6193
|
-
const firstOfWeek = getFirstDayOfWeek$1(date);
|
|
6194
|
-
datesToReturn.push(createWeekRange$1(firstOfWeek, dayOfWeek));
|
|
6195
|
-
return;
|
|
6196
|
-
}
|
|
6197
|
-
if (isMonday) {
|
|
6198
|
-
datesToReturn.push(createWeekRange$1(date, 7));
|
|
6199
|
-
return;
|
|
6200
|
-
}
|
|
6201
|
-
// this is because sunday is 0
|
|
6202
|
-
if (isFirstDay && isSunday) {
|
|
6203
|
-
datesToReturn.push(createWeekRange$1(date, 1));
|
|
6204
|
-
return;
|
|
6205
|
-
}
|
|
6206
|
-
});
|
|
6207
|
-
return datesToReturn;
|
|
6208
|
-
};
|
|
6209
|
-
const createWeekRange$1 = (start, days) => {
|
|
6210
|
-
const end = new Date(start);
|
|
6211
|
-
end.setDate(end.getDate() + days - 1);
|
|
6212
|
-
return {
|
|
6213
|
-
days,
|
|
6214
|
-
start,
|
|
6215
|
-
end,
|
|
6216
|
-
isShortWeek: days < 7
|
|
6217
|
-
};
|
|
6218
|
-
};
|
|
6219
|
-
const getFirstDayOfWeek$1 = (date) => {
|
|
6220
|
-
const currentDate = new Date(date);
|
|
6221
|
-
const dayOfWeek = currentDate.getDay();
|
|
6222
|
-
// dayOfWeek 0 == (Sunday)
|
|
6223
|
-
const diffToMonday = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
|
|
6224
|
-
// Set the date to the first day of the week
|
|
6225
|
-
currentDate.setDate(currentDate.getDate() - diffToMonday);
|
|
6226
|
-
return currentDate;
|
|
6227
|
-
};
|
|
6228
|
-
|
|
6229
|
-
const DayHeader$1 = ({ index, text, width, headerType }) => {
|
|
6230
|
-
const isFirstDay = index == 0;
|
|
6231
|
-
return (jsxRuntime.jsx("td", { style: {
|
|
6232
|
-
display: "inline-block",
|
|
6233
|
-
fontSize: "10px",
|
|
6234
|
-
width: width,
|
|
6235
|
-
maxWidth: width,
|
|
6236
|
-
}, id: headerType + index, children: jsxRuntime.jsx("span", { className: isFirstDay ? "cwelltFirstDate_desc" : "", children: text }) }));
|
|
6237
|
-
};
|
|
6238
|
-
|
|
6239
|
-
const MonthHeader$1 = ({ index, text, width, headerType }) => {
|
|
6240
|
-
return (jsxRuntime.jsx("td", { style: {
|
|
6241
|
-
display: "inline-block",
|
|
6242
|
-
fontSize: "10px",
|
|
6243
|
-
width: width,
|
|
6244
|
-
maxWidth: width,
|
|
6245
|
-
}, id: headerType + index, children: jsxRuntime.jsx("span", { children: text }) }));
|
|
6246
|
-
};
|
|
6247
|
-
|
|
6248
|
-
const WeekHeader$1 = ({ index, text, width, headerType }) => {
|
|
6249
|
-
const isFirstDay = index == 0;
|
|
6250
|
-
return (jsxRuntime.jsx("td", { style: {
|
|
6251
|
-
display: "inline-block",
|
|
6252
|
-
fontSize: "10px",
|
|
6253
|
-
width: width,
|
|
6254
|
-
maxWidth: width,
|
|
6255
|
-
}, id: headerType + index, children: jsxRuntime.jsx("span", { className: isFirstDay ? "cwelltFirstDate_desc" : "", style: { whiteSpace: "nowrap" }, children: text }) }));
|
|
6256
|
-
};
|
|
6257
|
-
|
|
6258
|
-
const DaysHeader$1 = ({ days, divisionType, maxWidth, headerType }) => {
|
|
6259
|
-
let headerToDraw = [];
|
|
6260
|
-
const filteredDays = days.filter((date) => {
|
|
6261
|
-
return date.getHours() === 0;
|
|
6262
|
-
});
|
|
6263
|
-
const dateFormatter = (date) => {
|
|
6264
|
-
return `${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()}`;
|
|
6265
|
-
};
|
|
6266
|
-
switch (divisionType) {
|
|
6267
|
-
case "d":
|
|
6268
|
-
{
|
|
6269
|
-
headerToDraw = filteredDays.map((date, index) => {
|
|
6270
|
-
return (jsxRuntime.jsx(DayHeader$1, { text: dateFormatter(date), index: index, width: maxWidth / filteredDays.length, headerType: headerType }, index));
|
|
6271
|
-
});
|
|
6272
|
-
}
|
|
6273
|
-
break;
|
|
6274
|
-
case "w":
|
|
6275
|
-
{
|
|
6276
|
-
const weekRanges = listOfDatesToWeekRangeList$1(filteredDays);
|
|
6277
|
-
headerToDraw = getWeekHeaderDataFromWeekRange$1(weekRanges, maxWidth, dateFormatter).map((week, index) => {
|
|
6278
|
-
return (jsxRuntime.jsx(WeekHeader$1, { index: index, text: week.formattedString, width: week.width, headerType: headerType }, index));
|
|
6279
|
-
});
|
|
6280
|
-
}
|
|
6281
|
-
break;
|
|
6282
|
-
case "m":
|
|
6283
|
-
{
|
|
6284
|
-
const monthData = getMonthHeaderData$1(filteredDays, maxWidth);
|
|
6285
|
-
headerToDraw = monthData.map(({ monthFormatted, width }, index) => (jsxRuntime.jsx(MonthHeader$1, { index: index, text: monthFormatted, width: width, headerType: headerType }, index)));
|
|
6286
|
-
}
|
|
6287
|
-
break;
|
|
6288
|
-
}
|
|
6289
|
-
return jsxRuntime.jsx("tr", { className: "cwelltSchRowDate", children: headerToDraw });
|
|
6290
|
-
};
|
|
6291
|
-
|
|
6292
|
-
const getFormattedTimeForHeader$1 = (calculatedDivType, calculatedDivision, timeHeader) => {
|
|
6293
|
-
let showDate = "";
|
|
6294
|
-
switch (calculatedDivType) {
|
|
6295
|
-
case "d":
|
|
6296
|
-
switch (calculatedDivision) {
|
|
6297
|
-
case 8:
|
|
6298
|
-
showDate =
|
|
6299
|
-
timeHeader.getHours() === 0 ||
|
|
6300
|
-
timeHeader.getHours() === 3 ||
|
|
6301
|
-
timeHeader.getHours() === 6 ||
|
|
6302
|
-
timeHeader.getHours() === 9 ||
|
|
6303
|
-
timeHeader.getHours() === 12 ||
|
|
6304
|
-
timeHeader.getHours() === 15 ||
|
|
6305
|
-
timeHeader.getHours() === 18 ||
|
|
6306
|
-
timeHeader.getHours() === 21
|
|
6307
|
-
? moment(timeHeader).format("HH:mm")
|
|
6308
|
-
: "";
|
|
6309
|
-
break;
|
|
6310
|
-
case 3:
|
|
6311
|
-
showDate =
|
|
6312
|
-
timeHeader.getHours() === 0 || timeHeader.getHours() === 8 || timeHeader.getHours() === 16
|
|
6313
|
-
? moment(timeHeader).format("HH:mm")
|
|
6314
|
-
: "";
|
|
6315
|
-
break;
|
|
6316
|
-
case 2:
|
|
6317
|
-
showDate =
|
|
6318
|
-
timeHeader.getHours() === 0 || timeHeader.getHours() === 12 ? moment(timeHeader).format("HH:mm") : "";
|
|
6319
|
-
break;
|
|
6320
|
-
}
|
|
6321
|
-
break;
|
|
6322
|
-
case "m":
|
|
6323
|
-
showDate = timeHeader.getHours() === 0 ? timeHeader.getDate().toString() : "";
|
|
6324
|
-
break;
|
|
6325
|
-
case "w":
|
|
6326
|
-
showDate = timeHeader.getHours() === 0 ? timeHeader.getDate().toString() : "";
|
|
6327
|
-
break;
|
|
6328
|
-
}
|
|
6329
|
-
return {
|
|
6330
|
-
text: showDate,
|
|
6331
|
-
isWeekend: timeHeader.getDay() === 6 || timeHeader.getDay() === 0,
|
|
6332
|
-
};
|
|
6333
|
-
};
|
|
6334
|
-
|
|
6335
|
-
const calculateDivisions$1 = (start, end) => {
|
|
6336
|
-
const diffDays = daysBetweenTwoDates$1(start, end);
|
|
6337
|
-
if (diffDays <= 3) {
|
|
6338
|
-
return 8;
|
|
6339
|
-
}
|
|
6340
|
-
else if (diffDays < 8) {
|
|
6341
|
-
return 3;
|
|
6342
|
-
}
|
|
6343
|
-
else if (diffDays <= 15) {
|
|
6344
|
-
return 2;
|
|
6345
|
-
}
|
|
6346
|
-
else {
|
|
6347
|
-
return 1;
|
|
6348
|
-
}
|
|
6349
|
-
};
|
|
6350
|
-
|
|
6351
|
-
const TimeHeader$1 = ({ isWeekend, index, text, width, header }) => {
|
|
6352
|
-
if (text === "") {
|
|
6353
|
-
return;
|
|
6354
|
-
}
|
|
6355
|
-
const commonStyles = {
|
|
6356
|
-
display: "flex",
|
|
6357
|
-
alignItems: "center",
|
|
6358
|
-
justifyContent: "left",
|
|
6359
|
-
fontSize: "10px",
|
|
6360
|
-
width: width,
|
|
6361
|
-
maxWidth: width,
|
|
6362
|
-
height: "2rem",
|
|
6363
|
-
borderLeft: "1px solid white",
|
|
6364
|
-
background: isWeekend ? "#cbc9c9" : "",
|
|
6365
|
-
color: "#000000d9",
|
|
6366
|
-
fontWeight: 700,
|
|
6367
|
-
};
|
|
6368
|
-
return (jsxRuntime.jsx("td", { style: commonStyles, id: `${header}Time${index}`, children: jsxRuntime.jsx("span", { style: { paddingLeft: "8px" }, children: text }) }, `t${index}`));
|
|
6369
|
-
};
|
|
6370
|
-
|
|
6371
|
-
const TimeHeaderRow$1 = ({ timeHeaders, startDate, endDate, maxWidth, header }) => {
|
|
6372
|
-
const calculatedDivision = calculateDivisions$1(startDate, endDate);
|
|
6373
|
-
const calculatedDivType = calculateDivisionType$1(startDate, endDate);
|
|
6374
|
-
const formattedHeaders = timeHeaders.map((th) => {
|
|
6375
|
-
return getFormattedTimeForHeader$1(calculatedDivType, calculatedDivision, th);
|
|
6376
|
-
});
|
|
6377
|
-
const filteredHeaders = formattedHeaders.filter((element) => element.text !== "");
|
|
6378
|
-
return (jsxRuntime.jsx("tr", { className: "cwelltSchRowTime", style: { height: "30px" }, children: filteredHeaders.map(({ text, isWeekend }, index) => {
|
|
6379
|
-
return (jsxRuntime.jsx(TimeHeader$1, { isWeekend: isWeekend, index: index, text: text, width: maxWidth / filteredHeaders.length, header: header }, index));
|
|
6380
|
-
}) }));
|
|
6381
|
-
};
|
|
6382
|
-
|
|
6383
|
-
const SchedulerTimeLine$1 = ({ maxPx, hoursList, startDate, endDate, pxPerHour, headerName, }) => {
|
|
6384
|
-
return (jsxRuntime.jsx("table", { className: "content-area cwelltSchTable", style: { width: maxPx }, children: jsxRuntime.jsxs("tbody", { style: { width: "100%", borderSpacing: 0 }, className: "content-area cwelltSchTbody", children: [jsxRuntime.jsx(DaysHeader$1, { days: hoursList, divisionType: calculateDivisionType$1(startDate, endDate), maxWidth: pxPerHour * hoursList.length, headerType: headerName ?? "schedulerDateHeader" }), jsxRuntime.jsx(TimeHeaderRow$1, { timeHeaders: hoursList, startDate: startDate, endDate: endDate, maxWidth: pxPerHour * hoursList.length, header: headerName ?? "schedulerTimeHeader" })] }) }));
|
|
6385
|
-
};
|
|
6386
|
-
|
|
6387
|
-
const SchedulerHeader$2 = ({ timelineProps, descriptionColumn }) => {
|
|
6388
|
-
const { maxPx, hoursList, startDate, endDate, pxPerHour, headerName } = timelineProps;
|
|
6389
|
-
return (jsxRuntime.jsx("thead", { className: "cwellt_fc_header_scheduler", style: { position: "sticky", zIndex: 9 }, children: jsxRuntime.jsxs("tr", { className: "cwellt_fc_header_row", children: [jsxRuntime.jsxs("td", { className: "border", style: {
|
|
6390
|
-
position: "sticky",
|
|
6391
|
-
top: 0,
|
|
6392
|
-
backgroundColor: "white",
|
|
6393
|
-
width: "100px",
|
|
6394
|
-
}, children: [jsxRuntime.jsx("div", { style: {
|
|
6395
|
-
display: "flex",
|
|
6396
|
-
height: "30px",
|
|
6397
|
-
alignItems: "center",
|
|
6398
|
-
width: "150px",
|
|
6399
|
-
}, children: jsxRuntime.jsx("label", { children: headerName }) }), jsxRuntime.jsx("div", { style: {
|
|
6400
|
-
display: "flex",
|
|
6401
|
-
height: "30px",
|
|
6402
|
-
alignItems: "center",
|
|
6403
|
-
background: "rgba(0, 0, 0, 0.04)",
|
|
6404
|
-
}, children: jsxRuntime.jsx("span", { children: descriptionColumn }) })] }), jsxRuntime.jsx("td", { style: {
|
|
6405
|
-
position: "sticky",
|
|
6406
|
-
top: 0,
|
|
6407
|
-
zIndex: 6,
|
|
6408
|
-
backgroundColor: "white",
|
|
6409
|
-
}, children: jsxRuntime.jsx(SchedulerTimeLine$1, { maxPx: maxPx, hoursList: hoursList, pxPerHour: pxPerHour, startDate: startDate, endDate: endDate, headerName: headerName }) })] }) }));
|
|
6410
|
-
};
|
|
6411
|
-
|
|
6412
|
-
const daysBetweenTwoDatesIncludingBoth$1 = (date1, date2) => {
|
|
6413
|
-
const diff = Math.abs(date1.getTime() - date2.getTime());
|
|
6414
|
-
const diffDays = diff / (1000 * 3600 * 24);
|
|
6415
|
-
return diffDays;
|
|
6416
|
-
};
|
|
6417
|
-
|
|
6418
|
-
const getUtcToday$1 = () => {
|
|
6419
|
-
const now = new Date();
|
|
6420
|
-
const userTimezoneOffset = now.getTimezoneOffset() * 60000;
|
|
6421
|
-
const nowUtc = new Date(now.getTime() + userTimezoneOffset);
|
|
6422
|
-
return nowUtc;
|
|
6423
|
-
};
|
|
6424
|
-
|
|
6425
|
-
const filterEvents$1 = (events, start, end, id, resId, module = undefined) => {
|
|
6426
|
-
const hasSameResourceId = (event) => event.resourceId === resId;
|
|
6427
|
-
const datesCollide = (event) => event.start <= end && event.end >= start;
|
|
6428
|
-
let eventsFiltered = events.filter(event => hasSameResourceId(event) && datesCollide(event));
|
|
6429
|
-
if (id !== "flightWatchScheduler") {
|
|
6430
|
-
eventsFiltered = sortByDate$1(eventsFiltered);
|
|
6431
|
-
}
|
|
6432
|
-
if (id !== "crewAssignmentsScheduler" && id !== "vacationsScheduler") {
|
|
6433
|
-
return eventsFiltered;
|
|
6434
|
-
}
|
|
6435
|
-
eventsFiltered = setNotFullHeightEventsFirst$1(eventsFiltered);
|
|
6436
|
-
if (module === "CrewControl") {
|
|
6437
|
-
eventsFiltered = removeDuplicated$1(eventsFiltered, "Crew_Id");
|
|
6438
|
-
}
|
|
6439
|
-
if (module === "CrewScheduling") {
|
|
6440
|
-
eventsFiltered = removeDuplicated$1(eventsFiltered, "AssignmentID");
|
|
6441
|
-
}
|
|
6442
|
-
if (module === "CrewSchedulingVacations") {
|
|
6443
|
-
eventsFiltered = removeDuplicated$1(eventsFiltered, "ID");
|
|
6444
|
-
}
|
|
6445
|
-
return eventsFiltered;
|
|
6446
|
-
};
|
|
6447
|
-
const sortByDate$1 = (events) => events.sort((a, b) => +new Date(a.start) - +new Date(b.start));
|
|
6448
|
-
const removeDuplicated$1 = (events, key) => {
|
|
6449
|
-
return events.filter((obj, index, self) => index === self.findIndex(o => o.data[key] === obj.data[key] && o.data.subject === obj.data.subject));
|
|
6450
|
-
};
|
|
6451
|
-
const setNotFullHeightEventsFirst$1 = (events) => {
|
|
6452
|
-
const notFullHeight = [];
|
|
6453
|
-
const isFullHeight = [];
|
|
6454
|
-
events.forEach(element => {
|
|
6455
|
-
element.isFullHeight ? notFullHeight.push(element) : isFullHeight.push(element);
|
|
6456
|
-
});
|
|
6457
|
-
return notFullHeight.concat(isFullHeight);
|
|
6458
|
-
};
|
|
6459
|
-
|
|
6460
|
-
const getLeftPixels$1 = (eventStart, scheduleStart, dayPx) => {
|
|
6461
|
-
if (scheduleStart >= eventStart)
|
|
6462
|
-
return 0;
|
|
6463
|
-
return daysBetweenTwoDatesIncludingBoth$1(scheduleStart, eventStart) * dayPx;
|
|
6464
|
-
};
|
|
6465
|
-
const getEventWithSize$1 = (event, schedulerStart, dayPx) => {
|
|
6466
|
-
const eventStartBeforeScheduleStart = event.start.getTime() < schedulerStart.getTime();
|
|
6467
|
-
const lengthOfEvent = daysBetweenTwoDatesIncludingBoth$1(event.start, event.end);
|
|
6468
|
-
const daysUntilSchedulerStart = daysBetweenTwoDatesIncludingBoth$1(event.start, schedulerStart);
|
|
6469
|
-
const daysLong = eventStartBeforeScheduleStart ? lengthOfEvent - daysUntilSchedulerStart : lengthOfEvent;
|
|
6470
|
-
// we want minimum of 8 px
|
|
6471
|
-
const eventMinSize = 8;
|
|
6472
|
-
const newEvent = {
|
|
6473
|
-
...event,
|
|
6474
|
-
leftPx: getLeftPixels$1(event.start, schedulerStart, dayPx),
|
|
6475
|
-
width: Math.max(daysLong * dayPx, eventMinSize),
|
|
6476
|
-
};
|
|
6477
|
-
return newEvent;
|
|
6478
|
-
};
|
|
6479
|
-
|
|
6480
|
-
const checkIfSlotAvailable$1 = (events, event) => {
|
|
6481
|
-
const lastElement = events.length - 1;
|
|
6482
|
-
if (events.length == 0)
|
|
6483
|
-
return true;
|
|
6484
|
-
const collide = events.some(existent => {
|
|
6485
|
-
return !(existent.end <= event.start || event.end <= existent.start);
|
|
6486
|
-
});
|
|
6487
|
-
return !collide || events[lastElement].isFullHeight;
|
|
6488
|
-
};
|
|
6489
|
-
|
|
6490
|
-
const getEventsOfResource = (res, events, state, id, module, start, end) => {
|
|
6491
|
-
let maxTop = 0;
|
|
6492
|
-
const tops = [];
|
|
6493
|
-
tops[0] = new Array();
|
|
6494
|
-
const eventsOrdered = filterEvents$1(events, start ?? state.startDate, end ?? state.endDate, id, res.id, module);
|
|
6495
|
-
eventsOrdered.forEach((event, i) => {
|
|
6496
|
-
if (i === 0 || event.isFullHeight) {
|
|
6497
|
-
event.top = 0;
|
|
6498
|
-
tops[0].push(event);
|
|
6499
|
-
}
|
|
6500
|
-
else {
|
|
6501
|
-
let found = false;
|
|
6502
|
-
for (let j = 0; j < tops.length && found === false; j++) {
|
|
6503
|
-
found = checkIfSlotAvailable$1(tops[j], event);
|
|
6504
|
-
if (found === true || event.isFullHeight) {
|
|
6505
|
-
event.top = j * state.eventHeight;
|
|
6506
|
-
tops[j].push(event);
|
|
6507
|
-
}
|
|
6508
|
-
}
|
|
6509
|
-
if (found === false && !event.isFullHeight) {
|
|
6510
|
-
maxTop++;
|
|
6511
|
-
tops[maxTop] = new Array();
|
|
6512
|
-
event.top = maxTop * state.eventHeight;
|
|
6513
|
-
tops[maxTop].push(event);
|
|
6514
|
-
}
|
|
6515
|
-
else {
|
|
6516
|
-
// This is for flightwatch
|
|
6517
|
-
if (found === true && event.data.order === 2 && maxTop < 1) {
|
|
6518
|
-
maxTop++;
|
|
6519
|
-
tops[maxTop] = new Array();
|
|
6520
|
-
event.top = maxTop * state.eventHeight;
|
|
6521
|
-
tops[maxTop].push(event);
|
|
6522
|
-
maxTop--;
|
|
6523
|
-
}
|
|
6524
|
-
}
|
|
6525
|
-
}
|
|
6526
|
-
event = getEventWithSize$1(event, start, state.dayPx);
|
|
6527
|
-
});
|
|
6528
|
-
let OrderedArray = new Array();
|
|
6529
|
-
for (let h = 0; h < tops.length; h++) {
|
|
6530
|
-
if (tops.length === 0) {
|
|
6531
|
-
res.maxTop = state.eventHeight;
|
|
6532
|
-
}
|
|
6533
|
-
else {
|
|
6534
|
-
res.maxTop = tops.length * state.eventHeight;
|
|
6535
|
-
}
|
|
6536
|
-
OrderedArray = OrderedArray.concat(tops[h]);
|
|
6537
|
-
}
|
|
6538
|
-
return OrderedArray;
|
|
6539
|
-
};
|
|
6540
|
-
const getEventsInInnerRows$1 = (res, state, start) => {
|
|
6541
|
-
let maxTop = 0;
|
|
6542
|
-
const tops = [];
|
|
6543
|
-
tops[0] = new Array();
|
|
6544
|
-
res.events.forEach((event, i) => {
|
|
6545
|
-
if (i === 0 || event.isFullHeight) {
|
|
6546
|
-
event.top = 0;
|
|
6547
|
-
tops[0].push(event);
|
|
6548
|
-
}
|
|
6549
|
-
else {
|
|
6550
|
-
let found = false;
|
|
6551
|
-
for (let j = 0; j < tops.length && found === false; j++) {
|
|
6552
|
-
found = checkIfSlotAvailable$1(tops[j], event);
|
|
6553
|
-
if (found === true || event.isFullHeight) {
|
|
6554
|
-
event.top = j * state.eventHeight;
|
|
6555
|
-
tops[j].push(event);
|
|
6556
|
-
}
|
|
6557
|
-
}
|
|
6558
|
-
if (found === false && !event.isFullHeight) {
|
|
6559
|
-
maxTop++;
|
|
6560
|
-
tops[maxTop] = new Array();
|
|
6561
|
-
event.top = maxTop * state.eventHeight;
|
|
6562
|
-
tops[maxTop].push(event);
|
|
6563
|
-
}
|
|
6564
|
-
else {
|
|
6565
|
-
// This is for flightwatch
|
|
6566
|
-
if (found === true && event.data.order === 2 && maxTop < 1) {
|
|
6567
|
-
maxTop++;
|
|
6568
|
-
tops[maxTop] = new Array();
|
|
6569
|
-
event.top = maxTop * state.eventHeight;
|
|
6570
|
-
tops[maxTop].push(event);
|
|
6571
|
-
maxTop--;
|
|
6572
|
-
}
|
|
6573
|
-
}
|
|
6574
|
-
}
|
|
6575
|
-
event = getEventWithSize$1(event, start, state.dayPx);
|
|
6576
|
-
});
|
|
6577
|
-
return tops;
|
|
6578
|
-
};
|
|
6579
|
-
|
|
6580
|
-
const compareStrings$1 = (str1, str2) => {
|
|
6581
|
-
if (str1 > str2)
|
|
6582
|
-
return 1;
|
|
6583
|
-
if (str1 < str2)
|
|
6584
|
-
return -1;
|
|
6585
|
-
return 0;
|
|
6586
|
-
};
|
|
6587
|
-
|
|
6588
|
-
const filterResources$1 = (module, resourceName, resources, groupByFunction, endDate, startDate) => {
|
|
6589
|
-
if ((module === "CrewControl" || module === "CrewScheduling" || module === "CrewSchedulingVacations") &&
|
|
6590
|
-
resourceName === "Employees") {
|
|
6591
|
-
resources = resources.filter(c => (c.data.Eintritt === null || (c.data.Eintritt !== null && moment(c.data.Eintritt).toDate() <= endDate)) &&
|
|
6592
|
-
(c.data.Austritt === null || (c.data.Austritt !== null && moment(c.data.Austritt).toDate() >= startDate)));
|
|
6593
|
-
}
|
|
6594
|
-
if (module === "CrewScheduling" && resourceName === "Employees") {
|
|
6595
|
-
const sortKey = groupByFunction ? "mainFunction" : "C3_LC";
|
|
6596
|
-
resources = resources.sort((a, b) => compareStrings$1(a.data[sortKey], b.data[sortKey]));
|
|
6597
|
-
}
|
|
6598
|
-
return resources;
|
|
6599
|
-
};
|
|
6600
|
-
|
|
6601
|
-
const filterAndProcessResources = (props, state) => {
|
|
6602
|
-
const events = [...props.events];
|
|
6603
|
-
const filteredResources = filterResources$1(props.module, props.resourceName, [...props.resources], props.groupByFunction, props.endDate, props.startDate);
|
|
6604
|
-
return filteredResources.map(r => ({
|
|
6605
|
-
...r,
|
|
6606
|
-
events: getEventsOfResource(r, events, state, props.id, props.module, props.startDate, props.endDate)
|
|
6607
|
-
}));
|
|
6608
|
-
};
|
|
6609
|
-
|
|
6610
|
-
const heightScheduler$1 = (resources, visibleRows, isPinnerScheduler) => {
|
|
6611
|
-
if (resources.length <= 0) {
|
|
6612
|
-
return 100;
|
|
6613
|
-
}
|
|
6614
|
-
const realVisibleRows = visibleRows > resources.length ? resources.length : visibleRows;
|
|
6615
|
-
const rowsHeight = resources.slice(0, realVisibleRows).map((row) => {
|
|
6616
|
-
return row.maxTop;
|
|
6617
|
-
});
|
|
6618
|
-
const height = rowsHeight.reduce((sum, row) => {
|
|
6619
|
-
return sum + row;
|
|
6620
|
-
}, 0);
|
|
6621
|
-
const headerHeight = isPinnerScheduler ? 0 : 60;
|
|
6622
|
-
return height + headerHeight;
|
|
6623
|
-
};
|
|
6624
|
-
|
|
6625
|
-
const getTimeHeaders$1 = (startDate, endDate) => {
|
|
6626
|
-
const dateArray = new Array();
|
|
6627
|
-
const currentDate = new Date(startDate);
|
|
6628
|
-
const startOffset = Math.abs(startDate.getTimezoneOffset());
|
|
6629
|
-
const endOffset = Math.abs(endDate.getTimezoneOffset());
|
|
6630
|
-
// Summer: +1 -> +2, true
|
|
6631
|
-
// Winter: +2 -> -1, false
|
|
6632
|
-
const offsetSummerWinter = startOffset < endOffset;
|
|
6633
|
-
if (offsetSummerWinter === true) {
|
|
6634
|
-
while (currentDate < endDate) {
|
|
6635
|
-
if (dateArray.length > 0) {
|
|
6636
|
-
const lastPosition = dateArray[dateArray.length - 1];
|
|
6637
|
-
const differenceHours = currentDate.getHours() - lastPosition.getHours();
|
|
6638
|
-
if (differenceHours === 1 || differenceHours < 0) {
|
|
6639
|
-
dateArray.push(new Date(currentDate));
|
|
6640
|
-
}
|
|
6641
|
-
else if (differenceHours > 1) {
|
|
6642
|
-
dateArray.push(new Date(currentDate.getHours() - 1));
|
|
6643
|
-
dateArray.push(new Date(currentDate));
|
|
6644
|
-
}
|
|
6645
|
-
}
|
|
6646
|
-
else {
|
|
6647
|
-
dateArray.push(new Date(currentDate));
|
|
6648
|
-
}
|
|
6649
|
-
currentDate.setHours(currentDate.getHours() + 1);
|
|
6650
|
-
}
|
|
6651
|
-
}
|
|
6652
|
-
else {
|
|
6653
|
-
while (currentDate < endDate) {
|
|
6654
|
-
dateArray.push(new Date(currentDate));
|
|
6655
|
-
currentDate.setHours(currentDate.getHours() + 1);
|
|
6656
|
-
}
|
|
6657
|
-
}
|
|
6658
|
-
return dateArray;
|
|
6659
|
-
};
|
|
6660
|
-
|
|
6661
|
-
class CwScheduler2 extends React.Component {
|
|
6662
|
-
contentArea;
|
|
6663
|
-
constructor(Props) {
|
|
6664
|
-
super(Props);
|
|
6665
|
-
this.init(this.props);
|
|
6666
|
-
}
|
|
6667
|
-
resizeObserver;
|
|
6668
|
-
calculateMaxPx = () => {
|
|
6669
|
-
const mainElement = document.querySelector(".cw-scheduler-main-wrapper");
|
|
6670
|
-
if (!mainElement)
|
|
6671
|
-
return window.innerWidth - 402; // sidebar + first column + padding
|
|
6672
|
-
const mainRect = mainElement.getBoundingClientRect();
|
|
6673
|
-
return Math.floor(mainRect.width - 162); // first column + padding
|
|
6674
|
-
};
|
|
6675
|
-
init = (props) => {
|
|
6676
|
-
const maxPx = this.calculateMaxPx();
|
|
6677
|
-
const timeHeaders = getTimeHeaders$1(props.startDate, props.endDate);
|
|
6678
|
-
const dayPx = maxPx / Math.floor(daysBetweenTwoDates$1(props.startDate, props.endDate));
|
|
6679
|
-
const hourPx = dayPx / 24;
|
|
6680
|
-
const minutePx = dayPx / 1440;
|
|
6681
|
-
this.state = {
|
|
6682
|
-
startDate: props.startDate,
|
|
6683
|
-
endDate: props.endDate,
|
|
6684
|
-
maxPx: maxPx,
|
|
6685
|
-
dayPx: dayPx,
|
|
6686
|
-
hourPx: hourPx,
|
|
6687
|
-
minutePx: minutePx,
|
|
6688
|
-
timeHeaders: timeHeaders,
|
|
6689
|
-
eventHeight: 30,
|
|
6690
|
-
events: props.events,
|
|
6691
|
-
resources: props.resources,
|
|
6692
|
-
top: 0,
|
|
6693
|
-
bottom: 1000,
|
|
6694
|
-
lineStyle: 0,
|
|
6695
|
-
nowUtc: getUtcToday$1(),
|
|
6696
|
-
division: 0,
|
|
6697
|
-
divisionType: "",
|
|
6698
|
-
pinnedResources: props.pinnedResources ? props.pinnedResources : [],
|
|
6699
|
-
selectedEvents: [],
|
|
6700
|
-
showConsoleLogs: false, // Change to false to not show the console.log(...)
|
|
6701
|
-
groupByFunction: props.groupByFunction ?? false,
|
|
6702
|
-
};
|
|
6703
|
-
};
|
|
6704
|
-
initOutside = (events, resources, _nextProps, startDate, endDate) => {
|
|
6705
|
-
// const maxPx: number = (document.getElementById("root")?.clientWidth ?? window.innerWidth) - 150;
|
|
6706
|
-
const maxPx = this.calculateMaxPx();
|
|
6707
|
-
const timeHeaders = getTimeHeaders$1(startDate, endDate);
|
|
6708
|
-
const days = Math.floor(daysBetweenTwoDates$1(startDate, endDate));
|
|
6709
|
-
const dayPx = maxPx / days;
|
|
6710
|
-
const hourPx = dayPx / 24;
|
|
6711
|
-
const minutePx = dayPx / 1440;
|
|
6712
|
-
const eventHeight = 30;
|
|
6713
|
-
resources = filterResources$1(this.props.module, this.props.resourceName, this.props.resources, this.props.groupByFunction, endDate, startDate);
|
|
6714
|
-
resources = resources.map((resource) => {
|
|
6715
|
-
return {
|
|
6716
|
-
...resource,
|
|
6717
|
-
events: getEventsOfResource(resource, events, this.state, this.props.id, this.props.module, startDate, endDate),
|
|
6718
|
-
};
|
|
6719
|
-
});
|
|
6720
|
-
const groupByFunction = this.props.groupByFunction ?? false;
|
|
6721
|
-
const now = getUtcToday$1();
|
|
6722
|
-
const isInDateRange = now >= startDate && now <= endDate && this.contentArea !== undefined;
|
|
6723
|
-
const lineStyle = isInDateRange ? daysBetweenTwoDatesIncludingBoth$1(startDate, now) * dayPx : 0;
|
|
6724
|
-
this.setState({
|
|
6725
|
-
startDate: startDate,
|
|
6726
|
-
endDate: endDate,
|
|
6727
|
-
maxPx: maxPx,
|
|
6728
|
-
dayPx: dayPx,
|
|
6729
|
-
hourPx: hourPx,
|
|
6730
|
-
minutePx: minutePx,
|
|
6731
|
-
timeHeaders: timeHeaders,
|
|
6732
|
-
eventHeight: eventHeight,
|
|
6733
|
-
events: [...events],
|
|
6734
|
-
resources: [...resources],
|
|
6735
|
-
top: 0,
|
|
6736
|
-
bottom: 1000,
|
|
6737
|
-
lineStyle: lineStyle,
|
|
6738
|
-
nowUtc: now,
|
|
6739
|
-
division: 0,
|
|
6740
|
-
divisionType: "",
|
|
6741
|
-
pinnedResources: this.props.pinnedResources ?? [],
|
|
6742
|
-
groupByFunction: groupByFunction,
|
|
6743
|
-
});
|
|
6744
|
-
};
|
|
6745
|
-
componentDidMount() {
|
|
6746
|
-
const eventsCopy = [...this.props.events];
|
|
6747
|
-
const filteredResources = filterAndProcessResources(this.props, this.state);
|
|
6748
|
-
const divisions = calculateDivisions$1(this.state.startDate, this.state.endDate);
|
|
6749
|
-
const divisionType = calculateDivisionType$1(this.state.startDate, this.state.endDate);
|
|
6750
|
-
this.setState({
|
|
6751
|
-
events: eventsCopy,
|
|
6752
|
-
resources: filteredResources,
|
|
6753
|
-
division: divisions,
|
|
6754
|
-
divisionType: divisionType,
|
|
6755
|
-
});
|
|
6756
|
-
// Añadir ResizeObserver
|
|
6757
|
-
const mainElement = document.querySelector(".cw-scheduler-main-wrapper");
|
|
6758
|
-
if (mainElement) {
|
|
6759
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
6760
|
-
this.handleResize();
|
|
6761
|
-
});
|
|
6762
|
-
this.resizeObserver.observe(mainElement);
|
|
6763
|
-
}
|
|
6764
|
-
window?.addEventListener("resize", this.handleResize);
|
|
6765
|
-
}
|
|
6766
|
-
componentWillUnmount() {
|
|
6767
|
-
if (this.resizeObserver) {
|
|
6768
|
-
this.resizeObserver.disconnect();
|
|
6769
|
-
}
|
|
6770
|
-
window?.removeEventListener("resize", this.handleResize);
|
|
6771
|
-
}
|
|
6772
|
-
recalculateEventPositions = (events, dayPx, startDate) => {
|
|
6773
|
-
return events.map(event => getEventWithSize$1(event, startDate, dayPx));
|
|
6774
|
-
};
|
|
6775
|
-
updateResourcesWithEvents = (resources, events) => {
|
|
6776
|
-
return resources.map(resource => ({
|
|
6777
|
-
...resource,
|
|
6778
|
-
events: events.filter(event => event.resourceId === resource.id)
|
|
6779
|
-
}));
|
|
6780
|
-
};
|
|
6781
|
-
handleResize = () => {
|
|
6782
|
-
const maxPx = this.calculateMaxPx();
|
|
6783
|
-
const days = Math.floor(daysBetweenTwoDates$1(this.state.startDate, this.state.endDate));
|
|
6784
|
-
const dayPx = maxPx / days;
|
|
6785
|
-
const hourPx = dayPx / 24;
|
|
6786
|
-
const minutePx = dayPx / 1440;
|
|
6787
|
-
const recalculatedEvents = this.recalculateEventPositions(this.state.events, dayPx, this.state.startDate);
|
|
6788
|
-
const updatedResources = this.updateResourcesWithEvents(this.state.resources, recalculatedEvents);
|
|
6789
|
-
this.setState({
|
|
6790
|
-
maxPx,
|
|
6791
|
-
dayPx,
|
|
6792
|
-
hourPx,
|
|
6793
|
-
minutePx,
|
|
6794
|
-
events: recalculatedEvents,
|
|
6795
|
-
resources: updatedResources
|
|
6796
|
-
});
|
|
6797
|
-
};
|
|
6798
|
-
componentWillReceiveProps(_nextProps) {
|
|
6799
|
-
if (this.state.showConsoleLogs) {
|
|
6800
|
-
console.log("Schedule - componentWillReceiveProps, start: ", moment(new Date()).toString());
|
|
6801
|
-
console.log("Schedule - componentWillReceiveProps - has changes, start: ", moment(new Date()).toString());
|
|
6385
|
+
setSelectedTime("");
|
|
6386
|
+
}, [onChange]);
|
|
6387
|
+
const handleInputClick = React.useCallback(() => {
|
|
6388
|
+
if (!disabled) {
|
|
6389
|
+
setIsOpen(true);
|
|
6802
6390
|
}
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6391
|
+
}, [disabled]);
|
|
6392
|
+
const handleInputChange = React.useCallback((e) => {
|
|
6393
|
+
const newValue = e.target.value;
|
|
6394
|
+
setInputValue(newValue);
|
|
6395
|
+
// Try to parse the full datetime string: dd.MM.yyyy HH:mm
|
|
6396
|
+
if (newValue.length >= 16) {
|
|
6397
|
+
validateAndSetDateTime(newValue);
|
|
6807
6398
|
}
|
|
6808
|
-
if (
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
if (this.state.showConsoleLogs) {
|
|
6813
|
-
console.log("Schedule - componentWillReceiveProps - print on schedule, end: ", moment(new Date()).toString());
|
|
6814
|
-
console.log("Schedule - componentWillReceiveProps, end: ", moment(new Date()).toString());
|
|
6815
|
-
}
|
|
6816
|
-
return;
|
|
6399
|
+
else if (newValue === "") {
|
|
6400
|
+
onChange(undefined);
|
|
6401
|
+
setSelectedDate(undefined);
|
|
6402
|
+
setSelectedTime("");
|
|
6817
6403
|
}
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
const height = tops.length === 0 ? this.state.eventHeight : tops.length * this.state.eventHeight;
|
|
6836
|
-
let flatMapEvents = [];
|
|
6837
|
-
for (let h = 0; h < tops.length; h++) {
|
|
6838
|
-
flatMapEvents = flatMapEvents.concat(tops[h]);
|
|
6404
|
+
}, [validateAndSetDateTime, onChange]);
|
|
6405
|
+
const handleInputBlur = React.useCallback(() => {
|
|
6406
|
+
// Try to parse if there's text
|
|
6407
|
+
if (inputValue && inputValue.trim() !== "") {
|
|
6408
|
+
const parsed = parseDateTime(inputValue);
|
|
6409
|
+
if (parsed && !isNaN(parsed.getTime())) {
|
|
6410
|
+
const isValid = (!minDateTime || parsed >= minDateTime) &&
|
|
6411
|
+
(!maxDateTime || parsed <= maxDateTime);
|
|
6412
|
+
if (isValid) {
|
|
6413
|
+
onChange(parsed);
|
|
6414
|
+
const dateStr = dateFns.format(parsed, "dd.MM.yyyy", { locale: locale.enGB });
|
|
6415
|
+
const timeStr = dateFns.format(parsed, "HH:mm", { locale: locale.enGB });
|
|
6416
|
+
setInputValue(`${dateStr} ${timeStr}`);
|
|
6417
|
+
setSelectedDate(parsed);
|
|
6418
|
+
setSelectedTime(timeStr);
|
|
6419
|
+
return;
|
|
6420
|
+
}
|
|
6839
6421
|
}
|
|
6840
|
-
return {
|
|
6841
|
-
...resource,
|
|
6842
|
-
maxTop: height,
|
|
6843
|
-
events: flatMapEvents,
|
|
6844
|
-
};
|
|
6845
|
-
});
|
|
6846
|
-
this.setState({
|
|
6847
|
-
events: mappedEvents,
|
|
6848
|
-
resources: newResources,
|
|
6849
|
-
});
|
|
6850
|
-
}
|
|
6851
|
-
handleOnClickContextMenuResourceScheduler = (_clickEvent, _resource) => {
|
|
6852
|
-
let datetime = new Date();
|
|
6853
|
-
const _ca = this.contentArea;
|
|
6854
|
-
if (_clickEvent.domEvent.currentTarget !== undefined) {
|
|
6855
|
-
const leftPos = _clickEvent.domEvent.currentTarget.parentElement.getBoundingClientRect().left -
|
|
6856
|
-
(_ca?.getBoundingClientRect()?.left ?? 0) -
|
|
6857
|
-
window.scrollX;
|
|
6858
|
-
datetime = addMinutesToDateFromPx$1(this.state.startDate, leftPos, this.state.minutePx);
|
|
6859
6422
|
}
|
|
6860
|
-
|
|
6861
|
-
|
|
6423
|
+
// Sync with current value
|
|
6424
|
+
if (value) {
|
|
6425
|
+
const dateStr = dateFns.format(value, "dd.MM.yyyy", { locale: locale.enGB });
|
|
6426
|
+
const timeStr = dateFns.format(value, "HH:mm", { locale: locale.enGB });
|
|
6427
|
+
setInputValue(`${dateStr} ${timeStr}`);
|
|
6862
6428
|
}
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
if (this.props.scheduler_handleOnClickResourceContextMenu) {
|
|
6866
|
-
this.props.scheduler_handleOnClickResourceContextMenu(_e, resource);
|
|
6429
|
+
else {
|
|
6430
|
+
setInputValue("");
|
|
6867
6431
|
}
|
|
6868
|
-
};
|
|
6869
|
-
|
|
6870
|
-
if (
|
|
6871
|
-
|
|
6432
|
+
}, [inputValue, parseDateTime, minDateTime, maxDateTime, onChange, value]);
|
|
6433
|
+
const handleInputKeyDown = React.useCallback((e) => {
|
|
6434
|
+
if (e.key === "Enter") {
|
|
6435
|
+
e.preventDefault();
|
|
6436
|
+
inputRef.current?.blur();
|
|
6437
|
+
setIsOpen(false);
|
|
6872
6438
|
}
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
const
|
|
6880
|
-
|
|
6881
|
-
const
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
})
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
}, descriptionColumn: this.props.descriptionColumn })), jsxRuntime.jsx("tbody", { style: {
|
|
6904
|
-
overflow: "visible",
|
|
6905
|
-
width: this.state.maxPx + 150
|
|
6906
|
-
}, className: isPinnedTable ? "fc-body cw-fc-body-pinned" : "fc-body", children: jsxRuntime.jsxs("tr", { className: "fc_body_row", children: [jsxRuntime.jsx(ResourcesTitleList$1, { resources: this.state.resources, canBePinned: this.props.canBePinned ?? false, includesPinned: this.props.id.toLowerCase().includes("pinned"), onCrewPinning: this.handleCrewPinning, onClickResourceContextMenu: this.handleOnClickResourceContextMenu, ResourceTitleComponent: this.props.resourceComp }), jsxRuntime.jsx("td", { className: "dividerArea" }), jsxRuntime.jsx(SchedulerContentArea$1, { now: this.state.nowUtc, showTimeline: showTimeline, timeSeparatorLeftPx: hoursPixels, timeLineLeftPx: this.state.lineStyle, resources: this.state.resources, contextMenuContents: this.props.resourceContextMenuContents, scheduler: this, onEmptyClick: this.props.scheduler_handleEmptyClick, setContentArea: (n) => (this.contentArea = n), onClickContextMenu: this.handleOnClickContextMenuResourceScheduler })] }) })] }) }));
|
|
6907
|
-
}
|
|
6439
|
+
else if (e.key === "Escape") {
|
|
6440
|
+
setIsOpen(false);
|
|
6441
|
+
inputRef.current?.blur();
|
|
6442
|
+
}
|
|
6443
|
+
}, []);
|
|
6444
|
+
const handleNowClick = React.useCallback(() => {
|
|
6445
|
+
const now = new Date();
|
|
6446
|
+
// Check if now is within allowed range
|
|
6447
|
+
const isNowValid = (!minDateTime || now >= minDateTime) &&
|
|
6448
|
+
(!maxDateTime || now <= maxDateTime);
|
|
6449
|
+
if (isNowValid) {
|
|
6450
|
+
onChange(now);
|
|
6451
|
+
setIsOpen(false);
|
|
6452
|
+
}
|
|
6453
|
+
}, [minDateTime, maxDateTime, onChange]);
|
|
6454
|
+
// Memoize disabled days
|
|
6455
|
+
const disabledDays = React.useMemo(() => [
|
|
6456
|
+
...(disabledDates || []),
|
|
6457
|
+
...(minDateTime ? [{ before: minDateTime }] : []),
|
|
6458
|
+
...(maxDateTime ? [{ after: maxDateTime }] : []),
|
|
6459
|
+
...(disabledMatcher ? [disabledMatcher] : []),
|
|
6460
|
+
], [disabledDates, minDateTime, maxDateTime, disabledMatcher]);
|
|
6461
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: `cw-datetimepicker ${className || ""}`, children: jsxRuntime.jsxs(CwAlign, { ...alignProps, itemProp: required ? "required" : "", children: [labelProps && (jsxRuntime.jsx(CwLabel, { ...labelProps, children: labelProps.text })), jsxRuntime.jsxs("div", { ref: wrapperRef, className: styles$4.pickerWrapper, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: inputValue, placeholder: placeholder, onChange: handleInputChange, onBlur: handleInputBlur, onClick: handleInputClick, onKeyDown: handleInputKeyDown, disabled: disabled, required: required, maxLength: 16, style: { width: "24ch" } }), jsxRuntime.jsx("div", { className: styles$4.pickerIcons, children: showClear && value && !disabled ? (jsxRuntime.jsx(CwButton, { type: "button", variant: "icon", color: "neutral", icon: "close", onClick: handleClear, tabIndex: -1, "aria-label": "Clear datetime" })) : (jsxRuntime.jsx(CwIcon, { iconId: "calendar-time" })) }), renderPopup(jsxRuntime.jsxs("div", { ref: popupRef, className: `${styles$4.pickerPopup} ${compactStyles.compactPopup}`, style: popupStyle, children: [jsxRuntime.jsxs("div", { className: compactStyles.calendarWrapper, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { mode: "single", selected: selectedDate, onSelect: handleDaySelect, defaultMonth: selectedDate, disabled: disabledDays, numberOfMonths: numberOfMonths, modifiers: {
|
|
6462
|
+
today: new Date(),
|
|
6463
|
+
}, modifiersClassNames: {
|
|
6464
|
+
today: "rdp-day-today",
|
|
6465
|
+
} }), showTodayButton && (jsxRuntime.jsx("footer", { className: "cw-flex-row cw-align-center-center", children: jsxRuntime.jsx(CwButton, { type: "button", variant: "outline", icon: "check-big", onClick: handleNowClick, text: "Now" }) }))] }), jsxRuntime.jsxs("div", { className: compactStyles.timeWrapper, children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsx(CwIcon, { iconId: "clock", size: "medium" }), jsxRuntime.jsx("span", { children: "Time" })] }), jsxRuntime.jsx("div", { ref: timeListRef, className: `${timeStyles.timePickerList} ${compactStyles.compactTimeList}`, children: timeOptions.map((time) => {
|
|
6466
|
+
const isSelected = time === selectedTime;
|
|
6467
|
+
return (jsxRuntime.jsx("button", { type: "button", className: isSelected ? timeStyles.selected : "", onClick: () => handleTimeSelect(time), children: time }, time));
|
|
6468
|
+
}) })] })] }))] })] }) }));
|
|
6908
6469
|
}
|
|
6909
6470
|
|
|
6910
6471
|
const ResourcesTitleList = ({ resources, canBePinned, includesPinned, onCrewPinning, onClickResourceContextMenu, ResourceTitleComponent, }) => {
|
|
@@ -7223,7 +6784,7 @@ crewAssignmentSchedulerContextMenu, }) => {
|
|
|
7223
6784
|
};
|
|
7224
6785
|
|
|
7225
6786
|
const TimeLine$1 = ({ id, toolTipTitle, marginLeft, color = "rgba(255,0,0,.6)", pixels = 2, height = "100%", zIndex = 1, }) => {
|
|
7226
|
-
return (jsxRuntime.jsx(
|
|
6787
|
+
return (jsxRuntime.jsx(CwGenericTooltip, { content: toolTipTitle, position: "top", children: jsxRuntime.jsx("div", { id: id, style: {
|
|
7227
6788
|
borderLeft: `${pixels}px solid ${color}`,
|
|
7228
6789
|
marginLeft: marginLeft,
|
|
7229
6790
|
width: "0px",
|
|
@@ -8099,7 +7660,7 @@ class OnClickContextMenu {
|
|
|
8099
7660
|
}
|
|
8100
7661
|
}
|
|
8101
7662
|
|
|
8102
|
-
var styles$3 = {"scheduler-header-divisions":"scheduler-header-
|
|
7663
|
+
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"};
|
|
8103
7664
|
|
|
8104
7665
|
const getNow$1 = (isUtc) => {
|
|
8105
7666
|
let now = new Date();
|
|
@@ -8179,7 +7740,7 @@ const SchedulerHeader = ({ content, divisions, visibleDays, selectedDate, width,
|
|
|
8179
7740
|
}), !(timeLinePercentage < 0 || timeLinePercentage > 100) && (jsxRuntime.jsx(TimeLine, { color: "red", left: `${timeLinePercentage}%`, top: "50%", height: "50%", isHeader: true, isUtc: isUtc }))] })] }));
|
|
8180
7741
|
};
|
|
8181
7742
|
|
|
8182
|
-
var styles$2 = {"hide-scrollbar":"new-scheduler-
|
|
7743
|
+
var styles$2 = {"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","scheduler-event-text":"new-scheduler-module__scheduler-event-text__zjvd7"};
|
|
8183
7744
|
|
|
8184
7745
|
const BackgroundEvent = ({ value, heightRem }) => {
|
|
8185
7746
|
const backColor = getHSLColor(value.color, value.alpha ?? 0.5);
|
|
@@ -8215,17 +7776,6 @@ const BackgroundEvent = ({ value, heightRem }) => {
|
|
|
8215
7776
|
}, children: value.icons }) : null, jsxRuntime.jsx("span", { className: styles$2["scheduler-event-text"], children: value.name })] }) }) }) }) })) : null;
|
|
8216
7777
|
};
|
|
8217
7778
|
|
|
8218
|
-
var styles$1 = {"scheduler-row-header":"scheduler-row-module_scheduler-row-header__S-iv4"};
|
|
8219
|
-
|
|
8220
|
-
const DefaultRowHeader = ({ value, width, onEvent }) => {
|
|
8221
|
-
return (jsxRuntime.jsxs("div", { style: {
|
|
8222
|
-
width: width,
|
|
8223
|
-
// background: color,
|
|
8224
|
-
}, onClick: (_) => {
|
|
8225
|
-
onEvent(new OnClickRowHeader(value.rowId));
|
|
8226
|
-
}, className: styles$1["scheduler-row-header"], children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: value.title }), value.title2 && jsxRuntime.jsxs("span", { children: ["-", value.title2] }), " ", jsxRuntime.jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxRuntime.jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 && jsxRuntime.jsxs("span", { className: styles$1["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }));
|
|
8227
|
-
};
|
|
8228
|
-
|
|
8229
7779
|
function useSingleAndDoubleClicks(onClick, onDoubleClick) {
|
|
8230
7780
|
const timer = React.useRef(null);
|
|
8231
7781
|
const cancelPendingClick = React.useCallback(() => {
|
|
@@ -8253,6 +7803,60 @@ function useSingleAndDoubleClicks(onClick, onDoubleClick) {
|
|
|
8253
7803
|
return { handleClick, handleDoubleClick };
|
|
8254
7804
|
}
|
|
8255
7805
|
|
|
7806
|
+
const eventsCollide = (event1, event2) => {
|
|
7807
|
+
const eventInsideOther = event1.startDate <= event2.startDate && event1.endDate >= event2.endDate;
|
|
7808
|
+
const eventCollideStart = event1.endDate > event2.startDate && event1.endDate < event2.endDate;
|
|
7809
|
+
const eventCollideEnd = event2.endDate > event1.startDate && event2.endDate < event1.endDate;
|
|
7810
|
+
return eventInsideOther || eventCollideStart || eventCollideEnd;
|
|
7811
|
+
};
|
|
7812
|
+
// Function to separate events into non-colliding rows
|
|
7813
|
+
const separateEventsToInnerRows = (events) => {
|
|
7814
|
+
const sortedEvents = [...events].sort((a, b) => {
|
|
7815
|
+
const aOrder = a.order ?? Number.MAX_SAFE_INTEGER;
|
|
7816
|
+
const bOrder = b.order ?? Number.MAX_SAFE_INTEGER;
|
|
7817
|
+
if (aOrder !== bOrder) {
|
|
7818
|
+
return aOrder - bOrder; // Prioridad al order si ambos están definidos
|
|
7819
|
+
}
|
|
7820
|
+
return a.startDate.getTime() - b.startDate.getTime();
|
|
7821
|
+
});
|
|
7822
|
+
const rows = [];
|
|
7823
|
+
for (const event of sortedEvents) {
|
|
7824
|
+
let placed = false;
|
|
7825
|
+
for (const row of rows) {
|
|
7826
|
+
if (!row.some((existingEvent) => eventsCollide(existingEvent, event))) {
|
|
7827
|
+
row.push(event);
|
|
7828
|
+
placed = true;
|
|
7829
|
+
break;
|
|
7830
|
+
}
|
|
7831
|
+
}
|
|
7832
|
+
if (!placed) {
|
|
7833
|
+
rows.push([event]);
|
|
7834
|
+
}
|
|
7835
|
+
}
|
|
7836
|
+
return rows;
|
|
7837
|
+
};
|
|
7838
|
+
|
|
7839
|
+
const DivisionLine = ({ left, top = "0px", height, isDayBoundary }) => {
|
|
7840
|
+
const color = isDayBoundary ? "rgba(255,255,255,1)" : "rgba(255,255,255,0.8)";
|
|
7841
|
+
const width = isDayBoundary ? "2px" : "1px";
|
|
7842
|
+
return (jsxRuntime.jsx(TimeLine, { color: color, left: left + "%", height: height, width: width, top: top }));
|
|
7843
|
+
};
|
|
7844
|
+
|
|
7845
|
+
const WeekEndLine = ({ left, top = "0px", height, widthPercentage }) => {
|
|
7846
|
+
return (jsxRuntime.jsx(TimeLine, { color: "rgba(0,0,0,0.05)", left: left + "%", height: height, width: widthPercentage + "%", top: top }));
|
|
7847
|
+
};
|
|
7848
|
+
|
|
7849
|
+
var styles$1 = {"scheduler-row-header":"scheduler-row-module__scheduler-row-header__S-iv4"};
|
|
7850
|
+
|
|
7851
|
+
const DefaultRowHeader = ({ value, width, onEvent }) => {
|
|
7852
|
+
return (jsxRuntime.jsxs("div", { style: {
|
|
7853
|
+
width: width,
|
|
7854
|
+
// background: color,
|
|
7855
|
+
}, onClick: (_) => {
|
|
7856
|
+
onEvent(new OnClickRowHeader(value.rowId));
|
|
7857
|
+
}, className: styles$1["scheduler-row-header"], children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: value.title }), value.title2 && jsxRuntime.jsxs("span", { children: ["-", value.title2] }), " ", jsxRuntime.jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxRuntime.jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 && jsxRuntime.jsxs("span", { className: styles$1["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }));
|
|
7858
|
+
};
|
|
7859
|
+
|
|
8256
7860
|
const EventSideDrag = ({ left = false, heightRem, onStartEvent }) => {
|
|
8257
7861
|
return (jsxRuntime.jsx("span", { draggable: true, onDragStart: (e) => {
|
|
8258
7862
|
e.stopPropagation();
|
|
@@ -8305,6 +7909,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
|
|
|
8305
7909
|
top: "2px",
|
|
8306
7910
|
left: `${value.left}%`,
|
|
8307
7911
|
width: `${value.width}%`,
|
|
7912
|
+
minWidth: "5px",
|
|
8308
7913
|
position: "absolute",
|
|
8309
7914
|
zIndex: isOnDrag ? 999 : undefined,
|
|
8310
7915
|
contentVisibility: "auto",
|
|
@@ -8321,7 +7926,7 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
|
|
|
8321
7926
|
}, onDragEnd: (_) => {
|
|
8322
7927
|
if (value.isDraggable)
|
|
8323
7928
|
setIsOnDrag(false);
|
|
8324
|
-
}, children: jsxRuntime.jsx(
|
|
7929
|
+
}, children: jsxRuntime.jsx(CwTooltipNew, { content: value.tooltip, position: "bottom", hide: isOnDrag, showDelay: 200, children: jsxRuntime.jsxs("div", { style: {
|
|
8325
7930
|
border: value.selected ? "2px solid black" : "none",
|
|
8326
7931
|
backgroundColor: backColor,
|
|
8327
7932
|
height: `calc(${heightRem}rem - 4px)`,
|
|
@@ -8366,47 +7971,6 @@ const SchedulerEvent = ({ value, heightRem, onEvent }) => {
|
|
|
8366
7971
|
} }))] }) }) }, value.id) }));
|
|
8367
7972
|
};
|
|
8368
7973
|
|
|
8369
|
-
const eventsCollide = (event1, event2) => {
|
|
8370
|
-
const eventInsideOther = event1.startDate <= event2.startDate && event1.endDate >= event2.endDate;
|
|
8371
|
-
const eventCollideStart = event1.endDate > event2.startDate && event1.endDate < event2.endDate;
|
|
8372
|
-
const eventCollideEnd = event2.endDate > event1.startDate && event2.endDate < event1.endDate;
|
|
8373
|
-
return eventInsideOther || eventCollideStart || eventCollideEnd;
|
|
8374
|
-
};
|
|
8375
|
-
// Function to separate events into non-colliding rows
|
|
8376
|
-
const separateEventsToInnerRows = (events) => {
|
|
8377
|
-
const sortedEvents = [...events].sort((a, b) => {
|
|
8378
|
-
const aOrder = a.order ?? Number.MAX_SAFE_INTEGER;
|
|
8379
|
-
const bOrder = b.order ?? Number.MAX_SAFE_INTEGER;
|
|
8380
|
-
if (aOrder !== bOrder) {
|
|
8381
|
-
return aOrder - bOrder; // Prioridad al order si ambos están definidos
|
|
8382
|
-
}
|
|
8383
|
-
return a.startDate.getTime() - b.startDate.getTime();
|
|
8384
|
-
});
|
|
8385
|
-
const rows = [];
|
|
8386
|
-
for (const event of sortedEvents) {
|
|
8387
|
-
let placed = false;
|
|
8388
|
-
for (const row of rows) {
|
|
8389
|
-
if (!row.some((existingEvent) => eventsCollide(existingEvent, event))) {
|
|
8390
|
-
row.push(event);
|
|
8391
|
-
placed = true;
|
|
8392
|
-
break;
|
|
8393
|
-
}
|
|
8394
|
-
}
|
|
8395
|
-
if (!placed) {
|
|
8396
|
-
rows.push([event]);
|
|
8397
|
-
}
|
|
8398
|
-
}
|
|
8399
|
-
return rows;
|
|
8400
|
-
};
|
|
8401
|
-
|
|
8402
|
-
const DivisionLine = ({ left, top = "0px", height }) => {
|
|
8403
|
-
return (jsxRuntime.jsx(TimeLine, { color: "rgba(255,255,255,1)", left: left + "%", height: height, width: 1 + "px", top: top }));
|
|
8404
|
-
};
|
|
8405
|
-
|
|
8406
|
-
const WeekEndLine = ({ left, top = "0px", height, widthPercentage }) => {
|
|
8407
|
-
return (jsxRuntime.jsx(TimeLine, { color: "rgba(0,0,0,0.05)", left: left + "%", height: height, width: widthPercentage + "%", top: top }));
|
|
8408
|
-
};
|
|
8409
|
-
|
|
8410
7974
|
const SchedulerRow = React.memo((props) => {
|
|
8411
7975
|
const [isContextMenuOpen, setIsContextMenuOpen] = React.useState(false);
|
|
8412
7976
|
const { events, backgroundEvents, rowHeader, contextMenuItems, RowTitleComp, EventComp, BackgroundEventComp, weekendLines, divisionLines, timeLinePercentage, selectedDate, visibleDays, onEvent, } = props;
|
|
@@ -8453,7 +8017,7 @@ const SchedulerRow = React.memo((props) => {
|
|
|
8453
8017
|
}
|
|
8454
8018
|
}, onDragOver: (e) => {
|
|
8455
8019
|
e.preventDefault();
|
|
8456
|
-
}, onClick: handleClick, onDoubleClick: handleDoubleClick, children: [weekendLines.map((weekend) => (jsxRuntime.jsx(WeekEndLine, { height: "100%", left: weekend.left, widthPercentage: weekend.width }, weekend.left))), divisionLines.map((division) => (jsxRuntime.jsx(DivisionLine, { height: "100%", left: division.left }, division.left))), backgroundEvents.length > 0 && backgroundEvents.some((e) => e.isVisible) && (jsxRuntime.jsx("div", { style: {
|
|
8020
|
+
}, onClick: handleClick, onDoubleClick: handleDoubleClick, children: [weekendLines.map((weekend) => (jsxRuntime.jsx(WeekEndLine, { height: "100%", left: weekend.left, widthPercentage: weekend.width }, weekend.left))), divisionLines.map((division) => (jsxRuntime.jsx(DivisionLine, { height: "100%", left: division.left, isDayBoundary: division.isDayBoundary }, division.left))), backgroundEvents.length > 0 && backgroundEvents.some((e) => e.isVisible) && (jsxRuntime.jsx("div", { style: {
|
|
8457
8021
|
height: "100%",
|
|
8458
8022
|
position: internalRows.length > 0 ? "absolute" : "relative",
|
|
8459
8023
|
width: "100%",
|
|
@@ -8496,22 +8060,26 @@ const SchedulerRow = React.memo((props) => {
|
|
|
8496
8060
|
return true;
|
|
8497
8061
|
});
|
|
8498
8062
|
|
|
8063
|
+
const DIVISION_RULES = [
|
|
8064
|
+
{ maxDays: 2, divisions: 24 },
|
|
8065
|
+
{ maxDays: 3, divisions: 12 },
|
|
8066
|
+
{ maxDays: 4, divisions: 8 },
|
|
8067
|
+
{ maxDays: 5, divisions: 6 },
|
|
8068
|
+
{ maxDays: 7, divisions: 3 },
|
|
8069
|
+
];
|
|
8070
|
+
const DEFAULT_DIVISIONS = 2;
|
|
8499
8071
|
const calculateDivisionsByDays = (days) => {
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
}
|
|
8503
|
-
if (days <= 7) {
|
|
8504
|
-
return 3;
|
|
8505
|
-
}
|
|
8506
|
-
return 2;
|
|
8072
|
+
const rule = DIVISION_RULES.find((it) => days <= it.maxDays);
|
|
8073
|
+
return rule?.divisions ?? DEFAULT_DIVISIONS;
|
|
8507
8074
|
};
|
|
8508
|
-
const getHoursFromDivisions = (divisions) => {
|
|
8075
|
+
const getHoursFromDivisions = (divisions, useCompactHourFormat = false) => {
|
|
8509
8076
|
const hoursInterval = 24 / divisions;
|
|
8077
|
+
const hourFormat = useCompactHourFormat ? "HH[h]" : "HH:mm";
|
|
8510
8078
|
const array = [];
|
|
8511
8079
|
for (let i = 0; i < divisions; i++) {
|
|
8512
8080
|
const newHour = moment(new Date(1, 1, 1))
|
|
8513
8081
|
.add(hoursInterval * i, "hours")
|
|
8514
|
-
.format(
|
|
8082
|
+
.format(hourFormat);
|
|
8515
8083
|
array.push(newHour);
|
|
8516
8084
|
}
|
|
8517
8085
|
return array;
|
|
@@ -8529,12 +8097,16 @@ const getDefaultDivisions = (visibleDays, selectedDate) => {
|
|
|
8529
8097
|
};
|
|
8530
8098
|
const getDayDivisions = (visibleDays, selectedDate) => {
|
|
8531
8099
|
const divisionsNumber = calculateDivisionsByDays(visibleDays);
|
|
8532
|
-
const divisions = getHoursFromDivisions(divisionsNumber);
|
|
8100
|
+
const divisions = getHoursFromDivisions(divisionsNumber, visibleDays < 3);
|
|
8533
8101
|
const calculatedDivision = [];
|
|
8534
8102
|
for (let i = 0; i < visibleDays; i++) {
|
|
8535
8103
|
const currentDate = moment(selectedDate).add(i, "days");
|
|
8104
|
+
const weekdayShort = currentDate.format("ddd");
|
|
8105
|
+
const weekdayLabel = visibleDays < 8
|
|
8106
|
+
? weekdayShort
|
|
8107
|
+
: weekdayShort.charAt(0).toUpperCase();
|
|
8536
8108
|
calculatedDivision.push({
|
|
8537
|
-
top: currentDate.format("DD.MM
|
|
8109
|
+
top: `${weekdayLabel} ${currentDate.format("DD.MM")}`,
|
|
8538
8110
|
bottom: divisions,
|
|
8539
8111
|
startDate: currentDate.toDate(),
|
|
8540
8112
|
endDate: currentDate.toDate()
|
|
@@ -8659,7 +8231,10 @@ const getEventSizes = (schedulerDate, totalDays, startDate, endDate) => {
|
|
|
8659
8231
|
startHours = 0;
|
|
8660
8232
|
}
|
|
8661
8233
|
const left = (startHours / totalHours) * 100;
|
|
8662
|
-
|
|
8234
|
+
// Minimum width equivalent to 15 minutes so zero/near-zero duration events stay visible
|
|
8235
|
+
const MIN_WIDTH_HOURS = 0.25;
|
|
8236
|
+
const minWidth = (MIN_WIDTH_HOURS * 100) / totalHours;
|
|
8237
|
+
const width = Math.max((durationHours * 100) / totalHours, minWidth);
|
|
8663
8238
|
return {
|
|
8664
8239
|
left,
|
|
8665
8240
|
width,
|
|
@@ -8667,16 +8242,13 @@ const getEventSizes = (schedulerDate, totalDays, startDate, endDate) => {
|
|
|
8667
8242
|
};
|
|
8668
8243
|
|
|
8669
8244
|
function getLinesByDivisions(headerDivision, _) {
|
|
8670
|
-
const lines = headerDivision.flatMap((division) => {
|
|
8671
|
-
return division.bottom;
|
|
8672
|
-
});
|
|
8245
|
+
const lines = headerDivision.flatMap((division) => division.bottom.map((_, i) => ({ isDayBoundary: i === 0 })));
|
|
8673
8246
|
const left = 100 / lines.length;
|
|
8674
|
-
const finalLines = lines.map((
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
}).filter((_, index) => index !== 0);
|
|
8247
|
+
const finalLines = lines.map((line, index) => ({
|
|
8248
|
+
left: left * index,
|
|
8249
|
+
width: 1,
|
|
8250
|
+
isDayBoundary: line.isDayBoundary,
|
|
8251
|
+
})).filter((_, index) => index !== 0);
|
|
8680
8252
|
return finalLines;
|
|
8681
8253
|
}
|
|
8682
8254
|
|
|
@@ -8715,9 +8287,6 @@ const getWeekendsDaysInDateRange = (initialDate, visibleDays) => {
|
|
|
8715
8287
|
return weekends;
|
|
8716
8288
|
};
|
|
8717
8289
|
|
|
8718
|
-
class UiEvent {
|
|
8719
|
-
}
|
|
8720
|
-
|
|
8721
8290
|
const getNow = (isUtc) => {
|
|
8722
8291
|
let now = new Date();
|
|
8723
8292
|
if (!isUtc) {
|
|
@@ -8725,11 +8294,10 @@ const getNow = (isUtc) => {
|
|
|
8725
8294
|
}
|
|
8726
8295
|
return now;
|
|
8727
8296
|
};
|
|
8728
|
-
const rowsHeight = 1.75; // rem
|
|
8729
8297
|
const milliSecondsInSecond = 1000;
|
|
8730
8298
|
const refreshMilliSeconds = 45 * milliSecondsInSecond;
|
|
8731
8299
|
const Scheduler = (props) => {
|
|
8732
|
-
const { header: headerContent, id, events: eventsState, backgroundEvents, contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, } = props;
|
|
8300
|
+
const { header: headerContent, id, events: eventsState, backgroundEvents, contextMenuItems, EventComp, RowTitleComp, orderCategories = ["title"], useOrderCategory, onEvent, groupRowColors, rowHeaderWidth = 180, rowHeightRem = 1.75, } = props;
|
|
8733
8301
|
const BackgroundEventComp = props.BackgroundEventComp ?? BackgroundEvent;
|
|
8734
8302
|
const rows = useOrderCategory === false
|
|
8735
8303
|
? props.rows
|
|
@@ -8745,8 +8313,12 @@ const Scheduler = (props) => {
|
|
|
8745
8313
|
React.useEffect(() => {
|
|
8746
8314
|
instanceRef.current?.resetAfterIndex(0);
|
|
8747
8315
|
}, [orderCategories, props.rows.length, events]);
|
|
8748
|
-
const
|
|
8749
|
-
|
|
8316
|
+
const totalSubRows = rows.reduce((acc, row) => {
|
|
8317
|
+
const filteredEvents = events.filter((it) => it.rowId === row.rowId);
|
|
8318
|
+
const innerRows = separateEventsToInnerRows(filteredEvents);
|
|
8319
|
+
return acc + Math.max(innerRows.length, 1);
|
|
8320
|
+
}, 0);
|
|
8321
|
+
const visibleRows = Math.min(stateVisibleRows ?? totalSubRows, totalSubRows);
|
|
8750
8322
|
const totalHours = visibleDays * 24;
|
|
8751
8323
|
const [timeLinePercentage, setTimeLinePercentage] = React.useState(0);
|
|
8752
8324
|
const header = {
|
|
@@ -8761,7 +8333,7 @@ const Scheduler = (props) => {
|
|
|
8761
8333
|
};
|
|
8762
8334
|
const evenColor = "var(--cw-color-surface-container-low)";
|
|
8763
8335
|
const oddColor = "var(--cw-color-surface-container)";
|
|
8764
|
-
const schedulerContentHeight =
|
|
8336
|
+
const schedulerContentHeight = rowHeightRem * Math.max(visibleRows, 1);
|
|
8765
8337
|
const weekendsLines = getWeekendLinesByDatesVisible(selectedDate, visibleDays);
|
|
8766
8338
|
const divisionLines = getLinesByDivisions(header.divisions);
|
|
8767
8339
|
// Timeline percentage calculation
|
|
@@ -8788,7 +8360,7 @@ const Scheduler = (props) => {
|
|
|
8788
8360
|
return (jsxRuntime.jsx("div", { style: {
|
|
8789
8361
|
...style,
|
|
8790
8362
|
backgroundColor: rowColor
|
|
8791
|
-
}, children: jsxRuntime.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:
|
|
8363
|
+
}, children: jsxRuntime.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: rowHeightRem, onEvent: onEvent, contextMenuItems: contextMenuItems, visibleDays: visibleDays, selectedDate: selectedDate }) }, row.rowId));
|
|
8792
8364
|
});
|
|
8793
8365
|
const getItemSize = React.useCallback((index) => {
|
|
8794
8366
|
const row = rows[index];
|
|
@@ -8796,7 +8368,7 @@ const Scheduler = (props) => {
|
|
|
8796
8368
|
const innerRows = separateEventsToInnerRows(filteredEvents);
|
|
8797
8369
|
const rowsNumber = innerRows.length > 0 ? innerRows.length : 1;
|
|
8798
8370
|
const pixelsInRem = 16;
|
|
8799
|
-
return rowsNumber *
|
|
8371
|
+
return rowsNumber * rowHeightRem * pixelsInRem;
|
|
8800
8372
|
}, [rows, events]);
|
|
8801
8373
|
// Render
|
|
8802
8374
|
return (jsxRuntime.jsxs("div", { id: id, style: {
|
|
@@ -8810,15 +8382,9 @@ const Scheduler = (props) => {
|
|
|
8810
8382
|
zIndex: 1,
|
|
8811
8383
|
}, children: jsxRuntime.jsx(SchedulerHeader, { ...header }) })), jsxRuntime.jsx(reactWindow.VariableSizeList, { height: schedulerContentHeight * 16, itemCount: rows.length, itemSize: getItemSize, width: "100%", style: { overflowX: "hidden" }, ref: instanceRef, className: styles$2["hide-scrollbar"], children: Row })] }));
|
|
8812
8384
|
};
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
const newEvents = events.filter(it => it.rowId === row.rowId);
|
|
8817
|
-
const innerRows = separateEventsToInnerRows(newEvents);
|
|
8818
|
-
return innerRows.length > 0 ? innerRows : [[]];
|
|
8819
|
-
});
|
|
8820
|
-
return flatMapped.length;
|
|
8821
|
-
};
|
|
8385
|
+
|
|
8386
|
+
class UiEvent {
|
|
8387
|
+
}
|
|
8822
8388
|
|
|
8823
8389
|
let topsCounter = 0;
|
|
8824
8390
|
class CwSuperScheduler extends React__namespace.Component {
|
|
@@ -9139,7 +8705,7 @@ class Resource {
|
|
|
9139
8705
|
}
|
|
9140
8706
|
}
|
|
9141
8707
|
|
|
9142
|
-
var styles = {"super-scheduler-row-header":"super-scheduler-
|
|
8708
|
+
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"};
|
|
9143
8709
|
|
|
9144
8710
|
class OnPinRow {
|
|
9145
8711
|
id;
|
|
@@ -9160,11 +8726,12 @@ class OnClearPinned {
|
|
|
9160
8726
|
const PinRowHeader = ({ value, width, onEvent }) => {
|
|
9161
8727
|
const [isContextMenuOpen, setIsContextMenuOpen] = React.useState(false);
|
|
9162
8728
|
const { highlightColor, isLoading } = value;
|
|
9163
|
-
return
|
|
8729
|
+
return jsxRuntime.jsx(CwAnchoredMenu, { open: isContextMenuOpen, onOpenChange: setIsContextMenuOpen, placement: "right", options: value.contextMenuItems ?? [], onSelect: (key) => {
|
|
9164
8730
|
onEvent(new OnClickContextMenu(value.rowId, key));
|
|
9165
|
-
}, children: jsxRuntime.jsx(
|
|
8731
|
+
}, children: jsxRuntime.jsx(CwTooltipNew, { content: value.tooltip, position: "right", dissapearsWhenHover: true, children: jsxRuntime.jsxs("div", { style: {
|
|
9166
8732
|
width: width,
|
|
9167
|
-
|
|
8733
|
+
height: "100%",
|
|
8734
|
+
background: highlightColor
|
|
9168
8735
|
}, className: styles["super-scheduler-row-header"], children: [jsxRuntime.jsx("button", { className: "cw-button-icon cwi-pin", "data-pinned": value.isPinned, onClick: (_) => {
|
|
9169
8736
|
onEvent(value.isPinned ? new OnUnpinRow(value.rowId) : new OnPinRow(value.rowId));
|
|
9170
8737
|
} }), jsxRuntime.jsx("div", { className: styles["indicators"], children: value.indicators ?? undefined }), jsxRuntime.jsxs("div", { style: {
|
|
@@ -9173,19 +8740,19 @@ const PinRowHeader = ({ value, width, onEvent }) => {
|
|
|
9173
8740
|
justifyContent: "center",
|
|
9174
8741
|
alignItems: "flex-start",
|
|
9175
8742
|
}, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: value.title }), value.title2 && jsxRuntime.jsxs("span", { children: ["-", value.title2] }), " ", jsxRuntime.jsx("strong", { children: value.subtitle })] }), value.subtitle && jsxRuntime.jsxs("div", { style: { opacity: 0.5 }, children: [value.title3 &&
|
|
9176
|
-
jsxRuntime.jsxs("span", { className: styles["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }), isLoading ? jsxRuntime.jsx("span", { className: "cwi-icons cwi-spinner" }) : undefined] }) }, value.rowId) }, value.rowId)
|
|
8743
|
+
jsxRuntime.jsxs("span", { className: styles["scheduler-crewmember-functions"], children: ["(", value.title3, ")"] }), value.subtitle2 && jsxRuntime.jsxs("span", { children: ["-", value.subtitle2] })] })] }), isLoading ? jsxRuntime.jsx("span", { className: "cwi-icons cwi-spinner" }) : undefined] }) }, value.rowId) }, value.rowId);
|
|
9177
8744
|
};
|
|
9178
8745
|
|
|
9179
|
-
const SuperScheduler = ({ id, state, header, rows, events, pinnedOrderCategory, unPinnedOrderCategory, backgroundEvents, contextMenuItems, onEvent }) => {
|
|
8746
|
+
const SuperScheduler = ({ id, state, header, rows, events, pinnedOrderCategory, unPinnedOrderCategory, backgroundEvents, contextMenuItems, onEvent, rowHeightRem = 1.75 }) => {
|
|
9180
8747
|
const pinnedRows = rows.filter((it) => it.isPinned);
|
|
9181
8748
|
const notPinnedRows = rows.filter((it) => !it.isPinned);
|
|
9182
8749
|
const isFirstVisible = pinnedRows.length > 0;
|
|
9183
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isFirstVisible && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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 }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(CwButton, { onClick: () => {
|
|
8750
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isFirstVisible && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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, rowHeightRem: rowHeightRem }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(CwButton, { onClick: () => {
|
|
9184
8751
|
onEvent(new OnClearPinned());
|
|
9185
|
-
}, children: "Clear pinned" }) })] })), jsxRuntime.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 })] }));
|
|
8752
|
+
}, children: "Clear pinned" }) })] })), jsxRuntime.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, rowHeightRem: rowHeightRem })] }));
|
|
9186
8753
|
};
|
|
9187
8754
|
|
|
9188
|
-
const CwFindAirport = ({ handleChange, searchType = "OnlyDatabase", placeHolder = "Search airport…", required = false, cblConfig, className = "", value, disabled = false, displayMode, labelProps, alignProps, width }) => {
|
|
8755
|
+
const CwFindAirport = ({ handleChange, searchType = "OnlyDatabase", placeHolder = "Search airport…", required = false, cblConfig, className = "", value, disabled = false, displayMode, initialDisplayText, labelProps, alignProps, width }) => {
|
|
9189
8756
|
// State
|
|
9190
8757
|
const [inputValue, setInputValue] = React.useState("");
|
|
9191
8758
|
const [options, setOptions] = React.useState([]);
|
|
@@ -9391,9 +8958,15 @@ const CwFindAirport = ({ handleChange, searchType = "OnlyDatabase", placeHolder
|
|
|
9391
8958
|
// Load initial value
|
|
9392
8959
|
React.useEffect(() => {
|
|
9393
8960
|
if (value && value !== 0 && value !== -1) {
|
|
9394
|
-
|
|
8961
|
+
if (initialDisplayText) {
|
|
8962
|
+
setInputValue(initialDisplayText);
|
|
8963
|
+
setTooltipText(initialDisplayText);
|
|
8964
|
+
}
|
|
8965
|
+
else {
|
|
8966
|
+
fetchAirportData(value);
|
|
8967
|
+
}
|
|
9395
8968
|
}
|
|
9396
|
-
}, [value, fetchAirportData]);
|
|
8969
|
+
}, [value, fetchAirportData, initialDisplayText]);
|
|
9397
8970
|
React.useEffect(() => {
|
|
9398
8971
|
if (!value || value === 0 || value === -1) {
|
|
9399
8972
|
setInputValue("");
|
|
@@ -9436,7 +9009,9 @@ exports.CwBtnSave = CwBtnSave;
|
|
|
9436
9009
|
exports.CwButton = CwButton;
|
|
9437
9010
|
exports.CwCard = CwCard;
|
|
9438
9011
|
exports.CwCardList = CwCardList;
|
|
9012
|
+
exports.CwCheck = CwCheck;
|
|
9439
9013
|
exports.CwCheckbox = CwCheckbox;
|
|
9014
|
+
exports.CwCheckboxGroup = CwCheckboxGroup;
|
|
9440
9015
|
exports.CwChip = CwChip;
|
|
9441
9016
|
exports.CwColorPicker = CwColorPicker;
|
|
9442
9017
|
exports.CwConfirmationPopup = CwConfirmationPopup;
|
|
@@ -9475,6 +9050,7 @@ exports.CwKeyValueList = CwKeyValueList;
|
|
|
9475
9050
|
exports.CwLabel = CwLabel;
|
|
9476
9051
|
exports.CwLoading = CwLoading;
|
|
9477
9052
|
exports.CwLoadingSmall = CwLoadingSmall;
|
|
9053
|
+
exports.CwMasterDetail = CwMasterDetail;
|
|
9478
9054
|
exports.CwMessage = CwMessage;
|
|
9479
9055
|
exports.CwMessageManager = CwMessageManager;
|
|
9480
9056
|
exports.CwModal = CwModal;
|
|
@@ -9486,12 +9062,12 @@ exports.CwNote = CwNote;
|
|
|
9486
9062
|
exports.CwOption = CwOption;
|
|
9487
9063
|
exports.CwReportModal = CwReportModal;
|
|
9488
9064
|
exports.CwScheduler = CwScheduler;
|
|
9489
|
-
exports.CwScheduler2 = CwScheduler2;
|
|
9490
9065
|
exports.CwSearchInput = CwSearchInput;
|
|
9491
9066
|
exports.CwSelect = CwSelect;
|
|
9492
9067
|
exports.CwSelectList = CwSelectList;
|
|
9493
9068
|
exports.CwSelectListItems = CwSelectListItems;
|
|
9494
9069
|
exports.CwSortableList = CwSortableList;
|
|
9070
|
+
exports.CwSortableTable = CwSortableTable;
|
|
9495
9071
|
exports.CwSuperScheduler = CwSuperScheduler;
|
|
9496
9072
|
exports.CwTable = CwTable;
|
|
9497
9073
|
exports.CwTableGrouped = CwTableGrouped;
|
|
@@ -9501,7 +9077,8 @@ exports.CwTextArea = CwTextArea;
|
|
|
9501
9077
|
exports.CwTime = CwTime;
|
|
9502
9078
|
exports.CwTimePicker = CwTimePicker;
|
|
9503
9079
|
exports.CwToggle = CwToggle;
|
|
9504
|
-
exports.
|
|
9080
|
+
exports.CwTooltipManager = CwTooltipManager;
|
|
9081
|
+
exports.CwTooltipNew = CwTooltipNew;
|
|
9505
9082
|
exports.CwTreeView = CwTreeView;
|
|
9506
9083
|
exports.CwWeekdaySelector = CwWeekdaySelector;
|
|
9507
9084
|
exports.DefaultRowHeader = DefaultRowHeader;
|
|
@@ -9540,3 +9117,4 @@ exports.getEventSizes = getEventSizes;
|
|
|
9540
9117
|
exports.itemsToMultiFilterTags = itemsToMultiFilterTags;
|
|
9541
9118
|
exports.useCwMessage = useCwMessage;
|
|
9542
9119
|
exports.useSortableList = useSortableList;
|
|
9120
|
+
exports.useSortableTable = useSortableTable;
|