@zohodesk/components 1.0.0-temp-155 → 1.0.0-temp-156
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/es/Accordion/Accordion.js +7 -3
- package/es/Accordion/AccordionItem.js +4 -2
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +13 -5
- package/es/AppContainer/AppContainer.module.css +2 -2
- package/es/Avatar/Avatar.js +23 -11
- package/es/Avatar/Avatar.module.css +18 -18
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/AvatarTeam/AvatarTeam.module.css +35 -35
- package/es/Button/Button.js +4 -3
- package/es/Button/css/Button.module.css +70 -70
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Buttongroup/Buttongroup.module.css +14 -15
- package/es/Card/Card.js +21 -10
- package/es/CheckBox/CheckBox.js +5 -3
- package/es/CheckBox/CheckBox.module.css +15 -15
- package/es/DateTime/CalendarView.js +32 -20
- package/es/DateTime/DateTime.js +67 -6
- package/es/DateTime/DateTime.module.css +39 -39
- package/es/DateTime/DateTimePopupFooter.js +4 -2
- package/es/DateTime/DateTimePopupHeader.js +8 -2
- package/es/DateTime/DateWidget.js +98 -35
- package/es/DateTime/DateWidget.module.css +5 -5
- package/es/DateTime/DaysRow.js +4 -2
- package/es/DateTime/Time.js +10 -2
- package/es/DateTime/YearView.js +28 -4
- package/es/DateTime/YearView.module.css +15 -15
- package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
- package/es/DateTime/__tests__/DateTime.spec.js +1 -0
- package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
- package/es/DateTime/common.js +3 -0
- package/es/DateTime/constants.js +1 -0
- package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
- package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
- package/es/DateTime/dateFormatUtils/index.js +32 -2
- package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
- package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
- package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
- package/es/DateTime/objectUtils.js +14 -20
- package/es/DateTime/typeChecker.js +3 -0
- package/es/DateTime/validator.js +58 -6
- package/es/DropBox/DropBox.js +6 -2
- package/es/DropBox/DropBoxElement/DropBoxElement.js +7 -0
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +76 -76
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -3
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
- package/es/DropBox/css/DropBox.module.css +6 -6
- package/es/DropBox/props/defaultProps.js +1 -2
- package/es/DropBox/props/propTypes.js +1 -2
- package/es/DropDown/DropDown.js +8 -4
- package/es/DropDown/DropDown.module.css +2 -2
- package/es/DropDown/DropDownHeading.js +4 -5
- package/es/DropDown/DropDownHeading.module.css +6 -6
- package/es/DropDown/DropDownItem.js +6 -0
- package/es/DropDown/DropDownItem.module.css +12 -12
- package/es/DropDown/DropDownSearch.js +4 -0
- package/es/DropDown/DropDownSearch.module.css +3 -3
- package/es/DropDown/DropDownSeparator.js +1 -0
- package/es/DropDown/DropDownSeparator.module.css +2 -2
- package/es/DropDown/__tests__/DropDown.spec.js +1 -2
- package/es/Heading/Heading.js +2 -3
- package/es/Heading/Heading.module.css +2 -2
- package/es/Label/Label.js +2 -3
- package/es/Label/Label.module.css +5 -5
- package/es/Layout/Box.js +13 -0
- package/es/Layout/Container.js +12 -1
- package/es/Layout/Layout.module.css +15 -15
- package/es/Layout/index.js +1 -2
- package/es/ListItem/ListContainer.js +8 -3
- package/es/ListItem/ListItem.js +9 -3
- package/es/ListItem/ListItem.module.css +38 -38
- package/es/ListItem/ListItemWithAvatar.js +9 -3
- package/es/ListItem/ListItemWithCheckBox.js +7 -2
- package/es/ListItem/ListItemWithIcon.js +8 -3
- package/es/ListItem/ListItemWithRadio.js +7 -3
- package/es/Modal/Modal.js +28 -11
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +89 -13
- package/es/MultiSelect/AdvancedMultiSelect.js +32 -9
- package/es/MultiSelect/EmptyState.js +2 -0
- package/es/MultiSelect/MultiSelect.js +99 -32
- package/es/MultiSelect/MultiSelect.module.css +31 -31
- package/es/MultiSelect/MultiSelectHeader.js +3 -0
- package/es/MultiSelect/MultiSelectWithAvatar.js +12 -6
- package/es/MultiSelect/SelectedOptions.js +6 -3
- package/es/MultiSelect/SelectedOptions.module.css +5 -5
- package/es/MultiSelect/Suggestions.js +7 -3
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
- package/es/MultiSelect/props/propTypes.js +2 -0
- package/es/PopOver/PopOver.js +18 -2
- package/es/PopOver/__tests__/PopOver.spec.js +2 -1
- package/es/Popup/Popup.js +77 -24
- package/es/Popup/__tests__/Popup.spec.js +17 -5
- package/es/Popup/viewPort.js +16 -4
- package/es/Provider/IdProvider.js +10 -5
- package/es/Provider/LibraryContext.js +6 -4
- package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
- package/es/Provider/ZindexProvider.js +9 -2
- package/es/Radio/Radio.js +4 -2
- package/es/Radio/Radio.module.css +9 -9
- package/es/Responsive/CustomResponsive.js +30 -18
- package/es/Responsive/RefWrapper.js +6 -7
- package/es/Responsive/ResizeComponent.js +35 -25
- package/es/Responsive/ResizeObserver.js +26 -6
- package/es/Responsive/Responsive.js +34 -20
- package/es/Responsive/index.js +1 -3
- package/es/Responsive/sizeObservers.js +28 -7
- package/es/Responsive/utils/index.js +7 -5
- package/es/Responsive/utils/shallowCompare.js +7 -2
- package/es/Responsive/windowResizeObserver.js +7 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
- package/es/Ribbon/Ribbon.js +3 -2
- package/es/Ribbon/Ribbon.module.css +46 -48
- package/es/RippleEffect/RippleEffect.js +1 -3
- package/es/Select/GroupSelect.js +58 -14
- package/es/Select/Select.js +79 -33
- package/es/Select/Select.module.css +23 -23
- package/es/Select/SelectWithAvatar.js +17 -4
- package/es/Select/SelectWithIcon.js +46 -5
- package/es/Select/__tests__/Select.spec.js +6 -8
- package/es/Select/props/propTypes.js +1 -0
- package/es/Stencils/Stencils.js +3 -3
- package/es/Stencils/Stencils.module.css +11 -11
- package/es/Switch/Switch.js +5 -3
- package/es/Switch/Switch.module.css +23 -23
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/Tab.module.css +14 -14
- package/es/Tab/TabContent.js +1 -0
- package/es/Tab/TabContentWrapper.js +2 -0
- package/es/Tab/TabWrapper.js +5 -2
- package/es/Tab/Tabs.js +54 -7
- package/es/Tab/Tabs.module.css +22 -22
- package/es/Tab/__tests__/Tab.spec.js +1 -3
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
- package/es/Tag/Tag.js +6 -3
- package/es/Tag/Tag.module.css +25 -25
- package/es/TextBox/TextBox.js +15 -3
- package/es/TextBox/TextBox.module.css +9 -9
- package/es/TextBox/__tests__/TextBox.spec.js +1 -4
- package/es/TextBoxIcon/TextBoxIcon.js +9 -2
- package/es/TextBoxIcon/TextBoxIcon.module.css +7 -7
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
- package/es/Textarea/Textarea.js +12 -3
- package/es/Textarea/Textarea.module.css +21 -21
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +58 -14
- package/es/Tooltip/Tooltip.module.css +5 -5
- package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
- package/es/common/animation.module.css +8 -8
- package/es/common/avatarsizes.module.css +16 -16
- package/es/common/basicReset.module.css +3 -3
- package/es/common/common.module.css +24 -24
- package/es/common/customscroll.module.css +2 -2
- package/es/deprecated/AdvancedMultiSelect.module.css +18 -18
- package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
- package/es/semantic/Button/Button.js +3 -2
- package/es/semantic/Button/semanticButton.module.css +1 -1
- package/es/utils/Common.js +54 -9
- package/es/utils/ContextOptimizer.js +4 -5
- package/es/utils/__tests__/debounce.spec.js +2 -2
- package/es/utils/constructFullName.js +2 -0
- package/es/utils/css/compileClassNames.js +5 -0
- package/es/utils/css/mergeStyle.js +7 -6
- package/es/utils/css/utils.js +1 -0
- package/es/utils/datetime/common.js +16 -5
- package/es/utils/debounce.js +5 -1
- package/es/utils/dropDownUtils.js +68 -11
- package/es/utils/getInitial.js +4 -0
- package/es/utils/shallowEqual.js +6 -0
- package/lib/Accordion/Accordion.js +42 -18
- package/lib/Accordion/AccordionItem.js +40 -18
- package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
- package/lib/Accordion/index.js +3 -0
- package/lib/Accordion/props/propTypes.js +3 -0
- package/lib/Animation/Animation.js +38 -18
- package/lib/Animation/__tests__/Animation.spec.js +11 -7
- package/lib/Animation/props/propTypes.js +3 -0
- package/lib/AppContainer/AppContainer.js +56 -21
- package/lib/AppContainer/AppContainer.module.css +2 -2
- package/lib/AppContainer/props/propTypes.js +3 -0
- package/lib/Avatar/Avatar.js +78 -38
- package/lib/Avatar/Avatar.module.css +18 -18
- package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
- package/lib/Avatar/props/propTypes.js +3 -0
- package/lib/AvatarTeam/AvatarTeam.js +52 -30
- package/lib/AvatarTeam/AvatarTeam.module.css +35 -35
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
- package/lib/AvatarTeam/props/propTypes.js +3 -0
- package/lib/Button/Button.js +31 -20
- package/lib/Button/css/Button.module.css +70 -70
- package/lib/Button/css/cssJSLogic.js +18 -17
- package/lib/Button/index.js +3 -0
- package/lib/Button/props/defaultProps.js +2 -0
- package/lib/Button/props/propTypes.js +3 -0
- package/lib/Buttongroup/Buttongroup.js +32 -12
- package/lib/Buttongroup/Buttongroup.module.css +14 -15
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
- package/lib/Buttongroup/props/propTypes.js +3 -0
- package/lib/Card/Card.js +102 -46
- package/lib/Card/__tests__/Card.spec.js +10 -1
- package/lib/Card/index.js +4 -0
- package/lib/Card/props/propTypes.js +3 -0
- package/lib/CheckBox/CheckBox.js +71 -47
- package/lib/CheckBox/CheckBox.module.css +15 -15
- package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
- package/lib/CheckBox/props/propTypes.js +3 -0
- package/lib/DateTime/CalendarView.js +82 -42
- package/lib/DateTime/DateTime.js +240 -156
- package/lib/DateTime/DateTime.module.css +39 -39
- package/lib/DateTime/DateTimePopupFooter.js +32 -9
- package/lib/DateTime/DateTimePopupHeader.js +49 -18
- package/lib/DateTime/DateWidget.js +353 -251
- package/lib/DateTime/DateWidget.module.css +5 -5
- package/lib/DateTime/DaysRow.js +28 -6
- package/lib/DateTime/Time.js +74 -33
- package/lib/DateTime/YearView.js +78 -29
- package/lib/DateTime/YearView.module.css +15 -15
- package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
- package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
- package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
- package/lib/DateTime/common.js +6 -0
- package/lib/DateTime/constants.js +1 -0
- package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
- package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
- package/lib/DateTime/dateFormatUtils/index.js +74 -16
- package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
- package/lib/DateTime/dateFormatUtils/timeChange.js +55 -23
- package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
- package/lib/DateTime/index.js +2 -0
- package/lib/DateTime/objectUtils.js +24 -20
- package/lib/DateTime/props/propTypes.js +11 -1
- package/lib/DateTime/typeChecker.js +4 -0
- package/lib/DateTime/validator.js +73 -10
- package/lib/DropBox/DropBox.js +34 -10
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +58 -37
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +76 -76
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +41 -33
- package/lib/DropBox/DropBoxElement/props/propTypes.js +3 -0
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
- package/lib/DropBox/__tests__/DropBox.spec.js +6 -2
- package/lib/DropBox/css/DropBox.module.css +6 -6
- package/lib/DropBox/css/cssJSLogic.js +3 -1
- package/lib/DropBox/props/defaultProps.js +8 -4
- package/lib/DropBox/props/propTypes.js +10 -4
- package/lib/DropDown/DropDown.js +52 -8
- package/lib/DropDown/DropDown.module.css +2 -2
- package/lib/DropDown/DropDownHeading.js +39 -20
- package/lib/DropDown/DropDownHeading.module.css +6 -6
- package/lib/DropDown/DropDownItem.js +42 -20
- package/lib/DropDown/DropDownItem.module.css +12 -12
- package/lib/DropDown/DropDownSearch.js +40 -17
- package/lib/DropDown/DropDownSearch.module.css +3 -3
- package/lib/DropDown/DropDownSeparator.js +24 -4
- package/lib/DropDown/DropDownSeparator.module.css +2 -2
- package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
- package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
- package/lib/DropDown/index.js +9 -0
- package/lib/DropDown/props/propTypes.js +6 -4
- package/lib/Heading/Heading.js +37 -15
- package/lib/Heading/Heading.module.css +2 -2
- package/lib/Heading/props/propTypes.js +3 -0
- package/lib/Label/Label.js +40 -22
- package/lib/Label/Label.module.css +5 -5
- package/lib/Label/__tests__/Label.spec.js +14 -1
- package/lib/Label/props/propTypes.js +3 -0
- package/lib/Layout/Box.js +31 -11
- package/lib/Layout/Container.js +29 -10
- package/lib/Layout/Layout.module.css +15 -15
- package/lib/Layout/__tests__/Box.spec.js +65 -49
- package/lib/Layout/__tests__/Container.spec.js +67 -50
- package/lib/Layout/index.js +3 -0
- package/lib/Layout/props/propTypes.js +3 -0
- package/lib/Layout/utils.js +10 -0
- package/lib/ListItem/ListContainer.js +49 -28
- package/lib/ListItem/ListItem.js +70 -46
- package/lib/ListItem/ListItem.module.css +38 -38
- package/lib/ListItem/ListItemWithAvatar.js +76 -49
- package/lib/ListItem/ListItemWithCheckBox.js +64 -39
- package/lib/ListItem/ListItemWithIcon.js +69 -45
- package/lib/ListItem/ListItemWithRadio.js +65 -41
- package/lib/ListItem/index.js +7 -0
- package/lib/ListItem/props/propTypes.js +6 -4
- package/lib/Modal/Modal.js +46 -11
- package/lib/Modal/props/propTypes.js +3 -0
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +295 -167
- package/lib/MultiSelect/AdvancedMultiSelect.js +203 -125
- package/lib/MultiSelect/EmptyState.js +46 -25
- package/lib/MultiSelect/MultiSelect.js +324 -206
- package/lib/MultiSelect/MultiSelect.module.css +31 -31
- package/lib/MultiSelect/MultiSelectHeader.js +31 -9
- package/lib/MultiSelect/MultiSelectWithAvatar.js +106 -64
- package/lib/MultiSelect/SelectedOptions.js +44 -18
- package/lib/MultiSelect/SelectedOptions.module.css +5 -5
- package/lib/MultiSelect/Suggestions.js +65 -33
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
- package/lib/MultiSelect/index.js +5 -0
- package/lib/MultiSelect/props/defaultProps.js +2 -0
- package/lib/MultiSelect/props/propTypes.js +5 -0
- package/lib/PopOver/PopOver.js +95 -49
- package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
- package/lib/PopOver/index.js +4 -0
- package/lib/PopOver/props/propTypes.js +3 -0
- package/lib/Popup/Popup.js +159 -82
- package/lib/Popup/__tests__/Popup.spec.js +44 -9
- package/lib/Popup/viewPort.js +28 -14
- package/lib/Provider/AvatarSize.js +4 -0
- package/lib/Provider/Config.js +2 -0
- package/lib/Provider/CssProvider.js +4 -0
- package/lib/Provider/IdProvider.js +17 -6
- package/lib/Provider/LibraryContext.js +35 -15
- package/lib/Provider/LibraryContextInit.js +4 -0
- package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
- package/lib/Provider/ZindexProvider.js +15 -3
- package/lib/Provider/index.js +5 -0
- package/lib/Radio/Radio.js +62 -39
- package/lib/Radio/Radio.module.css +9 -9
- package/lib/Radio/__tests__/Radiospec.js +9 -5
- package/lib/Radio/props/propTypes.js +3 -0
- package/lib/Responsive/CustomResponsive.js +73 -28
- package/lib/Responsive/RefWrapper.js +17 -11
- package/lib/Responsive/ResizeComponent.js +63 -39
- package/lib/Responsive/ResizeObserver.js +24 -10
- package/lib/Responsive/Responsive.js +81 -31
- package/lib/Responsive/index.js +4 -0
- package/lib/Responsive/props/propTypes.js +3 -0
- package/lib/Responsive/sizeObservers.js +53 -17
- package/lib/Responsive/utils/index.js +11 -3
- package/lib/Responsive/utils/shallowCompare.js +11 -2
- package/lib/Responsive/windowResizeObserver.js +8 -0
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
- package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
- package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
- package/lib/Ribbon/Ribbon.js +34 -14
- package/lib/Ribbon/Ribbon.module.css +46 -48
- package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
- package/lib/Ribbon/props/propTypes.js +3 -0
- package/lib/RippleEffect/RippleEffect.js +18 -10
- package/lib/RippleEffect/props/propTypes.js +3 -0
- package/lib/Select/GroupSelect.js +230 -131
- package/lib/Select/Select.js +291 -209
- package/lib/Select/Select.module.css +23 -23
- package/lib/Select/SelectWithAvatar.js +103 -57
- package/lib/Select/SelectWithIcon.js +133 -77
- package/lib/Select/__tests__/Select.spec.js +134 -92
- package/lib/Select/index.js +5 -0
- package/lib/Select/props/defaultProps.js +5 -4
- package/lib/Select/props/propTypes.js +4 -0
- package/lib/Stencils/Stencils.js +30 -11
- package/lib/Stencils/Stencils.module.css +11 -11
- package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
- package/lib/Stencils/props/propTypes.js +3 -0
- package/lib/Switch/Switch.js +57 -34
- package/lib/Switch/Switch.module.css +23 -23
- package/lib/Switch/props/propTypes.js +3 -0
- package/lib/Tab/Tab.js +41 -28
- package/lib/Tab/Tab.module.css +14 -14
- package/lib/Tab/TabContent.js +12 -5
- package/lib/Tab/TabContentWrapper.js +13 -6
- package/lib/Tab/TabWrapper.js +37 -19
- package/lib/Tab/Tabs.js +172 -98
- package/lib/Tab/Tabs.module.css +22 -22
- package/lib/Tab/__tests__/Tab.spec.js +67 -58
- package/lib/Tab/__tests__/TabContent.spec.js +10 -6
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
- package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
- package/lib/Tab/__tests__/Tabs.spec.js +53 -39
- package/lib/Tab/index.js +6 -0
- package/lib/Tab/props/propTypes.js +3 -0
- package/lib/Tag/Tag.js +72 -43
- package/lib/Tag/Tag.module.css +25 -25
- package/lib/Tag/__tests__/Tag.spec.js +14 -8
- package/lib/Tag/props/propTypes.js +3 -0
- package/lib/TextBox/TextBox.js +86 -60
- package/lib/TextBox/TextBox.module.css +9 -9
- package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
- package/lib/TextBox/props/propTypes.js +6 -4
- package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
- package/lib/TextBoxIcon/TextBoxIcon.module.css +7 -7
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -4
- package/lib/TextBoxIcon/props/propTypes.js +3 -0
- package/lib/Textarea/Textarea.js +55 -30
- package/lib/Textarea/Textarea.module.css +21 -21
- package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
- package/lib/Textarea/props/propTypes.js +3 -0
- package/lib/Tooltip/Tooltip.js +94 -31
- package/lib/Tooltip/Tooltip.module.css +5 -5
- package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
- package/lib/Tooltip/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/index.js +3 -0
- package/lib/common/animation.module.css +8 -8
- package/lib/common/avatarsizes.module.css +16 -16
- package/lib/common/basicReset.module.css +3 -3
- package/lib/common/common.module.css +24 -24
- package/lib/common/customscroll.module.css +2 -2
- package/lib/css.js +40 -0
- package/lib/deprecated/AdvancedMultiSelect.module.css +18 -18
- package/lib/deprecated/PortalLayer/PortalLayer.js +47 -24
- package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
- package/lib/index.js +57 -0
- package/lib/semantic/Button/Button.js +42 -22
- package/lib/semantic/Button/props/propTypes.js +3 -0
- package/lib/semantic/Button/semanticButton.module.css +1 -1
- package/lib/semantic/index.js +2 -0
- package/lib/utils/Common.js +108 -18
- package/lib/utils/ContextOptimizer.js +16 -10
- package/lib/utils/__tests__/constructFullName.spec.js +1 -0
- package/lib/utils/__tests__/debounce.spec.js +3 -2
- package/lib/utils/__tests__/getInitial.spec.js +1 -0
- package/lib/utils/constructFullName.js +13 -4
- package/lib/utils/css/compileClassNames.js +6 -0
- package/lib/utils/css/mergeStyle.js +10 -7
- package/lib/utils/css/utils.js +8 -0
- package/lib/utils/datetime/common.js +32 -5
- package/lib/utils/debounce.js +6 -1
- package/lib/utils/dropDownUtils.js +176 -60
- package/lib/utils/dummyFunction.js +2 -0
- package/lib/utils/getHTMLFontSize.js +1 -0
- package/lib/utils/getInitial.js +6 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/scrollTo.js +2 -0
- package/lib/utils/shallowEqual.js +8 -0
- package/package.json +1 -1
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
/** * Libraries ** */
|
|
4
4
|
import datetime from '@zohodesk/datetimejs';
|
|
5
|
-
|
|
6
5
|
/** * Methods ** */
|
|
6
|
+
|
|
7
7
|
import { getDayEnd, convertYearToTwoDigit, addZero, getMonthDetails, getYearDetails, getDayDetails, getHourDetails, getMinuteDetails, getNoonDetails, getIsCurrentYear, removeYearPattern } from './index';
|
|
8
8
|
import { getIsEmptyValue } from '../../utils/Common';
|
|
9
9
|
import { formatDate } from '../../utils/datetime/common';
|
|
10
|
-
|
|
11
10
|
/** * Constants ** */
|
|
12
|
-
|
|
13
|
-
// patternChangeStr,
|
|
11
|
+
|
|
12
|
+
import { defaultFormat, supportedPatterns, // patternChangeStr,
|
|
14
13
|
patternSplitStr, INCONSTANT, flags } from '../constants';
|
|
14
|
+
|
|
15
15
|
function getDateFormatString() {
|
|
16
16
|
let dateFormatArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17
17
|
let datePatternArr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -21,19 +21,23 @@ function getDateFormatString() {
|
|
|
21
21
|
return res;
|
|
22
22
|
}, '');
|
|
23
23
|
}
|
|
24
|
+
|
|
24
25
|
function getIsValidPattern() {
|
|
25
26
|
let dateFormatArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
26
27
|
let datePatternArr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
28
|
+
|
|
27
29
|
const isValueInArray = function () {
|
|
28
30
|
let possibleFormat = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
29
31
|
return possibleFormat.some(str => dateFormatArr.indexOf(str) >= 0);
|
|
30
32
|
};
|
|
33
|
+
|
|
31
34
|
const haveDay = isValueInArray(flags.day);
|
|
32
35
|
const haveMonth = isValueInArray(flags.month);
|
|
33
36
|
const haveYear = isValueInArray(flags.year);
|
|
34
37
|
const isValidPattern = datePatternArr.length && datePatternArr.length <= 2 && datePatternArr.every(patternStr => supportedPatterns.indexOf(patternStr) >= 0);
|
|
35
38
|
return haveDay && haveMonth && (haveYear || !haveYear) && isValidPattern;
|
|
36
39
|
}
|
|
40
|
+
|
|
37
41
|
export function getDateFormatDetails() {
|
|
38
42
|
let dateFormat = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
39
43
|
let {
|
|
@@ -55,17 +59,20 @@ export function getDateFormatDetails() {
|
|
|
55
59
|
isDateTime
|
|
56
60
|
});
|
|
57
61
|
const isHideYear = isHideCurrentYear ? isCurrentYear : false;
|
|
62
|
+
|
|
58
63
|
function getDateFormat(dateFormat) {
|
|
59
64
|
const token = /D{1,4}|M{1,4}|YY(?:YY)?|([HhmsA])\1?|[LloSZWN]|\[[^\]]*\]|'[^']*'/gi;
|
|
60
65
|
dateFormatArr = [];
|
|
61
66
|
patternArr = [];
|
|
62
67
|
const newDateFormat = dateFormat.replace(token, match => {
|
|
63
68
|
const dateFormatArrLen = dateFormatArr.length;
|
|
69
|
+
|
|
64
70
|
if (match in flags) {
|
|
65
71
|
dateFormatArr.push(match);
|
|
66
72
|
const {
|
|
67
73
|
type
|
|
68
74
|
} = flags[match];
|
|
75
|
+
|
|
69
76
|
if (type === 'day') {
|
|
70
77
|
dayInfo = Object.assign({}, flags[match], {
|
|
71
78
|
index: dateFormatArrLen
|
|
@@ -79,28 +86,35 @@ export function getDateFormatDetails() {
|
|
|
79
86
|
index: dateFormatArrLen
|
|
80
87
|
});
|
|
81
88
|
}
|
|
89
|
+
|
|
82
90
|
return patternSplitStr;
|
|
83
91
|
}
|
|
92
|
+
|
|
84
93
|
return match.slice(1, match.length - 1);
|
|
85
94
|
});
|
|
86
95
|
patternArr = newDateFormat.split(patternSplitStr).reduce((res, patternStr) => {
|
|
87
96
|
if (patternStr) {
|
|
88
97
|
res.push(patternStr);
|
|
89
98
|
}
|
|
99
|
+
|
|
90
100
|
return res;
|
|
91
101
|
}, []);
|
|
92
102
|
}
|
|
103
|
+
|
|
93
104
|
getDateFormat(dateFormat);
|
|
94
105
|
const isValidPattern = getIsValidPattern(dateFormatArr, patternArr);
|
|
106
|
+
|
|
95
107
|
if (!isValidPattern) {
|
|
96
108
|
getDateFormat(defaultFormat);
|
|
97
109
|
}
|
|
110
|
+
|
|
98
111
|
if (isHideYear) {
|
|
99
112
|
({
|
|
100
113
|
dateFormatArr,
|
|
101
114
|
patternArr
|
|
102
115
|
} = removeYearPattern(dateFormatArr, patternArr));
|
|
103
116
|
}
|
|
117
|
+
|
|
104
118
|
return {
|
|
105
119
|
dateFormat: getDateFormatString(dateFormatArr, patternArr),
|
|
106
120
|
dateFormatArr,
|
|
@@ -111,6 +125,7 @@ export function getDateFormatDetails() {
|
|
|
111
125
|
isValidPattern
|
|
112
126
|
};
|
|
113
127
|
}
|
|
128
|
+
|
|
114
129
|
function getDisplayFormatValue(dateVal, formatVal) {
|
|
115
130
|
let {
|
|
116
131
|
i18nShortMonths = [],
|
|
@@ -120,18 +135,22 @@ function getDisplayFormatValue(dateVal, formatVal) {
|
|
|
120
135
|
length,
|
|
121
136
|
type
|
|
122
137
|
} = flags[formatVal] || {};
|
|
138
|
+
|
|
123
139
|
if (length === INCONSTANT) {
|
|
124
140
|
if (dateVal && formatVal === 'MMM' && i18nShortMonths.length) {
|
|
125
141
|
return i18nShortMonths[dateVal - 1];
|
|
126
142
|
} else if (dateVal && formatVal === 'MMMM' && i18nMonths.length) {
|
|
127
143
|
return i18nMonths[dateVal - 1];
|
|
128
144
|
}
|
|
145
|
+
|
|
129
146
|
return addZero(dateVal, formatVal.length ? formatVal.length : 1);
|
|
130
147
|
} else if (type === 'year' && length === 2) {
|
|
131
148
|
return addZero(convertYearToTwoDigit(dateVal), length);
|
|
132
149
|
}
|
|
150
|
+
|
|
133
151
|
return addZero(dateVal, length);
|
|
134
152
|
}
|
|
153
|
+
|
|
135
154
|
function concatDate(values, dateFormatArr, patternArr, fillPlaceHolder) {
|
|
136
155
|
let {
|
|
137
156
|
i18nShortMonths,
|
|
@@ -152,6 +171,7 @@ function concatDate(values, dateFormatArr, patternArr, fillPlaceHolder) {
|
|
|
152
171
|
}, '');
|
|
153
172
|
return dateString;
|
|
154
173
|
}
|
|
174
|
+
|
|
155
175
|
export function getDateTimeString() {
|
|
156
176
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
157
177
|
let dateFormatDetails = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -184,11 +204,13 @@ export function getDateTimeString() {
|
|
|
184
204
|
i18nMonths
|
|
185
205
|
});
|
|
186
206
|
let timeString = '';
|
|
207
|
+
|
|
187
208
|
if (isDateTime) {
|
|
188
209
|
hour = !getIsEmptyValue(hour) ? addZero(hour, 2) : is24Hour ? 'HH' : 'hh';
|
|
189
210
|
minute = !getIsEmptyValue(minute) ? addZero(minute, 2) : 'mm';
|
|
190
211
|
timeString = ` ${hour}:${minute} ${is24Hour ? '' : `${noon || '--'}`}`;
|
|
191
212
|
}
|
|
213
|
+
|
|
192
214
|
return `${dateString}${timeString}`;
|
|
193
215
|
}
|
|
194
216
|
export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
|
|
@@ -203,6 +225,7 @@ export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
|
|
|
203
225
|
minute,
|
|
204
226
|
noon
|
|
205
227
|
} = localValues;
|
|
228
|
+
|
|
206
229
|
if (value) {
|
|
207
230
|
const dateObj = isDateTime ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : value ? datetime.toDate(value) : new Date();
|
|
208
231
|
const selectedDay = dateObj.getDate();
|
|
@@ -211,13 +234,16 @@ export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
|
|
|
211
234
|
const newDay = day ? day : selectedDay;
|
|
212
235
|
const newMonth = month ? month : selectedMonth + 1;
|
|
213
236
|
const newYear = year ? year : selectedYear;
|
|
237
|
+
|
|
214
238
|
if (isDateTime) {
|
|
215
239
|
let selectedHour = dateObj.getHours();
|
|
216
240
|
const selectedMinute = dateObj.getMinutes();
|
|
217
241
|
const selectedNoon = selectedHour < 12 ? 'AM' : 'PM';
|
|
242
|
+
|
|
218
243
|
if (!is24Hour) {
|
|
219
244
|
selectedHour = selectedHour === 0 ? 12 : selectedHour > 12 ? selectedHour - 12 : selectedHour;
|
|
220
245
|
}
|
|
246
|
+
|
|
221
247
|
const newHour = hour ? hour : selectedHour;
|
|
222
248
|
const newMinute = minute ? minute : selectedMinute;
|
|
223
249
|
const newNoon = noon ? noon : selectedNoon;
|
|
@@ -230,12 +256,14 @@ export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
|
|
|
230
256
|
noon: newNoon
|
|
231
257
|
};
|
|
232
258
|
}
|
|
259
|
+
|
|
233
260
|
return {
|
|
234
261
|
day: newDay,
|
|
235
262
|
month: newMonth,
|
|
236
263
|
year: newYear
|
|
237
264
|
};
|
|
238
265
|
}
|
|
266
|
+
|
|
239
267
|
return localValues;
|
|
240
268
|
}
|
|
241
269
|
export function getIsValidDate(values, isDateTime, _ref2) {
|
|
@@ -259,6 +287,7 @@ export function getIsValidDate(values, isDateTime, _ref2) {
|
|
|
259
287
|
const value = parseInt(val);
|
|
260
288
|
return getIsEmptyValue(value);
|
|
261
289
|
}
|
|
290
|
+
|
|
262
291
|
return getIsEmptyValue(val);
|
|
263
292
|
});
|
|
264
293
|
const haveAllValues = valuesArr.every((val, index) => {
|
|
@@ -274,8 +303,10 @@ export function getIsValidDate(values, isDateTime, _ref2) {
|
|
|
274
303
|
} else if (val) {
|
|
275
304
|
return true;
|
|
276
305
|
}
|
|
306
|
+
|
|
277
307
|
return false;
|
|
278
308
|
});
|
|
309
|
+
|
|
279
310
|
if (haveAllValues) {
|
|
280
311
|
const dayEnd = getDayEnd(month, year);
|
|
281
312
|
const {
|
|
@@ -300,6 +331,7 @@ export function getIsValidDate(values, isDateTime, _ref2) {
|
|
|
300
331
|
const {
|
|
301
332
|
allowedValues: noonAllowedValues
|
|
302
333
|
} = getNoonDetails();
|
|
334
|
+
|
|
303
335
|
if (dayEnd < day || dayStart > day) {
|
|
304
336
|
isError = true;
|
|
305
337
|
message = 'Wrong Day';
|
|
@@ -323,6 +355,7 @@ export function getIsValidDate(values, isDateTime, _ref2) {
|
|
|
323
355
|
isError = true;
|
|
324
356
|
message = 'Empty value';
|
|
325
357
|
}
|
|
358
|
+
|
|
326
359
|
return {
|
|
327
360
|
isError,
|
|
328
361
|
message,
|
|
@@ -347,21 +380,25 @@ export function getSelectedDate(values, props) {
|
|
|
347
380
|
isDateTime,
|
|
348
381
|
is24Hour
|
|
349
382
|
} = props;
|
|
383
|
+
|
|
350
384
|
if (!is24Hour) {
|
|
351
385
|
if (parseInt(hour) === 12) {
|
|
352
386
|
hour = noon === 'AM' ? 0 : 12;
|
|
353
387
|
}
|
|
388
|
+
|
|
354
389
|
if (noon === 'PM') {
|
|
355
390
|
if (hour < 12) {
|
|
356
391
|
hour = parseInt(hour) + 12;
|
|
357
392
|
}
|
|
358
393
|
}
|
|
359
394
|
}
|
|
395
|
+
|
|
360
396
|
month = parseInt(month) - 1;
|
|
361
397
|
const minInMillis = min ? datetime.millis(min) : null,
|
|
362
|
-
|
|
398
|
+
maxInMillis = max ? datetime.millis(max) : null;
|
|
363
399
|
let selectedInMillis,
|
|
364
|
-
|
|
400
|
+
selectedValue = '';
|
|
401
|
+
|
|
365
402
|
if (isDateTime) {
|
|
366
403
|
selectedInMillis = datetime.tz.tzToUtc(Date.UTC(year, month, date, hour, mins), timeZone);
|
|
367
404
|
selectedValue = datetime.ISO(selectedInMillis);
|
|
@@ -369,8 +406,10 @@ export function getSelectedDate(values, props) {
|
|
|
369
406
|
selectedInMillis = Date.UTC(year, month, date);
|
|
370
407
|
selectedValue = formatDate(new Date(year, month, date), 'YYYY-MM-DD');
|
|
371
408
|
}
|
|
409
|
+
|
|
372
410
|
let isError = false;
|
|
373
411
|
let errorType = '';
|
|
412
|
+
|
|
374
413
|
if (minInMillis && minInMillis > selectedInMillis) {
|
|
375
414
|
isError = true;
|
|
376
415
|
errorType = 'MIN';
|
|
@@ -378,12 +417,14 @@ export function getSelectedDate(values, props) {
|
|
|
378
417
|
isError = true;
|
|
379
418
|
errorType = 'MAX';
|
|
380
419
|
}
|
|
420
|
+
|
|
381
421
|
return {
|
|
382
422
|
isError,
|
|
383
423
|
errorType,
|
|
384
424
|
selectedValue: selectedValue
|
|
385
425
|
};
|
|
386
426
|
}
|
|
427
|
+
|
|
387
428
|
function getDateFormatLength(type, length) {
|
|
388
429
|
let formatVal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
389
430
|
let {
|
|
@@ -412,16 +453,20 @@ function getDateFormatLength(type, length) {
|
|
|
412
453
|
}, isDateTime, timeZone, {
|
|
413
454
|
is24Hour
|
|
414
455
|
});
|
|
456
|
+
|
|
415
457
|
if (length === INCONSTANT) {
|
|
416
458
|
if (selectedMonth && formatVal === 'MMM' && i18nShortMonths.length) {
|
|
417
459
|
return i18nShortMonths[selectedMonth - 1].length;
|
|
418
460
|
} else if (selectedMonth && formatVal === 'MMMM' && i18nMonths.length) {
|
|
419
461
|
return i18nMonths[selectedMonth - 1].length;
|
|
420
462
|
}
|
|
463
|
+
|
|
421
464
|
return formatVal.length ? formatVal.length : 1;
|
|
422
465
|
}
|
|
466
|
+
|
|
423
467
|
return length;
|
|
424
468
|
}
|
|
469
|
+
|
|
425
470
|
export function getDateFormatSelection(dateFormatDetails, isDateTime) {
|
|
426
471
|
let {
|
|
427
472
|
i18nShortMonths,
|
|
@@ -444,20 +489,24 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
|
|
|
444
489
|
const clickIndex = {};
|
|
445
490
|
const order = [];
|
|
446
491
|
let tempLength = 0;
|
|
492
|
+
|
|
447
493
|
function addResult(type, length) {
|
|
448
494
|
const startIndex = tempLength;
|
|
449
495
|
const endIndex = tempLength + length;
|
|
450
496
|
const orderLen = order.length;
|
|
451
497
|
focusedIndex[`${startIndex}_${endIndex}`] = orderLen;
|
|
498
|
+
|
|
452
499
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
453
500
|
clickIndex[i] = orderLen;
|
|
454
501
|
}
|
|
502
|
+
|
|
455
503
|
order.push({
|
|
456
504
|
type,
|
|
457
505
|
index: [startIndex, endIndex]
|
|
458
506
|
});
|
|
459
507
|
tempLength += length;
|
|
460
508
|
}
|
|
509
|
+
|
|
461
510
|
dateFormatArr.forEach((formatVal, index) => {
|
|
462
511
|
const {
|
|
463
512
|
type,
|
|
@@ -481,38 +530,32 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
|
|
|
481
530
|
addResult(type, validLength);
|
|
482
531
|
tempLength += patternVal.length;
|
|
483
532
|
});
|
|
533
|
+
|
|
484
534
|
if (isDateTime) {
|
|
485
535
|
//For space between date and time
|
|
486
|
-
tempLength += 1;
|
|
536
|
+
tempLength += 1; //hour
|
|
487
537
|
|
|
488
|
-
//
|
|
489
|
-
addResult('hour', 2);
|
|
538
|
+
addResult('hour', 2); //For :
|
|
490
539
|
|
|
491
|
-
//
|
|
492
|
-
tempLength += 1;
|
|
540
|
+
tempLength += 1; //minute
|
|
493
541
|
|
|
494
|
-
//
|
|
495
|
-
addResult('minute', 2);
|
|
542
|
+
addResult('minute', 2); //For space between time and noon
|
|
496
543
|
|
|
497
|
-
|
|
498
|
-
tempLength += 1;
|
|
544
|
+
tempLength += 1; //noon
|
|
499
545
|
|
|
500
|
-
//noon
|
|
501
546
|
if (!is24Hour) {
|
|
502
547
|
addResult('noon', 2);
|
|
503
548
|
}
|
|
504
549
|
}
|
|
550
|
+
|
|
505
551
|
return {
|
|
506
552
|
focusedIndex,
|
|
507
553
|
clickIndex,
|
|
508
554
|
order
|
|
509
555
|
};
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// export function getDateValues(date = '', dateFormatDetails = {}) {
|
|
556
|
+
} // export function getDateValues(date = '', dateFormatDetails = {}) {
|
|
513
557
|
// const { dateFormatArr, patternArr, dayInfo, monthInfo, yearInfo } =
|
|
514
558
|
// dateFormatDetails;
|
|
515
|
-
|
|
516
559
|
// const newDate = date.split('').reduce((res, str) => {
|
|
517
560
|
// if (patternArr.indexOf(str) >= 0) {
|
|
518
561
|
// res += patternChangeStr;
|
|
@@ -521,21 +564,16 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
|
|
|
521
564
|
// }
|
|
522
565
|
// return res;
|
|
523
566
|
// }, '');
|
|
524
|
-
|
|
525
567
|
// const dateArr = newDate.split(patternChangeStr);
|
|
526
|
-
|
|
527
568
|
// const { index: dayIndex, length: dayLength } = dayInfo;
|
|
528
569
|
// let day = dateArr[dayIndex];
|
|
529
570
|
// day = addZero(day, dayLength);
|
|
530
|
-
|
|
531
571
|
// const { index: monthIndex, length: monthLength } = monthInfo;
|
|
532
572
|
// let month = dateArr[monthIndex];
|
|
533
573
|
// month = addZero(month, monthLength);
|
|
534
|
-
|
|
535
574
|
// const { index: yearIndex, length: yearLength } = yearInfo;
|
|
536
575
|
// let year = dateArr[yearIndex];
|
|
537
576
|
// year = addZero(year, yearLength);
|
|
538
|
-
|
|
539
577
|
// return {
|
|
540
578
|
// day,
|
|
541
579
|
// month,
|
|
@@ -543,21 +581,16 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
|
|
|
543
581
|
// dateString: concatDate({ day, month, year }, dateFormatArr, patternArr)
|
|
544
582
|
// };
|
|
545
583
|
// }
|
|
546
|
-
|
|
547
584
|
// export function getDateTimeValues(value = '', dateFormatDetails = {}) {
|
|
548
585
|
// const [date, time = '', noon = ''] = value.split(' ');
|
|
549
|
-
|
|
550
586
|
// let [hour = '', minute = ''] = time.split(':');
|
|
551
587
|
// hour = addZero(hour, 2);
|
|
552
588
|
// minute = addZero(minute, 2);
|
|
553
|
-
|
|
554
589
|
// const { day, month, year, dateString } = getDateValues(
|
|
555
590
|
// date,
|
|
556
591
|
// dateFormatDetails
|
|
557
592
|
// );
|
|
558
|
-
|
|
559
593
|
// const timeString = `${hour}:${minute}`;
|
|
560
|
-
|
|
561
594
|
// return {
|
|
562
595
|
// day,
|
|
563
596
|
// month,
|
|
@@ -6,11 +6,12 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
|
|
|
6
6
|
which
|
|
7
7
|
} = event;
|
|
8
8
|
const {
|
|
9
|
-
day = ''
|
|
9
|
+
day = ''
|
|
10
|
+
/*month = '', year = ''*/
|
|
11
|
+
|
|
10
12
|
} = values;
|
|
11
13
|
let isChanged = false;
|
|
12
|
-
let newDay = Number.parseInt(day) || 0;
|
|
13
|
-
// const newMonth = Number.parseInt(month) || 0;
|
|
14
|
+
let newDay = Number.parseInt(day) || 0; // const newMonth = Number.parseInt(month) || 0;
|
|
14
15
|
// const newYear = Number.parseInt(year) || 0;
|
|
15
16
|
|
|
16
17
|
const {
|
|
@@ -20,8 +21,11 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
|
|
|
20
21
|
const isNewType = getIsNewValueType(focusOrders, keyActions);
|
|
21
22
|
const {
|
|
22
23
|
startPoint,
|
|
23
|
-
endPoint
|
|
24
|
+
endPoint
|
|
25
|
+
/*getDayEnd(newMonth, newYear);*/
|
|
26
|
+
|
|
24
27
|
} = getDayDetails();
|
|
28
|
+
|
|
25
29
|
if (keyCode === 38) {
|
|
26
30
|
//up arrow
|
|
27
31
|
if (newDay === endPoint || !newDay) {
|
|
@@ -44,15 +48,19 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
|
|
|
44
48
|
const keyString = String.fromCharCode(which);
|
|
45
49
|
let newValue = isNewType ? keyString : day.toString() + keyString;
|
|
46
50
|
newValue = Number.parseInt(newValue);
|
|
51
|
+
|
|
47
52
|
if (isNewType) {
|
|
48
53
|
isChanged = true;
|
|
54
|
+
|
|
49
55
|
if (newValue * 10 > endPoint) {
|
|
50
56
|
newFocusOrder += 1;
|
|
51
57
|
}
|
|
58
|
+
|
|
52
59
|
newDay = newValue;
|
|
53
60
|
} else {
|
|
54
61
|
isChanged = true;
|
|
55
62
|
newFocusOrder += 1;
|
|
63
|
+
|
|
56
64
|
if (newValue > endPoint) {
|
|
57
65
|
newDay = endPoint;
|
|
58
66
|
} else if (!newValue) {
|
|
@@ -65,6 +73,7 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
|
|
|
65
73
|
isChanged = true;
|
|
66
74
|
newDay = '';
|
|
67
75
|
}
|
|
76
|
+
|
|
68
77
|
return {
|
|
69
78
|
day: newDay,
|
|
70
79
|
isChanged,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
/** * Libraries ** */
|
|
4
4
|
import datetime from '@zohodesk/datetimejs';
|
|
5
|
-
|
|
6
5
|
/** * Methods ** */
|
|
7
|
-
import { getMonthEnd } from '../../utils/datetime/common';
|
|
8
6
|
|
|
7
|
+
import { getMonthEnd } from '../../utils/datetime/common';
|
|
9
8
|
/** * Constants ** */
|
|
9
|
+
|
|
10
10
|
import { flags, INVALID_DATE } from '../constants';
|
|
11
11
|
export function convertYearToTwoDigit(year) {
|
|
12
12
|
return parseInt(year.toString().slice(-2));
|
|
@@ -15,6 +15,7 @@ export function addZero() {
|
|
|
15
15
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
16
16
|
let length = arguments.length > 1 ? arguments[1] : undefined;
|
|
17
17
|
let newValue = value.toString();
|
|
18
|
+
|
|
18
19
|
for (let i = 0; i < length; i++) {
|
|
19
20
|
if (newValue.length < length) {
|
|
20
21
|
newValue = `0${newValue}`;
|
|
@@ -22,16 +23,19 @@ export function addZero() {
|
|
|
22
23
|
break;
|
|
23
24
|
}
|
|
24
25
|
}
|
|
26
|
+
|
|
25
27
|
return newValue;
|
|
26
28
|
}
|
|
27
29
|
export function getDayEnd(month, year) {
|
|
28
30
|
month -= 1;
|
|
29
31
|
const monthend = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
32
|
+
|
|
30
33
|
if (month && year) {
|
|
31
34
|
return getMonthEnd(month, year);
|
|
32
35
|
} else if (month) {
|
|
33
36
|
return monthend[month];
|
|
34
37
|
}
|
|
38
|
+
|
|
35
39
|
return 31;
|
|
36
40
|
}
|
|
37
41
|
export function getIsNumberTyped(event) {
|
|
@@ -41,15 +45,18 @@ export function getIsNumberTyped(event) {
|
|
|
41
45
|
metaKey,
|
|
42
46
|
shiftKey
|
|
43
47
|
} = event;
|
|
48
|
+
|
|
44
49
|
if (keyCode >= 48 && keyCode <= 57 && !ctrlKey && !metaKey && !shiftKey) {
|
|
45
50
|
return true;
|
|
46
51
|
}
|
|
52
|
+
|
|
47
53
|
return false;
|
|
48
54
|
}
|
|
49
55
|
export function getIsDeleteTyped(keyCode) {
|
|
50
56
|
if (keyCode === 8) {
|
|
51
57
|
return true;
|
|
52
58
|
}
|
|
59
|
+
|
|
53
60
|
return false;
|
|
54
61
|
}
|
|
55
62
|
export function getIsNewValueType(focusOrders, keyActions) {
|
|
@@ -78,6 +85,7 @@ export function getMonthDetails() {
|
|
|
78
85
|
export function getYearDetails(yearLength) {
|
|
79
86
|
const dateObj = new Date();
|
|
80
87
|
const year = dateObj.getFullYear();
|
|
88
|
+
|
|
81
89
|
if (yearLength === 2) {
|
|
82
90
|
return {
|
|
83
91
|
startPoint: 0,
|
|
@@ -85,6 +93,7 @@ export function getYearDetails(yearLength) {
|
|
|
85
93
|
currentYear: year
|
|
86
94
|
};
|
|
87
95
|
}
|
|
96
|
+
|
|
88
97
|
return {
|
|
89
98
|
startPoint: 1850,
|
|
90
99
|
endPoint: 9999,
|
|
@@ -98,9 +107,11 @@ export function convertTwoDigitToYear() {
|
|
|
98
107
|
let year = dateObj.getFullYear();
|
|
99
108
|
const digitValueStr = addZero(digitValue.toString(), 2);
|
|
100
109
|
year = selectedYear ? selectedYear : year;
|
|
110
|
+
|
|
101
111
|
if (digitValueStr && digitValueStr.length <= 2) {
|
|
102
112
|
return parseInt(year.toString().slice(0, 2) + digitValueStr);
|
|
103
113
|
}
|
|
114
|
+
|
|
104
115
|
return digitValue;
|
|
105
116
|
}
|
|
106
117
|
export function getHourDetails(is24Hour) {
|
|
@@ -115,10 +126,12 @@ export function getHourSuggestions(is24Hour) {
|
|
|
115
126
|
endPoint
|
|
116
127
|
} = getHourDetails(is24Hour);
|
|
117
128
|
const hourArr = [];
|
|
129
|
+
|
|
118
130
|
for (let hour = startPoint; hour <= endPoint; hour++) {
|
|
119
131
|
const htxt = addZeroIfNeeded(hour);
|
|
120
132
|
hourArr.push(htxt);
|
|
121
133
|
}
|
|
134
|
+
|
|
122
135
|
return hourArr;
|
|
123
136
|
}
|
|
124
137
|
export function getMinuteDetails() {
|
|
@@ -133,10 +146,12 @@ export function getMinuteSuggestions() {
|
|
|
133
146
|
endPoint
|
|
134
147
|
} = getMinuteDetails();
|
|
135
148
|
const minArr = [];
|
|
149
|
+
|
|
136
150
|
for (let minute = startPoint; minute <= endPoint; minute++) {
|
|
137
151
|
const mtxt = addZeroIfNeeded(minute);
|
|
138
152
|
minArr.push(mtxt);
|
|
139
153
|
}
|
|
154
|
+
|
|
140
155
|
return minArr;
|
|
141
156
|
}
|
|
142
157
|
export function addZeroIfNeeded(value) {
|
|
@@ -146,12 +161,14 @@ export function getIsNoonValueTyped(event) {
|
|
|
146
161
|
const {
|
|
147
162
|
keyCode
|
|
148
163
|
} = event;
|
|
164
|
+
|
|
149
165
|
if (keyCode === 65 || keyCode === 77 || keyCode === 80) {
|
|
150
166
|
//A -65
|
|
151
167
|
//M -77
|
|
152
168
|
//P -80
|
|
153
169
|
return true;
|
|
154
170
|
}
|
|
171
|
+
|
|
155
172
|
return false;
|
|
156
173
|
}
|
|
157
174
|
export function getNoonDetails() {
|
|
@@ -159,32 +176,42 @@ export function getNoonDetails() {
|
|
|
159
176
|
allowedValues: ['AM', 'PM']
|
|
160
177
|
};
|
|
161
178
|
}
|
|
179
|
+
|
|
162
180
|
function getIsArrowTyped(keyCode) {
|
|
163
181
|
const arrowKeycodes = [37, 38, 39, 40];
|
|
182
|
+
|
|
164
183
|
if (arrowKeycodes.indexOf(keyCode) >= 0) {
|
|
165
184
|
return true;
|
|
166
185
|
}
|
|
186
|
+
|
|
167
187
|
return false;
|
|
168
188
|
}
|
|
189
|
+
|
|
169
190
|
export function getIsSupportedKey(event) {
|
|
170
191
|
const {
|
|
171
192
|
keyCode
|
|
172
193
|
} = event;
|
|
194
|
+
|
|
173
195
|
if (getIsArrowTyped(keyCode) || getIsDeleteTyped(keyCode) || getIsNumberTyped(event) || getIsNoonValueTyped(event)) {
|
|
174
196
|
return true;
|
|
175
197
|
}
|
|
198
|
+
|
|
176
199
|
return false;
|
|
177
200
|
}
|
|
178
201
|
export function arrayIsNotEqual(a, b) {
|
|
179
202
|
return a.some((val, index) => val !== b[index]);
|
|
180
203
|
}
|
|
204
|
+
|
|
181
205
|
function getIsEmptyValue(value, startPoint, endPoint) {
|
|
182
206
|
const newValue = parseInt(value) || 0;
|
|
207
|
+
|
|
183
208
|
if (newValue >= startPoint && newValue <= endPoint) {
|
|
184
209
|
return false;
|
|
185
210
|
}
|
|
211
|
+
|
|
186
212
|
return true;
|
|
187
213
|
}
|
|
214
|
+
|
|
188
215
|
export function getIsEmptyHour(value, is24Hour) {
|
|
189
216
|
const {
|
|
190
217
|
startPoint,
|
|
@@ -206,6 +233,7 @@ export function getIsCurrentYear(_ref) {
|
|
|
206
233
|
timeZone
|
|
207
234
|
} = _ref;
|
|
208
235
|
let isCurrentYear = false;
|
|
236
|
+
|
|
209
237
|
if (value && value !== INVALID_DATE) {
|
|
210
238
|
const dateObj = isDateTime ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : datetime.toDate(value);
|
|
211
239
|
const currentDateObj = new Date();
|
|
@@ -213,6 +241,7 @@ export function getIsCurrentYear(_ref) {
|
|
|
213
241
|
const selectedYear = dateObj.getFullYear();
|
|
214
242
|
isCurrentYear = currentYear === selectedYear;
|
|
215
243
|
}
|
|
244
|
+
|
|
216
245
|
return {
|
|
217
246
|
isCurrentYear
|
|
218
247
|
};
|
|
@@ -225,6 +254,7 @@ export function removeYearPattern(dateFormatArr, patternArr) {
|
|
|
225
254
|
const {
|
|
226
255
|
type
|
|
227
256
|
} = flags[val];
|
|
257
|
+
|
|
228
258
|
if (type === 'year') {
|
|
229
259
|
yearIndex = index;
|
|
230
260
|
} else {
|