intelicoreact 1.5.40 → 1.6.0
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/Atomic/FormElements/ActionAlert/ActionAlert.js +93 -44
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.scss +23 -13
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +43 -38
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.scss +20 -10
- package/dist/Atomic/FormElements/Calendar/Calendar.js +243 -164
- package/dist/Atomic/FormElements/Calendar/Calendar.scss +1 -0
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +60 -51
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +21 -11
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +47 -39
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.scss +5 -2
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +410 -308
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +169 -109
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +680 -527
- package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +58 -56
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +28 -15
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +498 -378
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.scss +33 -29
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +103 -70
- package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +0 -2
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +138 -91
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +109 -55
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +254 -193
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.scss +19 -16
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +156 -140
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.scss +8 -4
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +222 -156
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +158 -114
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +151 -92
- package/dist/Atomic/FormElements/Input/Input.js +340 -330
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +156 -110
- package/dist/Atomic/FormElements/InputColor/InputColor.js +57 -58
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +189 -145
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +294 -228
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +55 -56
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +645 -536
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +220 -190
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +33 -31
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +247 -169
- package/dist/Atomic/FormElements/InputLink/InputLink.js +118 -71
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +47 -38
- package/dist/Atomic/FormElements/InputMask/InputMask.js +938 -1053
- package/dist/Atomic/FormElements/InputMask/config.js +16 -15
- package/dist/Atomic/FormElements/InputMask/functions.js +77 -51
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +569 -592
- package/dist/Atomic/FormElements/InputMask2/config.js +16 -15
- package/dist/Atomic/FormElements/InputMask2/functions.js +77 -51
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +651 -679
- package/dist/Atomic/FormElements/InputMask3/config.js +16 -15
- package/dist/Atomic/FormElements/InputMask3/functions.js +77 -51
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +127 -88
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +182 -111
- package/dist/Atomic/FormElements/Label/Label.js +82 -55
- package/dist/Atomic/FormElements/Label/Label.scss +18 -8
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +437 -382
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +88 -50
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +314 -264
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +93 -51
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +69 -55
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +51 -45
- package/dist/Atomic/FormElements/RadioInput/RadioInput.scss +4 -4
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +53 -40
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +169 -120
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +195 -141
- package/dist/Atomic/FormElements/RangeList/RangeList.js +199 -140
- package/dist/Atomic/FormElements/RangeList/RangeList.scss +2 -2
- package/dist/Atomic/FormElements/RangeList/partial/AnyOuterClass.scss +0 -3
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +57 -44
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +463 -377
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +760 -759
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +36 -31
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.scss +0 -2
- package/dist/Atomic/FormElements/Switcher/Switcher.js +52 -44
- package/dist/Atomic/FormElements/Switcher/Switcher.scss +3 -3
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +43 -44
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.scss +0 -2
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +37 -36
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.scss +0 -2
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +93 -56
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.scss +0 -2
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +86 -53
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.scss +0 -2
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +46 -54
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +172 -102
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.scss +4 -6
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +209 -154
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +59 -56
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.scss +2 -2
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +140 -112
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1035 -919
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +153 -116
- package/dist/Atomic/FormElements/Text/Text.js +88 -97
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +44 -35
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.scss +8 -8
- package/dist/Atomic/FormElements/Textarea/Textarea.js +102 -64
- package/dist/Atomic/FormElements/Textarea/Textarea.scss +4 -8
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +172 -133
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +48 -49
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +114 -63
- package/dist/Atomic/FormElements/TimeRange/TimeRange.scss +9 -3
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +179 -122
- package/dist/Atomic/FormElements/UserContacts/UserContacts.scss +10 -5
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +101 -65
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +80 -71
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +79 -64
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.scss +0 -2
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +42 -34
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +102 -83
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.scss +0 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +42 -35
- package/dist/Atomic/Layout/Header/Header.js +148 -80
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +213 -133
- package/dist/Atomic/Layout/MainMenu/MainMenu.scss +7 -7
- package/dist/Atomic/Layout/Spinner/Spinner.js +39 -22
- package/dist/Atomic/Layout/Spinner/Spinner.scss +36 -16
- package/dist/Atomic/UI/Accordion/Accordion.js +102 -53
- package/dist/Atomic/UI/Accordion/Accordion.scss +25 -14
- package/dist/Atomic/UI/Accordion/AccordionItem.js +170 -102
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +251 -167
- package/dist/Atomic/UI/AccordionText/AccordionText.js +105 -54
- package/dist/Atomic/UI/AccordionText/AccordionText.scss +22 -9
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +207 -135
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +100 -46
- package/dist/Atomic/UI/Alert/Alert.js +116 -63
- package/dist/Atomic/UI/Alert/Alert.scss +2 -2
- package/dist/Atomic/UI/Arrow/Arrow.js +163 -110
- package/dist/Atomic/UI/Box/Box.js +37 -37
- package/dist/Atomic/UI/Box/Box.scss +11 -11
- package/dist/Atomic/UI/Button/Button.js +43 -41
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +61 -67
- package/dist/Atomic/UI/Chart/Chart.js +170 -96
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +142 -74
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +91 -77
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +120 -117
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +314 -292
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +54 -39
- package/dist/Atomic/UI/Chart/partial/utils.js +56 -33
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +145 -88
- package/dist/Atomic/UI/DateTime/DateTime.js +89 -37
- package/dist/Atomic/UI/DateTime/DateTime.scss +2 -2
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +93 -31
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +66 -18
- package/dist/Atomic/UI/DoubleString/DoubleString.js +134 -77
- package/dist/Atomic/UI/DoubleString/DoubleString.scss +6 -4
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +65 -22
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +251 -170
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +109 -84
- package/dist/Atomic/UI/Hint/Hint.interface.js +4 -0
- package/dist/Atomic/UI/Hint/Hint.js +247 -204
- package/dist/Atomic/UI/Hint/Hint.scss +4 -2
- package/dist/Atomic/UI/Hint/Hint.stories.js +10 -5
- package/dist/Atomic/UI/Hint/Hint.test.js +96 -0
- package/dist/Atomic/UI/Hint/index.js +3 -2
- package/dist/Atomic/UI/Hint/partials/_utils.js +60 -46
- package/dist/Atomic/UI/Modal/Modal.js +171 -172
- package/dist/Atomic/UI/Modal/Modal.scss +91 -65
- package/dist/Atomic/UI/Modal/Modal.stories.js +1 -1
- package/dist/Atomic/UI/Modal/ModalHOC.js +92 -38
- package/dist/Atomic/UI/Modal/ModalMobile.scss +26 -14
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +68 -18
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +107 -38
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +130 -153
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +118 -62
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.scss +172 -25
- package/dist/Atomic/UI/NavLine/NavLine.js +306 -273
- package/dist/Atomic/UI/NavLine/NavLine.scss +202 -155
- package/dist/Atomic/UI/NavLine/NavLine.test.js +1 -1
- package/dist/Atomic/UI/PageTitle/PageTitle.js +73 -52
- package/dist/Atomic/UI/PageTitle/PageTitle.scss +52 -14
- package/dist/Atomic/UI/PieChart/PieChart.js +105 -42
- package/dist/Atomic/UI/PieChart/PieChart.scss +87 -11
- package/dist/Atomic/UI/Price/Price.js +27 -20
- package/dist/Atomic/UI/PriceRange/PriceRange.js +40 -18
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +92 -73
- package/dist/Atomic/UI/ProgressLine/ProgressLine.scss +66 -52
- package/dist/Atomic/UI/Status/Status.js +62 -51
- package/dist/Atomic/UI/Status/Status.scss +48 -29
- package/dist/Atomic/UI/Table/Partials/TdCell.js +126 -88
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +58 -39
- package/dist/Atomic/UI/Table/Partials/TdRow.js +124 -73
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +113 -45
- package/dist/Atomic/UI/Table/Table.js +61 -43
- package/dist/Atomic/UI/Table/Table.scss +0 -3
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +108 -64
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +44 -31
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +24 -10
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +59 -48
- package/dist/Atomic/UI/Tag/Tag.js +157 -113
- package/dist/Atomic/UI/Tag/Tag.scss +104 -47
- package/dist/Atomic/UI/TagList/TagList.js +223 -179
- package/dist/Atomic/UI/TagList/TagList.scss +13 -9
- package/dist/Atomic/UI/UserBox/UserBox.js +80 -56
- package/dist/Atomic/UI/UserBox/UserBox.scss +45 -21
- package/dist/Atomic/UI/UserBox/UserBox.test.js +2 -2
- package/dist/Atomic/UI/WizardStepper/constructor.js +127 -89
- package/dist/Atomic/UI/WizardStepper/index.js +14 -6
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +53 -51
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.scss +11 -7
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +9 -5
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +84 -67
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.scss +13 -7
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +14 -6
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +50 -45
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.scss +24 -18
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +14 -6
- package/dist/Atomic/UI/WizardStepper/ui/icons.js +138 -106
- package/dist/Atomic/UI/WizardStepper/ui/index.js +14 -6
- package/dist/Classes/AbortableFetch.js +394 -326
- package/dist/Classes/AnimatedHandler.js +31 -44
- package/dist/Classes/RESTAPI/index.js +131 -173
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +399 -334
- package/dist/Classes/RESTAPI/partials/ApiBase.js +30 -30
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +107 -88
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +144 -166
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +180 -204
- package/dist/Classes/RESTAPI/partials/Utils.js +80 -83
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +16 -8
- package/dist/Classes/RESTAPI/partials/_utils.js +139 -125
- package/dist/Constants/index.constants.js +102 -22
- package/dist/Functions/Portal.js +67 -23
- package/dist/Functions/customEventListener.js +48 -50
- package/dist/Functions/dateTime.js +130 -177
- package/dist/Functions/fieldValueFormatters.js +275 -346
- package/dist/Functions/guards/assertions.js +294 -0
- package/dist/Functions/guards/safeValue.js +75 -0
- package/dist/Functions/guards/typeGuards.js +374 -0
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +125 -96
- package/dist/Functions/locale/createTranslator.js +29 -27
- package/dist/Functions/operations.js +129 -102
- package/dist/Functions/presets/inputMaskPresets.js +88 -99
- package/dist/Functions/presets/inputPresets.js +41 -35
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +30 -49
- package/dist/Functions/schemas.js +78 -20
- package/dist/Functions/useBodyScrollLock.js +21 -15
- package/dist/Functions/useClickOutside.js +21 -16
- package/dist/Functions/useDebounce.js +62 -21
- package/dist/Functions/useFieldFocus.js +83 -79
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +39 -46
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +132 -137
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +63 -73
- package/dist/Functions/useFormTools/functions/General.js +117 -129
- package/dist/Functions/useFormTools/functions/RenderFields.js +75 -85
- package/dist/Functions/useFormTools/functions/usePrevious.js +16 -10
- package/dist/Functions/useFormTools/index.js +647 -709
- package/dist/Functions/useInputHighlightError.js +104 -53
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +40 -33
- package/dist/Functions/useKeyPress/useKeyPress.js +48 -39
- package/dist/Functions/useLocalStorage.js +38 -31
- package/dist/Functions/useLocationParams.js +31 -24
- package/dist/Functions/useMediaQuery.js +14 -10
- package/dist/Functions/useMetaInfo.js +45 -35
- package/dist/Functions/useMouseUpOutside.js +21 -15
- package/dist/Functions/useOnlineStatus.js +25 -21
- package/dist/Functions/usePasswordChecker.js +183 -111
- package/dist/Functions/usePrevious.js +16 -10
- package/dist/Functions/useResize.js +32 -28
- package/dist/Functions/useScrollTo.js +26 -16
- package/dist/Functions/useToggle.js +20 -16
- package/dist/Functions/utils.js +493 -469
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +75 -28
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +77 -28
- package/dist/Molecular/CustomIcons/components/AppStore.js +84 -32
- package/dist/Molecular/CustomIcons/components/Arrow.js +93 -38
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +63 -20
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +71 -23
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +71 -23
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +63 -20
- package/dist/Molecular/CustomIcons/components/Bell.js +61 -18
- package/dist/Molecular/CustomIcons/components/Button.js +61 -18
- package/dist/Molecular/CustomIcons/components/Campaigns.js +62 -19
- package/dist/Molecular/CustomIcons/components/Check.js +62 -19
- package/dist/Molecular/CustomIcons/components/Check2.js +61 -18
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +61 -18
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +61 -18
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +61 -18
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +61 -18
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +61 -18
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +81 -33
- package/dist/Molecular/CustomIcons/components/Close.js +64 -20
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +95 -45
- package/dist/Molecular/CustomIcons/components/Delete.js +62 -19
- package/dist/Molecular/CustomIcons/components/Edit.js +61 -18
- package/dist/Molecular/CustomIcons/components/Email.js +87 -36
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +82 -26
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +83 -34
- package/dist/Molecular/CustomIcons/components/Flows.js +61 -18
- package/dist/Molecular/CustomIcons/components/Gift.js +71 -23
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +84 -32
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +84 -32
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +67 -21
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +68 -22
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +67 -21
- package/dist/Molecular/CustomIcons/components/Home.js +67 -21
- package/dist/Molecular/CustomIcons/components/Home2.js +70 -24
- package/dist/Molecular/CustomIcons/components/Key.js +69 -26
- package/dist/Molecular/CustomIcons/components/Landers.js +68 -22
- package/dist/Molecular/CustomIcons/components/Lock.js +61 -18
- package/dist/Molecular/CustomIcons/components/Mail.js +75 -26
- package/dist/Molecular/CustomIcons/components/Mastercard.js +128 -68
- package/dist/Molecular/CustomIcons/components/Minus.js +79 -31
- package/dist/Molecular/CustomIcons/components/Offers.js +62 -19
- package/dist/Molecular/CustomIcons/components/Pause.js +79 -31
- package/dist/Molecular/CustomIcons/components/PayPal.js +96 -45
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +81 -32
- package/dist/Molecular/CustomIcons/components/Phone.js +81 -33
- package/dist/Molecular/CustomIcons/components/Play.js +79 -31
- package/dist/Molecular/CustomIcons/components/Plus.js +79 -31
- package/dist/Molecular/CustomIcons/components/Profile.js +69 -23
- package/dist/Molecular/CustomIcons/components/QRCode.js +85 -33
- package/dist/Molecular/CustomIcons/components/Rectangle.js +61 -18
- package/dist/Molecular/CustomIcons/components/Revert.js +67 -21
- package/dist/Molecular/CustomIcons/components/Star.js +60 -17
- package/dist/Molecular/CustomIcons/components/Star2.js +62 -19
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +68 -21
- package/dist/Molecular/CustomIcons/components/Trash.js +61 -18
- package/dist/Molecular/CustomIcons/components/TrashRed.js +61 -18
- package/dist/Molecular/CustomIcons/components/Triggers.js +61 -18
- package/dist/Molecular/CustomIcons/components/User.js +71 -23
- package/dist/Molecular/CustomIcons/components/Visa.js +88 -34
- package/dist/Molecular/CustomIcons/components/X.js +61 -18
- package/dist/Molecular/CustomIcons/index.js +76 -674
- package/dist/Molecular/FormElement/FormElement.js +44 -41
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +179 -161
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +49 -56
- package/dist/Molecular/InputAddress/InputAddress.js +496 -421
- package/dist/Molecular/InputAddress/InputAddress.scss +12 -14
- package/dist/Molecular/InputPassword/InputPassword.js +99 -47
- package/dist/index.js +11 -8
- package/dist/scss/_mixins.scss +2 -2
- package/dist/scss/_vars.scss +1 -2
- package/dist/scss/main.scss +4 -3
- package/dist/types/declaration/ArrayElement.d.js +4 -0
- package/dist/types/declaration/AsyncReturnType.d.js +4 -0
- package/dist/types/declaration/DeepPartial.d.js +4 -0
- package/dist/types/declaration/DeepReadonly.d.js +4 -0
- package/dist/types/declaration/DeepRequired.d.js +4 -0
- package/dist/types/declaration/Flatten.d.js +4 -0
- package/dist/types/declaration/FunctionType.d.js +4 -0
- package/dist/types/declaration/If.d.js +4 -0
- package/dist/types/declaration/KeysType.d.js +4 -0
- package/dist/types/declaration/NonNullableType.d.js +4 -0
- package/dist/types/declaration/ObjectType.d.js +4 -0
- package/dist/types/declaration/OnlyObjectKeys.d.js +4 -0
- package/dist/types/declaration/PrettyPrint.d.js +31 -0
- package/dist/types/declaration/RequiredFields.d.js +4 -0
- package/dist/types/declaration/TupleType.d.js +4 -0
- package/dist/types/declaration/ValuesType.d.js +4 -0
- package/package.json +18 -21
- package/dist/Atomic/UI/NavLine/Tabs.js +0 -115
- package/dist/Functions/animatingFunctions/getAnimatedHandler.js +0 -1
- package/dist/Functions/useIsMobile.js +0 -26
|
@@ -1,548 +1,657 @@
|
|
|
1
|
+
// eslint-disable-next-line no-unused-vars
|
|
1
2
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
|
|
4
|
+
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _Button = _interopRequireDefault(require("../../../UI/Button/Button"));
|
|
12
|
-
var _Dropdown = _interopRequireDefault(require("../../Dropdown/Dropdown"));
|
|
13
|
-
var _RangeCalendar = _interopRequireDefault(require("../../RangeCalendar/RangeCalendar"));
|
|
14
|
-
var _Switcher = _interopRequireDefault(require("../../Switcher/Switcher"));
|
|
15
|
-
var _dependencies = require("../dependencies");
|
|
16
|
-
var _DateInput = _interopRequireDefault(require("./DateInput"));
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
// eslint-disable-next-line no-unused-vars
|
|
20
|
-
|
|
21
|
-
const outsideScope = {
|
|
22
|
-
handleHoverTimerId: null
|
|
23
|
-
};
|
|
24
|
-
const DATE_INPUT_FORMAT = "MM/DD/YYYY";
|
|
25
|
-
const padTime = time => {
|
|
26
|
-
return `${time.toString().padStart(2, "0")}:00`;
|
|
27
|
-
};
|
|
28
|
-
const Datepicker = props => {
|
|
29
|
-
const {
|
|
30
|
-
txt,
|
|
31
|
-
className,
|
|
32
|
-
buttonsTypes = {},
|
|
33
|
-
values = {},
|
|
34
|
-
onChange,
|
|
35
|
-
onChangeMobile,
|
|
36
|
-
onChangeCompare,
|
|
37
|
-
onCancel,
|
|
38
|
-
getSelectedMode,
|
|
39
|
-
onChangeInterval,
|
|
40
|
-
isCompareHidden,
|
|
41
|
-
limitRange,
|
|
42
|
-
handleItemClick,
|
|
43
|
-
setActiveInterval,
|
|
44
|
-
isShortWeekNames,
|
|
45
|
-
minDate,
|
|
46
|
-
maxDate,
|
|
47
|
-
momentMinDate,
|
|
48
|
-
momentMaxDate,
|
|
49
|
-
isDontLimitFuture,
|
|
50
|
-
testId,
|
|
51
|
-
mainId,
|
|
52
|
-
withMobileLogic
|
|
53
|
-
} = props;
|
|
54
|
-
const {
|
|
55
|
-
start = null,
|
|
56
|
-
end = null,
|
|
57
|
-
compare = false
|
|
58
|
-
} = values;
|
|
59
|
-
const startDateInputRef = (0, _react.useRef)(null);
|
|
60
|
-
const endDateInputRef = (0, _react.useRef)(null);
|
|
61
|
-
const [startDate, setStartDate] = (0, _react.useState)((0, _dependencies.getIsDateValid)(start) ? (0, _momentTimezone.default)(start) : "");
|
|
62
|
-
const [endDate, setEndDate] = (0, _react.useState)((0, _dependencies.getIsDateValid)(end) ? (0, _momentTimezone.default)(end) : "");
|
|
63
|
-
const dateInterval = getSelectedMode({
|
|
64
|
-
start: startDate,
|
|
65
|
-
end: endDate
|
|
66
|
-
});
|
|
67
|
-
const [startDateInput, setStartDateInput] = (0, _react.useState)(null);
|
|
68
|
-
const [endDateInput, setEndDateInput] = (0, _react.useState)(null);
|
|
69
|
-
const [isStartFocused, setIsStartFocused] = (0, _react.useState)(false);
|
|
70
|
-
const [isEndFocused, setIsEndFocused] = (0, _react.useState)(false);
|
|
71
|
-
const [startHour, setStartHour] = (0, _react.useState)(start ? (0, _momentTimezone.default)(start).hour() : 0);
|
|
72
|
-
const [endHour, setEndHour] = (0, _react.useState)(end ? (0, _momentTimezone.default)(end).hour() : 0);
|
|
73
|
-
|
|
74
|
-
// eslint-disable-next-line no-unused-vars
|
|
75
|
-
const [isCompare, setIsCompare] = (0, _react.useState)(compare);
|
|
76
|
-
const [date1, setDate1] = (0, _react.useState)(start ? (0, _momentTimezone.default)(start) : (0, _momentTimezone.default)().subtract(1, "month"));
|
|
77
|
-
const [date2, setDate2] = (0, _react.useState)(end ? (0, _momentTimezone.default)(end) : (0, _momentTimezone.default)());
|
|
78
|
-
const [hoverStatus, setHoverStatus] = (0, _react.useState)(null);
|
|
79
|
-
|
|
80
|
-
// ********************
|
|
81
|
-
// Constants
|
|
82
|
-
// ********************
|
|
83
|
-
|
|
84
|
-
const isNearby = (0, _react.useMemo)(() => (0, _momentTimezone.default)(date2).subtract(1, "month").isSame((0, _momentTimezone.default)(date1), "month"), [date1, date2]);
|
|
85
|
-
const isPreviousPeriodShowed = (0, _react.useMemo)(() => isCompare && !isCompareHidden && startDate && endDate, [startDate, endDate, isCompare]);
|
|
86
|
-
const prevEndHour = (0, _react.useRef)(endHour);
|
|
87
|
-
const startPrevDate = (0, _react.useMemo)(() => {
|
|
88
|
-
if (isPreviousPeriodShowed) {
|
|
89
|
-
const intervalHoursCount = (0, _momentTimezone.default)(endDate).diff(startDate, "hours");
|
|
90
|
-
return (0, _momentTimezone.default)(startDate).subtract(intervalHoursCount, "hours").toDate();
|
|
91
|
-
} else return null;
|
|
92
|
-
}, [startDate, endDate, isCompare]);
|
|
93
|
-
const endPrevDate = (0, _react.useMemo)(() => {
|
|
94
|
-
if (isPreviousPeriodShowed) {
|
|
95
|
-
return startDate;
|
|
96
|
-
} else return null;
|
|
97
|
-
}, [startDate, endDate, isCompare]);
|
|
98
|
-
const title = (0, _react.useMemo)(() => {
|
|
99
|
-
if (isCompare && !isCompareHidden && startDate && endDate) {
|
|
100
|
-
return `${(0, _momentTimezone.default)(startPrevDate).format("ll")} (${(0, _momentTimezone.default)(startPrevDate).format(_dependencies.MAIN_TIME_FORMAT)}) - ${(0, _momentTimezone.default)(endPrevDate).format("ll")} (${(0, _momentTimezone.default)(endPrevDate).format(_dependencies.MAIN_TIME_FORMAT)})`;
|
|
101
|
-
} else return "";
|
|
102
|
-
}, [startDate, endDate, isCompare]);
|
|
103
|
-
|
|
104
|
-
// ********************
|
|
105
|
-
// Methods
|
|
106
|
-
// ********************
|
|
107
|
-
|
|
108
|
-
const subtractDay = date => endHour === 0 ? (0, _momentTimezone.default)(date).subtract(1, "days") : (0, _momentTimezone.default)(date);
|
|
109
|
-
const addDay = date => endHour === 0 ? (0, _momentTimezone.default)(date).add(1, "days") : (0, _momentTimezone.default)(date);
|
|
110
|
-
const getCorrectedDateForDateInput = (key, date) => {
|
|
111
|
-
if (key === "startDateInput") return (0, _momentTimezone.default)(date);
|
|
112
|
-
// return moment(date).subtract(1, 'm');
|
|
113
|
-
return subtractDay((0, _momentTimezone.default)(date));
|
|
114
|
-
};
|
|
115
|
-
const setInterval = () => {
|
|
116
|
-
setActiveInterval((0, _dependencies.getActualDateRange)({
|
|
117
|
-
start: startDate,
|
|
118
|
-
end: endDate
|
|
119
|
-
}).intervalKey);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// ********************
|
|
123
|
-
// Handlers
|
|
124
|
-
// ********************
|
|
125
|
-
|
|
126
|
-
const handleClick = date => {
|
|
127
|
-
prevEndHour.current = 0;
|
|
128
|
-
if (!startDate || startDate && endDate && !((0, _momentTimezone.default)(startDate).add(1, "d").isSame(endDate, "day") && endHour === 0)) {
|
|
129
|
-
setStartDate((0, _momentTimezone.default)(date).startOf("day"));
|
|
130
|
-
setEndDate((0, _momentTimezone.default)(date).add(1, "d").startOf("day"));
|
|
131
|
-
setStartHour(0);
|
|
132
|
-
setEndHour(0);
|
|
133
|
-
} else if ((0, _momentTimezone.default)(date).isBefore((0, _momentTimezone.default)(startDate), "day")) {
|
|
134
|
-
setEndDate((0, _momentTimezone.default)(startDate).add(1, "d").startOf("day"));
|
|
135
|
-
setStartDate((0, _momentTimezone.default)(date).set("hour", parseInt(startHour, 10)));
|
|
136
|
-
} else if ((0, _momentTimezone.default)(date).isAfter((0, _momentTimezone.default)(startDate), "day")) {
|
|
137
|
-
setEndDate((0, _momentTimezone.default)(date).add(1, "d").startOf("day"));
|
|
138
|
-
}
|
|
139
|
-
setHoverStatus(null);
|
|
140
|
-
};
|
|
141
|
-
const handleHover = date => {
|
|
142
|
-
if (outsideScope.handleHoverTimerId) clearTimeout(outsideScope.handleHoverTimerId);
|
|
143
|
-
if (!date) {
|
|
144
|
-
outsideScope.handleHoverTimerId = setTimeout(() => {
|
|
145
|
-
setHoverStatus(null);
|
|
146
|
-
}, 400);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if ((0, _momentTimezone.default)(startDate).add(1, "d").isSame(endDate, "day") && endHour === 0) {
|
|
150
|
-
if ((0, _momentTimezone.default)(date).isAfter((0, _momentTimezone.default)(startDate), "day")) setHoverStatus("end");else if ((0, _momentTimezone.default)(date).isBefore((0, _momentTimezone.default)(startDate), "day")) setHoverStatus("start");else setHoverStatus(null);
|
|
151
|
-
} else {
|
|
152
|
-
setHoverStatus("start");
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const handleChangeStartHour = val => {
|
|
156
|
-
setStartHour(Number(val));
|
|
157
|
-
setStartDate((0, _momentTimezone.default)(startDate || (0, _momentTimezone.default)()).set("hour", Number(val)));
|
|
158
|
-
};
|
|
159
|
-
const handleChangeEndHour = val => {
|
|
160
|
-
const newHour = Number(val);
|
|
161
|
-
setEndHour(newHour);
|
|
162
|
-
let newEndDate = (0, _momentTimezone.default)();
|
|
163
|
-
if (endDate) {
|
|
164
|
-
if (prevEndHour.current === 0 && newHour !== 0) {
|
|
165
|
-
newEndDate = (0, _momentTimezone.default)(endDate).subtract(1, "days");
|
|
166
|
-
} else if (prevEndHour.current !== 0 && newHour === 0) {
|
|
167
|
-
newEndDate = (0, _momentTimezone.default)(endDate).add(1, "days");
|
|
168
|
-
}
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return _default;
|
|
169
10
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// newDate = moment(startDate);
|
|
185
|
-
// } else {
|
|
186
|
-
// if (minDate && moment(startDateInput).isBefore(minDate)) newDate = momentMinDate;
|
|
187
|
-
// else if (!isDontLimitFuture) {
|
|
188
|
-
// const edge = maxDate ? momentMaxDate : moment().add(1, 'day').startOf('day');
|
|
189
|
-
// if (moment(startDateInput).isAfter(edge)) newDate = edge;
|
|
190
|
-
// else newDate = moment(startDateInput);
|
|
191
|
-
// } else newDate = moment(startDateInput);
|
|
192
|
-
// }
|
|
193
|
-
|
|
194
|
-
// setStartDateInput(newDate.format(format));
|
|
195
|
-
// setStartDate(newDate.set('hour', parseInt(startHour, 10)).toDate());
|
|
196
|
-
|
|
197
|
-
// doBlur('start', e);
|
|
198
|
-
// setDate1(
|
|
199
|
-
// moment(newDate).isSameOrAfter(moment(date2), 'month') ? moment(date2).subtract(1, 'month') : moment(newDate),
|
|
200
|
-
// );
|
|
201
|
-
// };
|
|
202
|
-
|
|
203
|
-
// const handleEndDateBlur = e => {
|
|
204
|
-
// let newDate;
|
|
205
|
-
|
|
206
|
-
// if (!moment(endDateInput).isValid()) {
|
|
207
|
-
// newDate = moment(endDate);
|
|
208
|
-
// } else {
|
|
209
|
-
// if (minDate && moment(endDateInput).isBefore(minDate)) newDate = momentMinDate;
|
|
210
|
-
// else if (!isDontLimitFuture) {
|
|
211
|
-
// const edge = maxDate ? momentMaxDate : moment().endOf('day');
|
|
212
|
-
// if (moment(endDateInput).isAfter(edge)) newDate = maxDate ? edge : edge.startOf('day');
|
|
213
|
-
// else newDate = moment(startDateInput);
|
|
214
|
-
// } else newDate = moment(startDateInput);
|
|
215
|
-
// }
|
|
216
|
-
|
|
217
|
-
// setEndDate(addDay(newDate.set('hour', parseInt(endHour, 10)).toDate()));
|
|
218
|
-
// setEndDateInput(newDate.format(format));
|
|
219
|
-
|
|
220
|
-
// doBlur('end', e);
|
|
221
|
-
// setDate2(newDate);
|
|
222
|
-
// };
|
|
223
|
-
|
|
224
|
-
const handleDateInputFocus = (key, e) => {
|
|
225
|
-
const changeFlag = key === "startDateInput" ? setIsStartFocused : setIsEndFocused;
|
|
226
|
-
const set = key === "startDateInput" ? setStartDateInput : setEndDateInput;
|
|
227
|
-
const date = key === "startDateInput" ? startDate : endDate;
|
|
228
|
-
changeFlag(true);
|
|
229
|
-
set(date ? getCorrectedDateForDateInput(key, date).format("L") : "");
|
|
230
|
-
setTimeout(() => {
|
|
231
|
-
const defaultTarget = key === "startDateInput" ? startDateInputRef.current : endDateInputRef.current;
|
|
232
|
-
const target = e?.target ?? defaultTarget;
|
|
233
|
-
target.select();
|
|
234
|
-
|
|
235
|
-
//? Для инпут-маск, почему-то нужно пропустить 2 эвентлупа
|
|
236
|
-
// setTimeout(() => {
|
|
237
|
-
// target.select();
|
|
238
|
-
// }, 0);
|
|
239
|
-
}, 0);
|
|
240
|
-
};
|
|
241
|
-
const doBlur = (type, e) => {
|
|
242
|
-
const executor = type === "startDateInput" ? setIsStartFocused : setIsEndFocused;
|
|
243
|
-
e.target.blur();
|
|
244
|
-
executor(false);
|
|
245
|
-
};
|
|
246
|
-
const processOverflow = (newDateAsString, valueForRollback, key) => {
|
|
247
|
-
const newDateAsMomentObj = (0, _momentTimezone.default)(newDateAsString, DATE_INPUT_FORMAT);
|
|
248
|
-
|
|
249
|
-
// console.log('processOverflow - newDateAsString - ', newDateAsString);
|
|
250
|
-
// console.log('processOverflow - valueForRollback - ', valueForRollback);
|
|
251
|
-
// console.log('----------');
|
|
252
|
-
// console.log('processOverflow - minDate - ', minDate);
|
|
253
|
-
// console.log('processOverflow - maxDate - ', maxDate);
|
|
254
|
-
// console.log('----------');
|
|
255
|
-
// console.log('processOverflow - momentMinDate - ', momentMinDate);
|
|
256
|
-
// console.log('processOverflow - momentMaxDate - ', momentMaxDate);
|
|
257
|
-
// console.log('----------');
|
|
258
|
-
// console.log('processOverflow - newDateAsMomentObj - ', newDateAsMomentObj);
|
|
259
|
-
// console.log('*********');
|
|
260
|
-
|
|
261
|
-
//? Если значение не валидно...
|
|
262
|
-
if (!newDateAsMomentObj.isValid()) {
|
|
263
|
-
//? ... то откатываем к дате до набора руками
|
|
264
|
-
return valueForRollback;
|
|
265
|
-
} else {
|
|
266
|
-
const beforeOfFuture = (0, _momentTimezone.default)().endOf("day");
|
|
267
|
-
const hour = key === "startDateInput" ? startHour : endHour;
|
|
268
|
-
let output;
|
|
269
|
-
|
|
270
|
-
//? Если есть минимальная дата и введенная меньше минимальной, то ставим минимальную
|
|
271
|
-
if (minDate && newDateAsMomentObj.isBefore(momentMinDate)) output = momentMinDate;
|
|
272
|
-
//? Если есть максимальная дата и введенная больше максимальной, то ставим максимальную
|
|
273
|
-
else if (maxDate && newDateAsMomentObj.isAfter(momentMaxDate)) output = momentMaxDate;
|
|
274
|
-
//? Если нет установки не ограничивать дату по будущему...
|
|
275
|
-
else if (!isDontLimitFuture && newDateAsMomentObj.isAfter(beforeOfFuture)) {
|
|
276
|
-
output = beforeOfFuture.startOf("day");
|
|
277
|
-
} else output = newDateAsMomentObj;
|
|
278
|
-
|
|
279
|
-
// if (key === 'startDateInput') {
|
|
280
|
-
// console.log('endDate - ', endDate.format('YYYY-MM-DDTHH:mm'));
|
|
281
|
-
// console.log('endDate.subtract(1, d) - ', endDate.subtract(1, 'd').format('YYYY-MM-DDTHH:mm'));
|
|
282
|
-
// if (output.isAfter(endDate.subtract(1, 'd'))) output = endDate.subtract(1, 'd');
|
|
283
|
-
// }
|
|
284
|
-
|
|
285
|
-
if (key === "endDateInput") {
|
|
286
|
-
// console.log('startDate - ', startDate.format('YYYY-MM-DDTHH:mm'));
|
|
287
|
-
// if (output.isBefore(startDate)) output = startDate.add(1, 'd');
|
|
288
|
-
output = addDay(output);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// console.log('output - ', output.format('YYYY-MM-DDTHH:mm'));
|
|
292
|
-
// console.log('************');
|
|
293
|
-
|
|
294
|
-
return output.set("hour", parseInt(hour, 10));
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
const handleDateInputBlur = (key, e) => {
|
|
298
|
-
const reserveValue = key === "startDateInput" ? startDateInput : endDateInput;
|
|
299
|
-
const valueForRollback = key === "startDateInput" ? startDate : endDate;
|
|
300
|
-
const execute = key === "startDateInput" ? setStartDate : setEndDate;
|
|
301
|
-
const executeForCalendar = key === "startDateInput" ? setDate1 : setDate2;
|
|
302
|
-
const prepareValueForCalendar = newDate => {
|
|
303
|
-
if (key === "endDateInput") return newDate;
|
|
304
|
-
return (0, _momentTimezone.default)(newDate).isSameOrAfter((0, _momentTimezone.default)(date2), "month") ? (0, _momentTimezone.default)(date2).subtract(1, "month") : (0, _momentTimezone.default)(newDate);
|
|
11
|
+
});
|
|
12
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
13
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
14
|
+
const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
|
|
15
|
+
const _momenttimezone = /*#__PURE__*/ _interop_require_default(require("moment-timezone"));
|
|
16
|
+
const _Button = /*#__PURE__*/ _interop_require_default(require("../../../UI/Button/Button"));
|
|
17
|
+
const _Dropdown = /*#__PURE__*/ _interop_require_default(require("../../Dropdown/Dropdown"));
|
|
18
|
+
const _RangeCalendar = /*#__PURE__*/ _interop_require_default(require("../../RangeCalendar/RangeCalendar"));
|
|
19
|
+
const _Switcher = /*#__PURE__*/ _interop_require_default(require("../../Switcher/Switcher"));
|
|
20
|
+
const _dependencies = require("../dependencies");
|
|
21
|
+
const _DateInput = /*#__PURE__*/ _interop_require_default(require("./DateInput"));
|
|
22
|
+
function _interop_require_default(obj) {
|
|
23
|
+
return obj && obj.__esModule ? obj : {
|
|
24
|
+
default: obj
|
|
305
25
|
};
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
// Render Functions
|
|
319
|
-
// ********************
|
|
320
|
-
|
|
321
|
-
const getStartHourItems = () => [...Array(24).keys()].map(hour => ({
|
|
322
|
-
label: padTime(hour),
|
|
323
|
-
value: hour,
|
|
324
|
-
disabled: (0, _momentTimezone.default)(startDate).isSame(endDate, "day") && endHour <= hour
|
|
325
|
-
}));
|
|
326
|
-
const getEndHourItems = () => [...Array(24).keys()].map(hour => ({
|
|
327
|
-
label: padTime(hour + 1),
|
|
328
|
-
value: hour === 23 ? 0 : hour + 1,
|
|
329
|
-
disabled: ((0, _momentTimezone.default)(startDate).isSame(endDate, "day") || (0, _momentTimezone.default)(startDate).isSame((0, _momentTimezone.default)(endDate).subtract(1, "days"), "day") && endHour === 0) && hour < startHour
|
|
330
|
-
}));
|
|
331
|
-
const renderButtons = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
332
|
-
className: "date-picker__button",
|
|
333
|
-
onClick: () => onCancel(),
|
|
334
|
-
variant: buttonsTypes?.cancel
|
|
335
|
-
}, txt?.buttons?.cancel || "Cancel"), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
336
|
-
className: "date-picker__button",
|
|
337
|
-
variant: buttonsTypes?.apply,
|
|
338
|
-
disabled: !startDate || !endDate,
|
|
339
|
-
onClick: () => onChange({
|
|
340
|
-
start: (0, _momentTimezone.default)(startDate).format(_dependencies.MAIN_FORMAT),
|
|
341
|
-
end: (0, _momentTimezone.default)(endDate).format(_dependencies.MAIN_FORMAT),
|
|
342
|
-
startPrevDate: (0, _momentTimezone.default)(startPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
343
|
-
endPrevDate: (0, _momentTimezone.default)(endPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
344
|
-
compare: isCompare
|
|
345
|
-
})
|
|
346
|
-
}, txt?.buttons?.apply || "apply"));
|
|
347
|
-
const renderPreviousPeriod = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, txt?.labels?.previousPeriod || "", ":", " ", /*#__PURE__*/_react.default.createElement("span", {
|
|
348
|
-
className: "date-picker__previous-period-interval"
|
|
349
|
-
}, title));
|
|
350
|
-
|
|
351
|
-
// ********************
|
|
352
|
-
// useEffects
|
|
353
|
-
// ********************
|
|
354
|
-
|
|
355
|
-
(0, _react.useEffect)(() => {
|
|
356
|
-
if ((0, _momentTimezone.default)(startDate).isSameOrAfter(endDate)) {
|
|
357
|
-
setStartDate((0, _momentTimezone.default)(endDate).subtract(1, "d"));
|
|
358
|
-
setDate1((0, _momentTimezone.default)(endDate).subtract(1, "d"));
|
|
26
|
+
}
|
|
27
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
28
|
+
if (typeof WeakMap !== "function") return null;
|
|
29
|
+
var cacheBabelInterop = new WeakMap();
|
|
30
|
+
var cacheNodeInterop = new WeakMap();
|
|
31
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
32
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
33
|
+
})(nodeInterop);
|
|
34
|
+
}
|
|
35
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
36
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
37
|
+
return obj;
|
|
359
38
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
setDate2((0, _momentTimezone.default)(startDate).add(1, "d"));
|
|
39
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
40
|
+
return {
|
|
41
|
+
default: obj
|
|
42
|
+
};
|
|
365
43
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
setDate1((0, _momentTimezone.default)(startDate));
|
|
370
|
-
setDate2((0, _momentTimezone.default)(endDate));
|
|
44
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
45
|
+
if (cache && cache.has(obj)) {
|
|
46
|
+
return cache.get(obj);
|
|
371
47
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
48
|
+
var newObj = {
|
|
49
|
+
__proto__: null
|
|
50
|
+
};
|
|
51
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
|
+
for(var key in obj){
|
|
53
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
54
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
55
|
+
if (desc && (desc.get || desc.set)) {
|
|
56
|
+
Object.defineProperty(newObj, key, desc);
|
|
57
|
+
} else {
|
|
58
|
+
newObj[key] = obj[key];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
377
61
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}, [dateInterval]);
|
|
382
|
-
(0, _react.useEffect)(() => {
|
|
383
|
-
if (typeof onChangeMobile === "function") {
|
|
384
|
-
onChangeMobile({
|
|
385
|
-
start: (0, _momentTimezone.default)(startDate).format(_dependencies.MAIN_FORMAT),
|
|
386
|
-
end: (0, _momentTimezone.default)(endDate).format(_dependencies.MAIN_FORMAT),
|
|
387
|
-
startPrevDate: (0, _momentTimezone.default)(startPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
388
|
-
endPrevDate: (0, _momentTimezone.default)(endPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
389
|
-
compare: isCompare
|
|
390
|
-
});
|
|
62
|
+
newObj.default = obj;
|
|
63
|
+
if (cache) {
|
|
64
|
+
cache.set(obj, newObj);
|
|
391
65
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
id: `datepicker-id-${mainId}_start-hour-select-input`,
|
|
412
|
-
dataTest: "datepicker_start-hour-select-input",
|
|
413
|
-
className: (0, _classnames.default)("date-picker__hour-select-input"),
|
|
414
|
-
onChange: value => handleChangeStartHour(value),
|
|
415
|
-
value: startHour,
|
|
416
|
-
options: getStartHourItems(),
|
|
417
|
-
disabled: !startDate,
|
|
418
|
-
isDoNotPullOutListOfMainContainer: true,
|
|
419
|
-
short: true,
|
|
420
|
-
withMobileLogic: withMobileLogic
|
|
421
|
-
}));
|
|
422
|
-
};
|
|
423
|
-
const renderRowEnd = () => {
|
|
424
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
425
|
-
className: "date-picker__date-row"
|
|
426
|
-
}, /*#__PURE__*/_react.default.createElement(_DateInput.default, {
|
|
427
|
-
ref: endDateInputRef,
|
|
428
|
-
testId: `datepicker-${testId}_start-date-input`,
|
|
429
|
-
RC: "date-picker__date-input",
|
|
430
|
-
className: (0, _classnames.default)("date-picker__date-input"),
|
|
431
|
-
isFocused: isEndFocused,
|
|
432
|
-
value: endDateInput,
|
|
433
|
-
date: getCorrectedDateForDateInput("endDateInput", endDate),
|
|
434
|
-
disabled: !endDate,
|
|
435
|
-
onChange: setEndDateInput,
|
|
436
|
-
onFocus: e => handleDateInputFocus("endDateInput", e),
|
|
437
|
-
onBlur: e => handleDateInputBlur("endDateInput", e),
|
|
438
|
-
onKeyUp: (code, e) => handleKeyPressed(code, e, "endDateInput")
|
|
439
|
-
}), /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
440
|
-
testId: testId,
|
|
441
|
-
id: `datepicker-id-${mainId}_end-hour-select-input`,
|
|
442
|
-
dataTest: "datepicker_end-hour-select-input",
|
|
443
|
-
className: (0, _classnames.default)("date-picker__hour-select-input"),
|
|
444
|
-
onChange: value => handleChangeEndHour(value),
|
|
445
|
-
value: endHour,
|
|
446
|
-
options: getEndHourItems(),
|
|
447
|
-
disabled: !endDate,
|
|
448
|
-
isDoNotPullOutListOfMainContainer: true,
|
|
449
|
-
short: true,
|
|
450
|
-
withMobileLogic: withMobileLogic
|
|
451
|
-
}));
|
|
452
|
-
};
|
|
453
|
-
const renderCalendarStart = () => {
|
|
454
|
-
return /*#__PURE__*/_react.default.createElement(_RangeCalendar.default, {
|
|
455
|
-
testId: testId,
|
|
456
|
-
className: "date-picker__calendar",
|
|
457
|
-
date: date1,
|
|
458
|
-
setDate: setDate1,
|
|
459
|
-
allowNext: withMobileLogic ? !(0, _momentTimezone.default)(date1).startOf("month").isSameOrAfter((0, _momentTimezone.default)().startOf("day"), "months") : !isNearby,
|
|
460
|
-
startDate: startDate,
|
|
461
|
-
endDate: endDate,
|
|
462
|
-
startPrevDate: startPrevDate,
|
|
463
|
-
endPrevDate: endPrevDate,
|
|
464
|
-
onClick: handleClick,
|
|
465
|
-
onHover: handleHover,
|
|
466
|
-
limitRange: limitRange,
|
|
467
|
-
isShortWeekNames: isShortWeekNames,
|
|
468
|
-
minDate: minDate,
|
|
469
|
-
maxDate: maxDate,
|
|
470
|
-
momentMinDate: momentMinDate,
|
|
471
|
-
momentMaxDate: momentMaxDate
|
|
472
|
-
});
|
|
473
|
-
};
|
|
474
|
-
const renderCalendarEnd = () => {
|
|
475
|
-
return /*#__PURE__*/_react.default.createElement(_RangeCalendar.default, {
|
|
476
|
-
className: "date-picker__calendar",
|
|
477
|
-
date: date2,
|
|
478
|
-
setDate: setDate2,
|
|
479
|
-
allowPrev: !isNearby,
|
|
480
|
-
startDate: startDate,
|
|
481
|
-
endDate: endDate,
|
|
482
|
-
startPrevDate: startPrevDate,
|
|
483
|
-
endPrevDate: endPrevDate,
|
|
484
|
-
onClick: handleClick,
|
|
485
|
-
onHover: handleHover,
|
|
486
|
-
isShortWeekNames: isShortWeekNames,
|
|
487
|
-
minDate: minDate,
|
|
488
|
-
maxDate: maxDate,
|
|
489
|
-
momentMinDate: momentMinDate,
|
|
490
|
-
momentMaxDate: momentMaxDate,
|
|
491
|
-
isDontLimitFuture: isDontLimitFuture
|
|
66
|
+
return newObj;
|
|
67
|
+
}
|
|
68
|
+
const outsideScope = {
|
|
69
|
+
handleHoverTimerId: null
|
|
70
|
+
};
|
|
71
|
+
const DATE_INPUT_FORMAT = "MM/DD/YYYY";
|
|
72
|
+
const padTime = (time)=>{
|
|
73
|
+
return `${time.toString().padStart(2, "0")}:00`;
|
|
74
|
+
};
|
|
75
|
+
const Datepicker = (props)=>{
|
|
76
|
+
const { txt, className, buttonsTypes = {}, values = {}, onChange, onChangeMobile, onChangeCompare, onCancel, getSelectedMode, onChangeInterval, isCompareHidden, limitRange, handleItemClick, setActiveInterval, isShortWeekNames, minDate, maxDate, momentMinDate, momentMaxDate, isDontLimitFuture, testId, mainId, withMobileLogic } = props;
|
|
77
|
+
const { start = null, end = null, compare = false } = values;
|
|
78
|
+
const startDateInputRef = (0, _react.useRef)(null);
|
|
79
|
+
const endDateInputRef = (0, _react.useRef)(null);
|
|
80
|
+
const [startDate, setStartDate] = (0, _react.useState)((0, _dependencies.getIsDateValid)(start) ? (0, _momenttimezone.default)(start) : "");
|
|
81
|
+
const [endDate, setEndDate] = (0, _react.useState)((0, _dependencies.getIsDateValid)(end) ? (0, _momenttimezone.default)(end) : "");
|
|
82
|
+
const dateInterval = getSelectedMode({
|
|
83
|
+
start: startDate,
|
|
84
|
+
end: endDate
|
|
492
85
|
});
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
},
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
86
|
+
const [startDateInput, setStartDateInput] = (0, _react.useState)(null);
|
|
87
|
+
const [endDateInput, setEndDateInput] = (0, _react.useState)(null);
|
|
88
|
+
const [isStartFocused, setIsStartFocused] = (0, _react.useState)(false);
|
|
89
|
+
const [isEndFocused, setIsEndFocused] = (0, _react.useState)(false);
|
|
90
|
+
const [startHour, setStartHour] = (0, _react.useState)(start ? (0, _momenttimezone.default)(start).hour() : 0);
|
|
91
|
+
const [endHour, setEndHour] = (0, _react.useState)(end ? (0, _momenttimezone.default)(end).hour() : 0);
|
|
92
|
+
// eslint-disable-next-line no-unused-vars
|
|
93
|
+
const [isCompare, setIsCompare] = (0, _react.useState)(compare);
|
|
94
|
+
const [date1, setDate1] = (0, _react.useState)(start ? (0, _momenttimezone.default)(start) : (0, _momenttimezone.default)().subtract(1, "month"));
|
|
95
|
+
const [date2, setDate2] = (0, _react.useState)(end ? (0, _momenttimezone.default)(end) : (0, _momenttimezone.default)());
|
|
96
|
+
const [hoverStatus, setHoverStatus] = (0, _react.useState)(null);
|
|
97
|
+
// ********************
|
|
98
|
+
// Constants
|
|
99
|
+
// ********************
|
|
100
|
+
const isNearby = (0, _react.useMemo)(()=>(0, _momenttimezone.default)(date2).subtract(1, "month").isSame((0, _momenttimezone.default)(date1), "month"), [
|
|
101
|
+
date1,
|
|
102
|
+
date2
|
|
103
|
+
]);
|
|
104
|
+
const isPreviousPeriodShowed = (0, _react.useMemo)(()=>isCompare && !isCompareHidden && startDate && endDate, [
|
|
105
|
+
startDate,
|
|
106
|
+
endDate,
|
|
107
|
+
isCompare
|
|
108
|
+
]);
|
|
109
|
+
const prevEndHour = (0, _react.useRef)(endHour);
|
|
110
|
+
const startPrevDate = (0, _react.useMemo)(()=>{
|
|
111
|
+
if (isPreviousPeriodShowed) {
|
|
112
|
+
const intervalHoursCount = (0, _momenttimezone.default)(endDate).diff(startDate, "hours");
|
|
113
|
+
return (0, _momenttimezone.default)(startDate).subtract(intervalHoursCount, "hours").toDate();
|
|
114
|
+
} else return null;
|
|
115
|
+
}, [
|
|
116
|
+
startDate,
|
|
117
|
+
endDate,
|
|
118
|
+
isCompare
|
|
119
|
+
]);
|
|
120
|
+
const endPrevDate = (0, _react.useMemo)(()=>{
|
|
121
|
+
if (isPreviousPeriodShowed) {
|
|
122
|
+
return startDate;
|
|
123
|
+
} else return null;
|
|
124
|
+
}, [
|
|
125
|
+
startDate,
|
|
126
|
+
endDate,
|
|
127
|
+
isCompare
|
|
128
|
+
]);
|
|
129
|
+
const title = (0, _react.useMemo)(()=>{
|
|
130
|
+
if (isCompare && !isCompareHidden && startDate && endDate) {
|
|
131
|
+
return `${(0, _momenttimezone.default)(startPrevDate).format("ll")} (${(0, _momenttimezone.default)(startPrevDate).format(_dependencies.MAIN_TIME_FORMAT)}) - ${(0, _momenttimezone.default)(endPrevDate).format("ll")} (${(0, _momenttimezone.default)(endPrevDate).format(_dependencies.MAIN_TIME_FORMAT)})`;
|
|
132
|
+
} else return "";
|
|
133
|
+
}, [
|
|
134
|
+
startDate,
|
|
135
|
+
endDate,
|
|
136
|
+
isCompare
|
|
137
|
+
]);
|
|
138
|
+
// ********************
|
|
139
|
+
// Methods
|
|
140
|
+
// ********************
|
|
141
|
+
const subtractDay = (date)=>endHour === 0 ? (0, _momenttimezone.default)(date).subtract(1, "days") : (0, _momenttimezone.default)(date);
|
|
142
|
+
const addDay = (date)=>endHour === 0 ? (0, _momenttimezone.default)(date).add(1, "days") : (0, _momenttimezone.default)(date);
|
|
143
|
+
const getCorrectedDateForDateInput = (key, date)=>{
|
|
144
|
+
if (key === "startDateInput") return (0, _momenttimezone.default)(date);
|
|
145
|
+
// return moment(date).subtract(1, 'm');
|
|
146
|
+
return subtractDay((0, _momenttimezone.default)(date));
|
|
147
|
+
};
|
|
148
|
+
const setInterval = ()=>{
|
|
149
|
+
setActiveInterval((0, _dependencies.getActualDateRange)({
|
|
150
|
+
start: startDate,
|
|
151
|
+
end: endDate
|
|
152
|
+
}).intervalKey);
|
|
153
|
+
};
|
|
154
|
+
// ********************
|
|
155
|
+
// Handlers
|
|
156
|
+
// ********************
|
|
157
|
+
const handleClick = (date)=>{
|
|
158
|
+
prevEndHour.current = 0;
|
|
159
|
+
if (!startDate || startDate && endDate && !((0, _momenttimezone.default)(startDate).add(1, "d").isSame(endDate, "day") && endHour === 0)) {
|
|
160
|
+
setStartDate((0, _momenttimezone.default)(date).startOf("day"));
|
|
161
|
+
setEndDate((0, _momenttimezone.default)(date).add(1, "d").startOf("day"));
|
|
162
|
+
setStartHour(0);
|
|
163
|
+
setEndHour(0);
|
|
164
|
+
} else if ((0, _momenttimezone.default)(date).isBefore((0, _momenttimezone.default)(startDate), "day")) {
|
|
165
|
+
setEndDate((0, _momenttimezone.default)(startDate).add(1, "d").startOf("day"));
|
|
166
|
+
setStartDate((0, _momenttimezone.default)(date).set("hour", parseInt(startHour, 10)));
|
|
167
|
+
} else if ((0, _momenttimezone.default)(date).isAfter((0, _momenttimezone.default)(startDate), "day")) {
|
|
168
|
+
setEndDate((0, _momenttimezone.default)(date).add(1, "d").startOf("day"));
|
|
169
|
+
}
|
|
170
|
+
setHoverStatus(null);
|
|
171
|
+
};
|
|
172
|
+
const handleHover = (date)=>{
|
|
173
|
+
if (outsideScope.handleHoverTimerId) clearTimeout(outsideScope.handleHoverTimerId);
|
|
174
|
+
if (!date) {
|
|
175
|
+
outsideScope.handleHoverTimerId = setTimeout(()=>{
|
|
176
|
+
setHoverStatus(null);
|
|
177
|
+
}, 400);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if ((0, _momenttimezone.default)(startDate).add(1, "d").isSame(endDate, "day") && endHour === 0) {
|
|
181
|
+
if ((0, _momenttimezone.default)(date).isAfter((0, _momenttimezone.default)(startDate), "day")) setHoverStatus("end");
|
|
182
|
+
else if ((0, _momenttimezone.default)(date).isBefore((0, _momenttimezone.default)(startDate), "day")) setHoverStatus("start");
|
|
183
|
+
else setHoverStatus(null);
|
|
184
|
+
} else {
|
|
185
|
+
setHoverStatus("start");
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const handleChangeStartHour = (val)=>{
|
|
189
|
+
setStartHour(Number(val));
|
|
190
|
+
setStartDate((0, _momenttimezone.default)(startDate || (0, _momenttimezone.default)()).set("hour", Number(val)));
|
|
191
|
+
};
|
|
192
|
+
const handleChangeEndHour = (val)=>{
|
|
193
|
+
const newHour = Number(val);
|
|
194
|
+
setEndHour(newHour);
|
|
195
|
+
let newEndDate = (0, _momenttimezone.default)();
|
|
196
|
+
if (endDate) {
|
|
197
|
+
if (prevEndHour.current === 0 && newHour !== 0) {
|
|
198
|
+
newEndDate = (0, _momenttimezone.default)(endDate).subtract(1, "days");
|
|
199
|
+
} else if (prevEndHour.current !== 0 && newHour === 0) {
|
|
200
|
+
newEndDate = (0, _momenttimezone.default)(endDate).add(1, "days");
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
prevEndHour.current = newHour;
|
|
204
|
+
setEndDate((0, _momenttimezone.default)(newEndDate).set("hour", newHour));
|
|
205
|
+
};
|
|
206
|
+
// const doBlur = (type, e) => {
|
|
207
|
+
// const executor = type === 'start' ? setIsStartFocused : setIsEndFocused;
|
|
208
|
+
// e.target.blur();
|
|
209
|
+
// executor(false);
|
|
210
|
+
// };
|
|
211
|
+
// const handleStartDateBlur = e => {
|
|
212
|
+
// let newDate;
|
|
213
|
+
// if (!moment(startDateInput).isValid()) {
|
|
214
|
+
// newDate = moment(startDate);
|
|
215
|
+
// } else {
|
|
216
|
+
// if (minDate && moment(startDateInput).isBefore(minDate)) newDate = momentMinDate;
|
|
217
|
+
// else if (!isDontLimitFuture) {
|
|
218
|
+
// const edge = maxDate ? momentMaxDate : moment().add(1, 'day').startOf('day');
|
|
219
|
+
// if (moment(startDateInput).isAfter(edge)) newDate = edge;
|
|
220
|
+
// else newDate = moment(startDateInput);
|
|
221
|
+
// } else newDate = moment(startDateInput);
|
|
222
|
+
// }
|
|
223
|
+
// setStartDateInput(newDate.format(format));
|
|
224
|
+
// setStartDate(newDate.set('hour', parseInt(startHour, 10)).toDate());
|
|
225
|
+
// doBlur('start', e);
|
|
226
|
+
// setDate1(
|
|
227
|
+
// moment(newDate).isSameOrAfter(moment(date2), 'month') ? moment(date2).subtract(1, 'month') : moment(newDate),
|
|
228
|
+
// );
|
|
229
|
+
// };
|
|
230
|
+
// const handleEndDateBlur = e => {
|
|
231
|
+
// let newDate;
|
|
232
|
+
// if (!moment(endDateInput).isValid()) {
|
|
233
|
+
// newDate = moment(endDate);
|
|
234
|
+
// } else {
|
|
235
|
+
// if (minDate && moment(endDateInput).isBefore(minDate)) newDate = momentMinDate;
|
|
236
|
+
// else if (!isDontLimitFuture) {
|
|
237
|
+
// const edge = maxDate ? momentMaxDate : moment().endOf('day');
|
|
238
|
+
// if (moment(endDateInput).isAfter(edge)) newDate = maxDate ? edge : edge.startOf('day');
|
|
239
|
+
// else newDate = moment(startDateInput);
|
|
240
|
+
// } else newDate = moment(startDateInput);
|
|
241
|
+
// }
|
|
242
|
+
// setEndDate(addDay(newDate.set('hour', parseInt(endHour, 10)).toDate()));
|
|
243
|
+
// setEndDateInput(newDate.format(format));
|
|
244
|
+
// doBlur('end', e);
|
|
245
|
+
// setDate2(newDate);
|
|
246
|
+
// };
|
|
247
|
+
const handleDateInputFocus = (key, e)=>{
|
|
248
|
+
const changeFlag = key === "startDateInput" ? setIsStartFocused : setIsEndFocused;
|
|
249
|
+
const set = key === "startDateInput" ? setStartDateInput : setEndDateInput;
|
|
250
|
+
const date = key === "startDateInput" ? startDate : endDate;
|
|
251
|
+
changeFlag(true);
|
|
252
|
+
set(date ? getCorrectedDateForDateInput(key, date).format("L") : "");
|
|
253
|
+
setTimeout(()=>{
|
|
254
|
+
const defaultTarget = key === "startDateInput" ? startDateInputRef.current : endDateInputRef.current;
|
|
255
|
+
var _e_target;
|
|
256
|
+
const target = (_e_target = e === null || e === void 0 ? void 0 : e.target) !== null && _e_target !== void 0 ? _e_target : defaultTarget;
|
|
257
|
+
target.select();
|
|
258
|
+
//? Для инпут-маск, почему-то нужно пропустить 2 эвентлупа
|
|
259
|
+
// setTimeout(() => {
|
|
260
|
+
// target.select();
|
|
261
|
+
// }, 0);
|
|
262
|
+
}, 0);
|
|
263
|
+
};
|
|
264
|
+
const doBlur = (type, e)=>{
|
|
265
|
+
const executor = type === "startDateInput" ? setIsStartFocused : setIsEndFocused;
|
|
266
|
+
e.target.blur();
|
|
267
|
+
executor(false);
|
|
268
|
+
};
|
|
269
|
+
const processOverflow = (newDateAsString, valueForRollback, key)=>{
|
|
270
|
+
const newDateAsMomentObj = (0, _momenttimezone.default)(newDateAsString, DATE_INPUT_FORMAT);
|
|
271
|
+
// console.log('processOverflow - newDateAsString - ', newDateAsString);
|
|
272
|
+
// console.log('processOverflow - valueForRollback - ', valueForRollback);
|
|
273
|
+
// console.log('----------');
|
|
274
|
+
// console.log('processOverflow - minDate - ', minDate);
|
|
275
|
+
// console.log('processOverflow - maxDate - ', maxDate);
|
|
276
|
+
// console.log('----------');
|
|
277
|
+
// console.log('processOverflow - momentMinDate - ', momentMinDate);
|
|
278
|
+
// console.log('processOverflow - momentMaxDate - ', momentMaxDate);
|
|
279
|
+
// console.log('----------');
|
|
280
|
+
// console.log('processOverflow - newDateAsMomentObj - ', newDateAsMomentObj);
|
|
281
|
+
// console.log('*********');
|
|
282
|
+
//? Если значение не валидно...
|
|
283
|
+
if (!newDateAsMomentObj.isValid()) {
|
|
284
|
+
//? ... то откатываем к дате до набора руками
|
|
285
|
+
return valueForRollback;
|
|
286
|
+
} else {
|
|
287
|
+
const beforeOfFuture = (0, _momenttimezone.default)().endOf("day");
|
|
288
|
+
const hour = key === "startDateInput" ? startHour : endHour;
|
|
289
|
+
let output;
|
|
290
|
+
//? Если есть минимальная дата и введенная меньше минимальной, то ставим минимальную
|
|
291
|
+
if (minDate && newDateAsMomentObj.isBefore(momentMinDate)) output = momentMinDate;
|
|
292
|
+
else if (maxDate && newDateAsMomentObj.isAfter(momentMaxDate)) output = momentMaxDate;
|
|
293
|
+
else if (!isDontLimitFuture && newDateAsMomentObj.isAfter(beforeOfFuture)) {
|
|
294
|
+
output = beforeOfFuture.startOf("day");
|
|
295
|
+
} else output = newDateAsMomentObj;
|
|
296
|
+
// if (key === 'startDateInput') {
|
|
297
|
+
// console.log('endDate - ', endDate.format('YYYY-MM-DDTHH:mm'));
|
|
298
|
+
// console.log('endDate.subtract(1, d) - ', endDate.subtract(1, 'd').format('YYYY-MM-DDTHH:mm'));
|
|
299
|
+
// if (output.isAfter(endDate.subtract(1, 'd'))) output = endDate.subtract(1, 'd');
|
|
300
|
+
// }
|
|
301
|
+
if (key === "endDateInput") {
|
|
302
|
+
// console.log('startDate - ', startDate.format('YYYY-MM-DDTHH:mm'));
|
|
303
|
+
// if (output.isBefore(startDate)) output = startDate.add(1, 'd');
|
|
304
|
+
output = addDay(output);
|
|
305
|
+
}
|
|
306
|
+
// console.log('output - ', output.format('YYYY-MM-DDTHH:mm'));
|
|
307
|
+
// console.log('************');
|
|
308
|
+
return output.set("hour", parseInt(hour, 10));
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const handleDateInputBlur = (key, e)=>{
|
|
312
|
+
var _e_target;
|
|
313
|
+
const reserveValue = key === "startDateInput" ? startDateInput : endDateInput;
|
|
314
|
+
const valueForRollback = key === "startDateInput" ? startDate : endDate;
|
|
315
|
+
const execute = key === "startDateInput" ? setStartDate : setEndDate;
|
|
316
|
+
const executeForCalendar = key === "startDateInput" ? setDate1 : setDate2;
|
|
317
|
+
const prepareValueForCalendar = (newDate)=>{
|
|
318
|
+
if (key === "endDateInput") return newDate;
|
|
319
|
+
return (0, _momenttimezone.default)(newDate).isSameOrAfter((0, _momenttimezone.default)(date2), "month") ? (0, _momenttimezone.default)(date2).subtract(1, "month") : (0, _momenttimezone.default)(newDate);
|
|
320
|
+
};
|
|
321
|
+
var _e_target_value;
|
|
322
|
+
const newDateValue = (_e_target_value = e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.value) !== null && _e_target_value !== void 0 ? _e_target_value : reserveValue;
|
|
323
|
+
const processedNewDate = processOverflow(newDateValue, valueForRollback, key);
|
|
324
|
+
execute(processedNewDate);
|
|
325
|
+
executeForCalendar(prepareValueForCalendar(processedNewDate));
|
|
326
|
+
doBlur(key, e);
|
|
327
|
+
};
|
|
328
|
+
const handleKeyPressed = (code, e, type)=>{
|
|
329
|
+
if (code === 13) handleDateInputBlur(type, e);
|
|
330
|
+
if (code === 27) doBlur(type, e);
|
|
331
|
+
};
|
|
332
|
+
// ********************
|
|
333
|
+
// Render Functions
|
|
334
|
+
// ********************
|
|
335
|
+
const getStartHourItems = ()=>[
|
|
336
|
+
...Array(24).keys()
|
|
337
|
+
].map((hour)=>({
|
|
338
|
+
label: padTime(hour),
|
|
339
|
+
value: hour,
|
|
340
|
+
disabled: (0, _momenttimezone.default)(startDate).isSame(endDate, "day") && endHour <= hour
|
|
341
|
+
}));
|
|
342
|
+
const getEndHourItems = ()=>[
|
|
343
|
+
...Array(24).keys()
|
|
344
|
+
].map((hour)=>({
|
|
345
|
+
label: padTime(hour + 1),
|
|
346
|
+
value: hour === 23 ? 0 : hour + 1,
|
|
347
|
+
disabled: ((0, _momenttimezone.default)(startDate).isSame(endDate, "day") || (0, _momenttimezone.default)(startDate).isSame((0, _momenttimezone.default)(endDate).subtract(1, "days"), "day") && endHour === 0) && hour < startHour
|
|
348
|
+
}));
|
|
349
|
+
const renderButtons = ()=>{
|
|
350
|
+
var _txt_buttons, _txt_buttons1;
|
|
351
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
352
|
+
children: [
|
|
353
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
354
|
+
className: "date-picker__button",
|
|
355
|
+
onClick: ()=>onCancel(),
|
|
356
|
+
variant: buttonsTypes === null || buttonsTypes === void 0 ? void 0 : buttonsTypes.cancel,
|
|
357
|
+
children: (txt === null || txt === void 0 ? void 0 : (_txt_buttons = txt.buttons) === null || _txt_buttons === void 0 ? void 0 : _txt_buttons.cancel) || "Cancel"
|
|
358
|
+
}),
|
|
359
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
360
|
+
className: "date-picker__button",
|
|
361
|
+
variant: buttonsTypes === null || buttonsTypes === void 0 ? void 0 : buttonsTypes.apply,
|
|
362
|
+
disabled: !startDate || !endDate,
|
|
363
|
+
onClick: ()=>onChange({
|
|
364
|
+
start: (0, _momenttimezone.default)(startDate).format(_dependencies.MAIN_FORMAT),
|
|
365
|
+
end: (0, _momenttimezone.default)(endDate).format(_dependencies.MAIN_FORMAT),
|
|
366
|
+
startPrevDate: (0, _momenttimezone.default)(startPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
367
|
+
endPrevDate: (0, _momenttimezone.default)(endPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
368
|
+
compare: isCompare
|
|
369
|
+
}),
|
|
370
|
+
children: (txt === null || txt === void 0 ? void 0 : (_txt_buttons1 = txt.buttons) === null || _txt_buttons1 === void 0 ? void 0 : _txt_buttons1.apply) || "apply"
|
|
371
|
+
})
|
|
372
|
+
]
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
const renderPreviousPeriod = ()=>{
|
|
376
|
+
var _txt_labels;
|
|
377
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
378
|
+
children: [
|
|
379
|
+
(txt === null || txt === void 0 ? void 0 : (_txt_labels = txt.labels) === null || _txt_labels === void 0 ? void 0 : _txt_labels.previousPeriod) || "",
|
|
380
|
+
":",
|
|
381
|
+
" ",
|
|
382
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
383
|
+
className: "date-picker__previous-period-interval",
|
|
384
|
+
children: title
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
// ********************
|
|
390
|
+
// useEffects
|
|
391
|
+
// ********************
|
|
392
|
+
(0, _react.useEffect)(()=>{
|
|
393
|
+
if ((0, _momenttimezone.default)(startDate).isSameOrAfter(endDate)) {
|
|
394
|
+
setStartDate((0, _momenttimezone.default)(endDate).subtract(1, "d"));
|
|
395
|
+
setDate1((0, _momenttimezone.default)(endDate).subtract(1, "d"));
|
|
396
|
+
}
|
|
397
|
+
}, [
|
|
398
|
+
startDate
|
|
399
|
+
]);
|
|
400
|
+
(0, _react.useEffect)(()=>{
|
|
401
|
+
if ((0, _momenttimezone.default)(endDate).isSameOrBefore(startDate)) {
|
|
402
|
+
setEndDate((0, _momenttimezone.default)(startDate).add(1, "d"));
|
|
403
|
+
setDate2((0, _momenttimezone.default)(startDate).add(1, "d"));
|
|
404
|
+
}
|
|
405
|
+
}, [
|
|
406
|
+
endDate
|
|
407
|
+
]);
|
|
408
|
+
(0, _react.useEffect)(()=>{
|
|
409
|
+
if ((0, _momenttimezone.default)(startDate).isBefore((0, _momenttimezone.default)(endDate), "month")) {
|
|
410
|
+
setDate1((0, _momenttimezone.default)(startDate));
|
|
411
|
+
setDate2((0, _momenttimezone.default)(endDate));
|
|
412
|
+
}
|
|
413
|
+
setInterval();
|
|
414
|
+
}, [
|
|
415
|
+
startDate,
|
|
416
|
+
endDate
|
|
417
|
+
]);
|
|
418
|
+
(0, _react.useEffect)(()=>{
|
|
419
|
+
if ((0, _momenttimezone.default)(date1).isSameOrAfter((0, _momenttimezone.default)(date2), "month") && !withMobileLogic) {
|
|
420
|
+
setDate1((0, _momenttimezone.default)(date2).subtract(1, "month"));
|
|
421
|
+
}
|
|
422
|
+
}, [
|
|
423
|
+
date1,
|
|
424
|
+
date2
|
|
425
|
+
]);
|
|
426
|
+
(0, _react.useEffect)(()=>{
|
|
427
|
+
onChangeInterval(dateInterval);
|
|
428
|
+
}, [
|
|
429
|
+
dateInterval
|
|
430
|
+
]);
|
|
431
|
+
(0, _react.useEffect)(()=>{
|
|
432
|
+
if (typeof onChangeMobile === "function") {
|
|
433
|
+
onChangeMobile({
|
|
434
|
+
start: (0, _momenttimezone.default)(startDate).format(_dependencies.MAIN_FORMAT),
|
|
435
|
+
end: (0, _momenttimezone.default)(endDate).format(_dependencies.MAIN_FORMAT),
|
|
436
|
+
startPrevDate: (0, _momenttimezone.default)(startPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
437
|
+
endPrevDate: (0, _momenttimezone.default)(endPrevDate).format(_dependencies.MAIN_FORMAT),
|
|
438
|
+
compare: isCompare
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}, [
|
|
442
|
+
startDate,
|
|
443
|
+
endDate,
|
|
444
|
+
startPrevDate,
|
|
445
|
+
endPrevDate,
|
|
446
|
+
isCompare
|
|
447
|
+
]);
|
|
448
|
+
const renderRowStart = ()=>{
|
|
449
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
450
|
+
className: "date-picker__date-row",
|
|
451
|
+
children: [
|
|
452
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_DateInput.default, {
|
|
453
|
+
ref: startDateInputRef,
|
|
454
|
+
testId: `datepicker-${testId}_start-date-input`,
|
|
455
|
+
RC: "date-picker__date-input",
|
|
456
|
+
className: (0, _classnames.default)("date-picker__date-input"),
|
|
457
|
+
isFocused: isStartFocused,
|
|
458
|
+
value: startDateInput,
|
|
459
|
+
date: getCorrectedDateForDateInput("startDateInput", startDate),
|
|
460
|
+
disabled: !startDate,
|
|
461
|
+
onChange: setStartDateInput,
|
|
462
|
+
onFocus: (e)=>handleDateInputFocus("startDateInput", e),
|
|
463
|
+
onBlur: (e)=>handleDateInputBlur("startDateInput", e),
|
|
464
|
+
onKeyUp: (code, e)=>handleKeyPressed(code, e, "startDateInput")
|
|
465
|
+
}),
|
|
466
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Dropdown.default, {
|
|
467
|
+
testId: testId,
|
|
468
|
+
id: `datepicker-id-${mainId}_start-hour-select-input`,
|
|
469
|
+
dataTest: "datepicker_start-hour-select-input",
|
|
470
|
+
className: (0, _classnames.default)("date-picker__hour-select-input"),
|
|
471
|
+
onChange: (value)=>handleChangeStartHour(value),
|
|
472
|
+
value: startHour,
|
|
473
|
+
options: getStartHourItems(),
|
|
474
|
+
disabled: !startDate,
|
|
475
|
+
isDoNotPullOutListOfMainContainer: true,
|
|
476
|
+
short: true,
|
|
477
|
+
withMobileLogic: withMobileLogic
|
|
478
|
+
})
|
|
479
|
+
]
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
const renderRowEnd = ()=>{
|
|
483
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
484
|
+
className: "date-picker__date-row",
|
|
485
|
+
children: [
|
|
486
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_DateInput.default, {
|
|
487
|
+
ref: endDateInputRef,
|
|
488
|
+
testId: `datepicker-${testId}_start-date-input`,
|
|
489
|
+
RC: "date-picker__date-input",
|
|
490
|
+
className: (0, _classnames.default)("date-picker__date-input"),
|
|
491
|
+
isFocused: isEndFocused,
|
|
492
|
+
value: endDateInput,
|
|
493
|
+
date: getCorrectedDateForDateInput("endDateInput", endDate),
|
|
494
|
+
disabled: !endDate,
|
|
495
|
+
onChange: setEndDateInput,
|
|
496
|
+
onFocus: (e)=>handleDateInputFocus("endDateInput", e),
|
|
497
|
+
onBlur: (e)=>handleDateInputBlur("endDateInput", e),
|
|
498
|
+
onKeyUp: (code, e)=>handleKeyPressed(code, e, "endDateInput")
|
|
499
|
+
}),
|
|
500
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Dropdown.default, {
|
|
501
|
+
testId: testId,
|
|
502
|
+
id: `datepicker-id-${mainId}_end-hour-select-input`,
|
|
503
|
+
dataTest: "datepicker_end-hour-select-input",
|
|
504
|
+
className: (0, _classnames.default)("date-picker__hour-select-input"),
|
|
505
|
+
onChange: (value)=>handleChangeEndHour(value),
|
|
506
|
+
value: endHour,
|
|
507
|
+
options: getEndHourItems(),
|
|
508
|
+
disabled: !endDate,
|
|
509
|
+
isDoNotPullOutListOfMainContainer: true,
|
|
510
|
+
short: true,
|
|
511
|
+
withMobileLogic: withMobileLogic
|
|
512
|
+
})
|
|
513
|
+
]
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
const renderCalendarStart = ()=>{
|
|
517
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RangeCalendar.default, {
|
|
518
|
+
testId: testId,
|
|
519
|
+
className: "date-picker__calendar",
|
|
520
|
+
date: date1,
|
|
521
|
+
setDate: setDate1,
|
|
522
|
+
allowNext: withMobileLogic ? !(0, _momenttimezone.default)(date1).startOf("month").isSameOrAfter((0, _momenttimezone.default)().startOf("day"), "months") : !isNearby,
|
|
523
|
+
startDate: startDate,
|
|
524
|
+
endDate: endDate,
|
|
525
|
+
startPrevDate: startPrevDate,
|
|
526
|
+
endPrevDate: endPrevDate,
|
|
527
|
+
onClick: handleClick,
|
|
528
|
+
onHover: handleHover,
|
|
529
|
+
limitRange: limitRange,
|
|
530
|
+
isShortWeekNames: isShortWeekNames,
|
|
531
|
+
minDate: minDate,
|
|
532
|
+
maxDate: maxDate,
|
|
533
|
+
momentMinDate: momentMinDate,
|
|
534
|
+
momentMaxDate: momentMaxDate
|
|
535
|
+
});
|
|
536
|
+
};
|
|
537
|
+
const renderCalendarEnd = ()=>{
|
|
538
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RangeCalendar.default, {
|
|
539
|
+
className: "date-picker__calendar",
|
|
540
|
+
date: date2,
|
|
541
|
+
setDate: setDate2,
|
|
542
|
+
allowPrev: !isNearby,
|
|
543
|
+
startDate: startDate,
|
|
544
|
+
endDate: endDate,
|
|
545
|
+
startPrevDate: startPrevDate,
|
|
546
|
+
endPrevDate: endPrevDate,
|
|
547
|
+
onClick: handleClick,
|
|
548
|
+
onHover: handleHover,
|
|
549
|
+
isShortWeekNames: isShortWeekNames,
|
|
550
|
+
minDate: minDate,
|
|
551
|
+
maxDate: maxDate,
|
|
552
|
+
momentMinDate: momentMinDate,
|
|
553
|
+
momentMaxDate: momentMaxDate,
|
|
554
|
+
isDontLimitFuture: isDontLimitFuture
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
const render = ()=>{
|
|
558
|
+
var _txt_labels;
|
|
559
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
560
|
+
className: (0, _classnames.default)("date-picker", className),
|
|
561
|
+
children: [
|
|
562
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
563
|
+
className: "date-picker__header",
|
|
564
|
+
children: [
|
|
565
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
566
|
+
className: "date-picker__inputs-block",
|
|
567
|
+
children: [
|
|
568
|
+
renderRowStart(),
|
|
569
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
570
|
+
className: "date-picker__inputs-separator date-picker__header--gray",
|
|
571
|
+
children: "—"
|
|
572
|
+
}),
|
|
573
|
+
renderRowEnd()
|
|
574
|
+
]
|
|
575
|
+
}),
|
|
576
|
+
isCompare && !isCompareHidden && startDate && endDate && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
577
|
+
className: "date-picker__previous-period",
|
|
578
|
+
children: renderPreviousPeriod()
|
|
579
|
+
})
|
|
580
|
+
]
|
|
581
|
+
}),
|
|
582
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
583
|
+
className: "date-picker__calendars",
|
|
584
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
585
|
+
className: "date-picker__calendars-wrapper",
|
|
586
|
+
children: [
|
|
587
|
+
renderCalendarStart(),
|
|
588
|
+
renderCalendarEnd()
|
|
589
|
+
]
|
|
590
|
+
})
|
|
591
|
+
}),
|
|
592
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
593
|
+
className: (0, _classnames.default)("date-picker__footer", {
|
|
594
|
+
"date-picker__footer_once-element": isCompareHidden
|
|
595
|
+
}),
|
|
596
|
+
children: [
|
|
597
|
+
!isCompareHidden ? /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
598
|
+
className: "date-picker__compare-block",
|
|
599
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
600
|
+
className: "mr5",
|
|
601
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Switcher.default, {
|
|
602
|
+
dataTest: "datepicker_compare",
|
|
603
|
+
label: (txt === null || txt === void 0 ? void 0 : (_txt_labels = txt.labels) === null || _txt_labels === void 0 ? void 0 : _txt_labels.compare) || "Compare",
|
|
604
|
+
isSwitchOn: isCompare,
|
|
605
|
+
onChange: ()=>{
|
|
606
|
+
onChangeCompare(!isCompare);
|
|
607
|
+
setIsCompare((state)=>!state);
|
|
608
|
+
}
|
|
609
|
+
})
|
|
610
|
+
})
|
|
611
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {}),
|
|
612
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
613
|
+
className: "date-picker__buttons-block",
|
|
614
|
+
children: renderButtons()
|
|
615
|
+
})
|
|
616
|
+
]
|
|
617
|
+
})
|
|
618
|
+
]
|
|
619
|
+
});
|
|
620
|
+
};
|
|
621
|
+
const renderMobile = ()=>{
|
|
622
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
623
|
+
className: (0, _classnames.default)("date-picker", className),
|
|
624
|
+
children: [
|
|
625
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
626
|
+
className: "date-picker__header",
|
|
627
|
+
children: [
|
|
628
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
629
|
+
className: "date-picker__inputs-block",
|
|
630
|
+
children: [
|
|
631
|
+
renderRowStart(),
|
|
632
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
633
|
+
className: "date-picker__inputs-separator date-picker__header--gray",
|
|
634
|
+
children: "—"
|
|
635
|
+
}),
|
|
636
|
+
renderRowEnd()
|
|
637
|
+
]
|
|
638
|
+
}),
|
|
639
|
+
isCompare && !isCompareHidden && startDate && endDate && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
640
|
+
className: "date-picker__previous-period",
|
|
641
|
+
children: renderPreviousPeriod()
|
|
642
|
+
})
|
|
643
|
+
]
|
|
644
|
+
}),
|
|
645
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
646
|
+
className: "date-picker__calendars",
|
|
647
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
648
|
+
className: "date-picker__calendars-wrapper",
|
|
649
|
+
children: renderCalendarStart()
|
|
650
|
+
})
|
|
651
|
+
})
|
|
652
|
+
]
|
|
653
|
+
});
|
|
654
|
+
};
|
|
655
|
+
return withMobileLogic ? renderMobile() : render();
|
|
547
656
|
};
|
|
548
|
-
|
|
657
|
+
const _default = Datepicker;
|