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