@zohodesk/components 1.0.0-alpha-271 → 1.0.0-alpha-272
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 +4 -0
- 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/Avatar/Avatar.js +23 -11
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/Button/Button.js +4 -3
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Card/Card.js +21 -10
- package/es/CheckBox/CheckBox.js +5 -3
- package/es/DateTime/CalendarView.js +32 -20
- package/es/DateTime/DateTime.js +75 -10
- package/es/DateTime/DateTimePopupFooter.js +4 -2
- package/es/DateTime/DateTimePopupHeader.js +8 -2
- package/es/DateTime/DateWidget.js +98 -35
- package/es/DateTime/DaysRow.js +4 -2
- package/es/DateTime/Time.js +10 -2
- package/es/DateTime/YearView.js +28 -4
- 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/props/defaultProps.js +2 -1
- 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/cssJSLogic.js +5 -3
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
- 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/DropDownHeading.js +4 -5
- package/es/DropDown/DropDownItem.js +6 -0
- package/es/DropDown/DropDownSearch.js +4 -0
- package/es/DropDown/DropDownSeparator.js +1 -0
- package/es/DropDown/__tests__/DropDown.spec.js +1 -2
- package/es/Heading/Heading.js +2 -3
- package/es/Label/Label.js +2 -3
- package/es/Layout/Box.js +13 -0
- package/es/Layout/Container.js +12 -1
- package/es/Layout/index.js +1 -2
- package/es/ListItem/ListContainer.js +8 -3
- package/es/ListItem/ListItem.js +9 -3
- 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/MultiSelectHeader.js +3 -0
- package/es/MultiSelect/MultiSelectWithAvatar.js +12 -6
- package/es/MultiSelect/SelectedOptions.js +6 -3
- 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/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/Ribbon/Ribbon.js +3 -2
- package/es/RippleEffect/RippleEffect.js +1 -3
- package/es/Select/GroupSelect.js +58 -14
- package/es/Select/Select.js +79 -33
- 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/Switch/Switch.js +5 -3
- package/es/Tab/Tab.js +4 -4
- 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/__tests__/Tab.spec.js +1 -3
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
- package/es/Tag/Tag.js +6 -3
- package/es/TextBox/TextBox.js +15 -3
- package/es/TextBox/__tests__/TextBox.spec.js +1 -4
- package/es/TextBoxIcon/TextBoxIcon.js +9 -2
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
- package/es/Textarea/Textarea.js +12 -3
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +58 -14
- 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/deprecated/PortalLayer/PortalLayer.js +25 -20
- package/es/semantic/Button/Button.js +3 -2
- 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/GMTZones.js +48 -0
- package/es/utils/datetime/common.js +31 -7
- 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/props/propTypes.js +3 -0
- package/lib/Avatar/Avatar.js +78 -38
- 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/__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/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/__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/__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 +246 -158
- package/lib/DateTime/DateTimePopupFooter.js +31 -8
- package/lib/DateTime/DateTimePopupHeader.js +48 -17
- package/lib/DateTime/DateWidget.js +352 -250
- package/lib/DateTime/DaysRow.js +27 -5
- package/lib/DateTime/Time.js +73 -32
- package/lib/DateTime/YearView.js +77 -28
- 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 +54 -22
- 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/defaultProps.js +2 -1
- 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 +59 -38
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +42 -34
- 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/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/DropDownHeading.js +39 -20
- package/lib/DropDown/DropDownItem.js +42 -20
- package/lib/DropDown/DropDownSearch.js +40 -17
- package/lib/DropDown/DropDownSeparator.js +24 -4
- 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/props/propTypes.js +3 -0
- package/lib/Label/Label.js +39 -19
- 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/__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 +48 -27
- package/lib/ListItem/ListItem.js +69 -45
- package/lib/ListItem/ListItemWithAvatar.js +75 -48
- package/lib/ListItem/ListItemWithCheckBox.js +64 -39
- package/lib/ListItem/ListItemWithIcon.js +68 -44
- 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 +45 -10
- package/lib/Modal/props/propTypes.js +3 -0
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +294 -166
- package/lib/MultiSelect/AdvancedMultiSelect.js +202 -125
- package/lib/MultiSelect/EmptyState.js +45 -24
- package/lib/MultiSelect/MultiSelect.js +323 -206
- package/lib/MultiSelect/MultiSelectHeader.js +30 -8
- package/lib/MultiSelect/MultiSelectWithAvatar.js +105 -63
- package/lib/MultiSelect/SelectedOptions.js +43 -17
- package/lib/MultiSelect/Suggestions.js +64 -32
- 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 +158 -81
- package/lib/Popup/__tests__/Popup.spec.js +43 -8
- 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 +61 -38
- package/lib/Radio/__tests__/Radiospec.js +9 -5
- package/lib/Radio/props/propTypes.js +3 -0
- package/lib/Responsive/CustomResponsive.js +73 -29
- package/lib/Responsive/RefWrapper.js +17 -11
- package/lib/Responsive/ResizeComponent.js +62 -36
- package/lib/Responsive/ResizeObserver.js +24 -10
- package/lib/Responsive/Responsive.js +80 -30
- 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/props/propTypes.js +3 -0
- package/lib/Ribbon/Ribbon.js +33 -13
- 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 +229 -130
- package/lib/Select/Select.js +290 -209
- package/lib/Select/SelectWithAvatar.js +102 -56
- package/lib/Select/SelectWithIcon.js +132 -76
- package/lib/Select/__tests__/Select.spec.js +133 -91
- 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 +29 -10
- 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/props/propTypes.js +3 -0
- package/lib/Tab/Tab.js +40 -27
- 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 +171 -91
- 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/__tests__/Tag.spec.js +14 -8
- package/lib/Tag/props/propTypes.js +3 -0
- package/lib/TextBox/TextBox.js +85 -59
- 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/__tests__/TextBoxIcon.spec.js +14 -5
- package/lib/TextBoxIcon/props/propTypes.js +3 -0
- package/lib/Textarea/Textarea.js +54 -29
- 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/__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/css.js +40 -0
- package/lib/deprecated/PortalLayer/PortalLayer.js +46 -23
- 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/index.js +2 -0
- package/lib/utils/Common.js +110 -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/GMTZones.js +55 -0
- package/lib/utils/datetime/common.js +52 -7
- package/lib/utils/debounce.js +6 -1
- package/lib/utils/dropDownUtils.js +175 -59
- 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
|
@@ -4,25 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getChangedDay = getChangedDay;
|
|
7
|
+
|
|
7
8
|
var _index = require("./index");
|
|
8
|
-
/** * Methods ** */
|
|
9
9
|
|
|
10
|
+
/** * Methods ** */
|
|
10
11
|
function getChangedDay(values, event, focusOrders, keyActions) {
|
|
11
12
|
var keyCode = event.keyCode,
|
|
12
|
-
|
|
13
|
+
which = event.which;
|
|
13
14
|
var _values$day = values.day,
|
|
14
|
-
|
|
15
|
+
day = _values$day === void 0 ? '' : _values$day;
|
|
15
16
|
var isChanged = false;
|
|
16
|
-
var newDay = Number.parseInt(day) || 0;
|
|
17
|
-
// const newMonth = Number.parseInt(month) || 0;
|
|
17
|
+
var newDay = Number.parseInt(day) || 0; // const newMonth = Number.parseInt(month) || 0;
|
|
18
18
|
// const newYear = Number.parseInt(year) || 0;
|
|
19
19
|
|
|
20
20
|
var focusOrder = focusOrders.focusOrder;
|
|
21
21
|
var newFocusOrder = focusOrder;
|
|
22
22
|
var isNewType = (0, _index.getIsNewValueType)(focusOrders, keyActions);
|
|
23
|
+
|
|
23
24
|
var _getDayDetails = (0, _index.getDayDetails)(),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
startPoint = _getDayDetails.startPoint,
|
|
26
|
+
endPoint = _getDayDetails.endPoint;
|
|
27
|
+
|
|
26
28
|
if (keyCode === 38) {
|
|
27
29
|
//up arrow
|
|
28
30
|
if (newDay === endPoint || !newDay) {
|
|
@@ -45,15 +47,19 @@ function getChangedDay(values, event, focusOrders, keyActions) {
|
|
|
45
47
|
var keyString = String.fromCharCode(which);
|
|
46
48
|
var newValue = isNewType ? keyString : day.toString() + keyString;
|
|
47
49
|
newValue = Number.parseInt(newValue);
|
|
50
|
+
|
|
48
51
|
if (isNewType) {
|
|
49
52
|
isChanged = true;
|
|
53
|
+
|
|
50
54
|
if (newValue * 10 > endPoint) {
|
|
51
55
|
newFocusOrder += 1;
|
|
52
56
|
}
|
|
57
|
+
|
|
53
58
|
newDay = newValue;
|
|
54
59
|
} else {
|
|
55
60
|
isChanged = true;
|
|
56
61
|
newFocusOrder += 1;
|
|
62
|
+
|
|
57
63
|
if (newValue > endPoint) {
|
|
58
64
|
newDay = endPoint;
|
|
59
65
|
} else if (!newValue) {
|
|
@@ -66,6 +72,7 @@ function getChangedDay(values, event, focusOrders, keyActions) {
|
|
|
66
72
|
isChanged = true;
|
|
67
73
|
newDay = '';
|
|
68
74
|
}
|
|
75
|
+
|
|
69
76
|
return {
|
|
70
77
|
day: newDay,
|
|
71
78
|
isChanged: isChanged,
|
|
@@ -26,10 +26,15 @@ exports.getMonthDetails = getMonthDetails;
|
|
|
26
26
|
exports.getNoonDetails = getNoonDetails;
|
|
27
27
|
exports.getYearDetails = getYearDetails;
|
|
28
28
|
exports.removeYearPattern = removeYearPattern;
|
|
29
|
+
|
|
29
30
|
var _datetimejs = _interopRequireDefault(require("@zohodesk/datetimejs"));
|
|
31
|
+
|
|
30
32
|
var _common = require("../../utils/datetime/common");
|
|
33
|
+
|
|
31
34
|
var _constants = require("../constants");
|
|
35
|
+
|
|
32
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
|
+
|
|
33
38
|
/* eslint-disable no-param-reassign */
|
|
34
39
|
|
|
35
40
|
/** * Libraries ** */
|
|
@@ -37,14 +42,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
37
42
|
/** * Methods ** */
|
|
38
43
|
|
|
39
44
|
/** * Constants ** */
|
|
40
|
-
|
|
41
45
|
function convertYearToTwoDigit(year) {
|
|
42
46
|
return parseInt(year.toString().slice(-2));
|
|
43
47
|
}
|
|
48
|
+
|
|
44
49
|
function addZero() {
|
|
45
50
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
46
51
|
var length = arguments.length > 1 ? arguments[1] : undefined;
|
|
47
52
|
var newValue = value.toString();
|
|
53
|
+
|
|
48
54
|
for (var i = 0; i < length; i++) {
|
|
49
55
|
if (newValue.length < length) {
|
|
50
56
|
newValue = "0".concat(newValue);
|
|
@@ -52,56 +58,70 @@ function addZero() {
|
|
|
52
58
|
break;
|
|
53
59
|
}
|
|
54
60
|
}
|
|
61
|
+
|
|
55
62
|
return newValue;
|
|
56
63
|
}
|
|
64
|
+
|
|
57
65
|
function getDayEnd(month, year) {
|
|
58
66
|
month -= 1;
|
|
59
67
|
var monthend = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
68
|
+
|
|
60
69
|
if (month && year) {
|
|
61
70
|
return (0, _common.getMonthEnd)(month, year);
|
|
62
71
|
} else if (month) {
|
|
63
72
|
return monthend[month];
|
|
64
73
|
}
|
|
74
|
+
|
|
65
75
|
return 31;
|
|
66
76
|
}
|
|
77
|
+
|
|
67
78
|
function getIsNumberTyped(event) {
|
|
68
79
|
var keyCode = event.keyCode,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
ctrlKey = event.ctrlKey,
|
|
81
|
+
metaKey = event.metaKey,
|
|
82
|
+
shiftKey = event.shiftKey;
|
|
83
|
+
|
|
72
84
|
if (keyCode >= 48 && keyCode <= 57 && !ctrlKey && !metaKey && !shiftKey) {
|
|
73
85
|
return true;
|
|
74
86
|
}
|
|
87
|
+
|
|
75
88
|
return false;
|
|
76
89
|
}
|
|
90
|
+
|
|
77
91
|
function getIsDeleteTyped(keyCode) {
|
|
78
92
|
if (keyCode === 8) {
|
|
79
93
|
return true;
|
|
80
94
|
}
|
|
95
|
+
|
|
81
96
|
return false;
|
|
82
97
|
}
|
|
98
|
+
|
|
83
99
|
function getIsNewValueType(focusOrders, keyActions) {
|
|
84
100
|
var focusOrder = focusOrders.focusOrder,
|
|
85
|
-
|
|
101
|
+
oldFocusOrder = focusOrders.oldFocusOrder;
|
|
86
102
|
var oldKeyAction = keyActions.oldKeyAction,
|
|
87
|
-
|
|
103
|
+
keyAction = keyActions.keyAction;
|
|
88
104
|
return focusOrder !== oldFocusOrder || oldKeyAction !== keyAction;
|
|
89
105
|
}
|
|
106
|
+
|
|
90
107
|
function getDayDetails() {
|
|
91
108
|
return {
|
|
92
109
|
startPoint: 1,
|
|
93
110
|
endPoint: 31
|
|
94
111
|
};
|
|
95
112
|
}
|
|
113
|
+
|
|
96
114
|
function getMonthDetails() {
|
|
97
115
|
return {
|
|
98
116
|
startPoint: 1,
|
|
99
117
|
endPoint: 12
|
|
100
118
|
};
|
|
101
119
|
}
|
|
120
|
+
|
|
102
121
|
function getYearDetails(yearLength) {
|
|
103
122
|
var dateObj = new Date();
|
|
104
123
|
var year = dateObj.getFullYear();
|
|
124
|
+
|
|
105
125
|
if (yearLength === 2) {
|
|
106
126
|
return {
|
|
107
127
|
startPoint: 0,
|
|
@@ -109,12 +129,14 @@ function getYearDetails(yearLength) {
|
|
|
109
129
|
currentYear: year
|
|
110
130
|
};
|
|
111
131
|
}
|
|
132
|
+
|
|
112
133
|
return {
|
|
113
134
|
startPoint: 1850,
|
|
114
135
|
endPoint: 9999,
|
|
115
136
|
currentYear: year
|
|
116
137
|
};
|
|
117
138
|
}
|
|
139
|
+
|
|
118
140
|
function convertTwoDigitToYear() {
|
|
119
141
|
var digitValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
120
142
|
var selectedYear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -122,106 +144,139 @@ function convertTwoDigitToYear() {
|
|
|
122
144
|
var year = dateObj.getFullYear();
|
|
123
145
|
var digitValueStr = addZero(digitValue.toString(), 2);
|
|
124
146
|
year = selectedYear ? selectedYear : year;
|
|
147
|
+
|
|
125
148
|
if (digitValueStr && digitValueStr.length <= 2) {
|
|
126
149
|
return parseInt(year.toString().slice(0, 2) + digitValueStr);
|
|
127
150
|
}
|
|
151
|
+
|
|
128
152
|
return digitValue;
|
|
129
153
|
}
|
|
154
|
+
|
|
130
155
|
function getHourDetails(is24Hour) {
|
|
131
156
|
return {
|
|
132
157
|
startPoint: is24Hour ? 0 : 1,
|
|
133
158
|
endPoint: is24Hour ? 23 : 12
|
|
134
159
|
};
|
|
135
160
|
}
|
|
161
|
+
|
|
136
162
|
function getHourSuggestions(is24Hour) {
|
|
137
163
|
var _getHourDetails = getHourDetails(is24Hour),
|
|
138
|
-
|
|
139
|
-
|
|
164
|
+
startPoint = _getHourDetails.startPoint,
|
|
165
|
+
endPoint = _getHourDetails.endPoint;
|
|
166
|
+
|
|
140
167
|
var hourArr = [];
|
|
168
|
+
|
|
141
169
|
for (var hour = startPoint; hour <= endPoint; hour++) {
|
|
142
170
|
var htxt = addZeroIfNeeded(hour);
|
|
143
171
|
hourArr.push(htxt);
|
|
144
172
|
}
|
|
173
|
+
|
|
145
174
|
return hourArr;
|
|
146
175
|
}
|
|
176
|
+
|
|
147
177
|
function getMinuteDetails() {
|
|
148
178
|
return {
|
|
149
179
|
startPoint: 0,
|
|
150
180
|
endPoint: 59
|
|
151
181
|
};
|
|
152
182
|
}
|
|
183
|
+
|
|
153
184
|
function getMinuteSuggestions() {
|
|
154
185
|
var _getMinuteDetails = getMinuteDetails(),
|
|
155
|
-
|
|
156
|
-
|
|
186
|
+
startPoint = _getMinuteDetails.startPoint,
|
|
187
|
+
endPoint = _getMinuteDetails.endPoint;
|
|
188
|
+
|
|
157
189
|
var minArr = [];
|
|
190
|
+
|
|
158
191
|
for (var minute = startPoint; minute <= endPoint; minute++) {
|
|
159
192
|
var mtxt = addZeroIfNeeded(minute);
|
|
160
193
|
minArr.push(mtxt);
|
|
161
194
|
}
|
|
195
|
+
|
|
162
196
|
return minArr;
|
|
163
197
|
}
|
|
198
|
+
|
|
164
199
|
function addZeroIfNeeded(value) {
|
|
165
200
|
return value < 10 ? "0".concat(value) : value;
|
|
166
201
|
}
|
|
202
|
+
|
|
167
203
|
function getIsNoonValueTyped(event) {
|
|
168
204
|
var keyCode = event.keyCode;
|
|
205
|
+
|
|
169
206
|
if (keyCode === 65 || keyCode === 77 || keyCode === 80) {
|
|
170
207
|
//A -65
|
|
171
208
|
//M -77
|
|
172
209
|
//P -80
|
|
173
210
|
return true;
|
|
174
211
|
}
|
|
212
|
+
|
|
175
213
|
return false;
|
|
176
214
|
}
|
|
215
|
+
|
|
177
216
|
function getNoonDetails() {
|
|
178
217
|
return {
|
|
179
218
|
allowedValues: ['AM', 'PM']
|
|
180
219
|
};
|
|
181
220
|
}
|
|
221
|
+
|
|
182
222
|
function getIsArrowTyped(keyCode) {
|
|
183
223
|
var arrowKeycodes = [37, 38, 39, 40];
|
|
224
|
+
|
|
184
225
|
if (arrowKeycodes.indexOf(keyCode) >= 0) {
|
|
185
226
|
return true;
|
|
186
227
|
}
|
|
228
|
+
|
|
187
229
|
return false;
|
|
188
230
|
}
|
|
231
|
+
|
|
189
232
|
function getIsSupportedKey(event) {
|
|
190
233
|
var keyCode = event.keyCode;
|
|
234
|
+
|
|
191
235
|
if (getIsArrowTyped(keyCode) || getIsDeleteTyped(keyCode) || getIsNumberTyped(event) || getIsNoonValueTyped(event)) {
|
|
192
236
|
return true;
|
|
193
237
|
}
|
|
238
|
+
|
|
194
239
|
return false;
|
|
195
240
|
}
|
|
241
|
+
|
|
196
242
|
function arrayIsNotEqual(a, b) {
|
|
197
243
|
return a.some(function (val, index) {
|
|
198
244
|
return val !== b[index];
|
|
199
245
|
});
|
|
200
246
|
}
|
|
247
|
+
|
|
201
248
|
function getIsEmptyValue(value, startPoint, endPoint) {
|
|
202
249
|
var newValue = parseInt(value) || 0;
|
|
250
|
+
|
|
203
251
|
if (newValue >= startPoint && newValue <= endPoint) {
|
|
204
252
|
return false;
|
|
205
253
|
}
|
|
254
|
+
|
|
206
255
|
return true;
|
|
207
256
|
}
|
|
257
|
+
|
|
208
258
|
function getIsEmptyHour(value, is24Hour) {
|
|
209
259
|
var _getHourDetails2 = getHourDetails(is24Hour),
|
|
210
|
-
|
|
211
|
-
|
|
260
|
+
startPoint = _getHourDetails2.startPoint,
|
|
261
|
+
endPoint = _getHourDetails2.endPoint;
|
|
262
|
+
|
|
212
263
|
return getIsEmptyValue(value, startPoint, endPoint);
|
|
213
264
|
}
|
|
265
|
+
|
|
214
266
|
function getIsEmptyYear(value, yearLength) {
|
|
215
267
|
var _getYearDetails = getYearDetails(yearLength),
|
|
216
|
-
|
|
217
|
-
|
|
268
|
+
startPoint = _getYearDetails.startPoint,
|
|
269
|
+
endPoint = _getYearDetails.endPoint;
|
|
270
|
+
|
|
218
271
|
return getIsEmptyValue(value, startPoint, endPoint);
|
|
219
272
|
}
|
|
273
|
+
|
|
220
274
|
function getIsCurrentYear(_ref) {
|
|
221
275
|
var isDateTime = _ref.isDateTime,
|
|
222
|
-
|
|
223
|
-
|
|
276
|
+
value = _ref.value,
|
|
277
|
+
timeZone = _ref.timeZone;
|
|
224
278
|
var isCurrentYear = false;
|
|
279
|
+
|
|
225
280
|
if (value && value !== _constants.INVALID_DATE) {
|
|
226
281
|
var dateObj = isDateTime ? _datetimejs["default"].toDate(_datetimejs["default"].tz.utcToTz(value, timeZone)) : _datetimejs["default"].toDate(value);
|
|
227
282
|
var currentDateObj = new Date();
|
|
@@ -229,16 +284,19 @@ function getIsCurrentYear(_ref) {
|
|
|
229
284
|
var selectedYear = dateObj.getFullYear();
|
|
230
285
|
isCurrentYear = currentYear === selectedYear;
|
|
231
286
|
}
|
|
287
|
+
|
|
232
288
|
return {
|
|
233
289
|
isCurrentYear: isCurrentYear
|
|
234
290
|
};
|
|
235
291
|
}
|
|
292
|
+
|
|
236
293
|
function removeYearPattern(dateFormatArr, patternArr) {
|
|
237
294
|
var newDateFormatArr = [];
|
|
238
295
|
var newPatternArr = [];
|
|
239
296
|
var yearIndex = '';
|
|
240
297
|
dateFormatArr.forEach(function (val, index) {
|
|
241
298
|
var type = _constants.flags[val].type;
|
|
299
|
+
|
|
242
300
|
if (type === 'year') {
|
|
243
301
|
yearIndex = index;
|
|
244
302
|
} else {
|
|
@@ -4,18 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getChangedMonth = getChangedMonth;
|
|
7
|
+
|
|
7
8
|
var _index = require("./index");
|
|
8
|
-
/** * Methods ** */
|
|
9
9
|
|
|
10
|
+
/** * Methods ** */
|
|
10
11
|
function getChangedMonth(values, event, focusOrders, keyActions) {
|
|
11
12
|
var keyCode = event.keyCode,
|
|
12
|
-
|
|
13
|
+
which = event.which;
|
|
13
14
|
var _values$day = values.day,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
day = _values$day === void 0 ? '' : _values$day,
|
|
16
|
+
_values$month = values.month,
|
|
17
|
+
month = _values$month === void 0 ? '' : _values$month,
|
|
18
|
+
_values$year = values.year,
|
|
19
|
+
year = _values$year === void 0 ? '' : _values$year;
|
|
19
20
|
var isChanged = false;
|
|
20
21
|
var newDay = Number.parseInt(day) || 0;
|
|
21
22
|
var newMonth = Number.parseInt(month) || 0;
|
|
@@ -23,9 +24,11 @@ function getChangedMonth(values, event, focusOrders, keyActions) {
|
|
|
23
24
|
var focusOrder = focusOrders.focusOrder;
|
|
24
25
|
var newFocusOrder = focusOrder;
|
|
25
26
|
var isNewType = (0, _index.getIsNewValueType)(focusOrders, keyActions);
|
|
27
|
+
|
|
26
28
|
var _getMonthDetails = (0, _index.getMonthDetails)(),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
startPoint = _getMonthDetails.startPoint,
|
|
30
|
+
endPoint = _getMonthDetails.endPoint;
|
|
31
|
+
|
|
29
32
|
if (keyCode === 38) {
|
|
30
33
|
//up arrow
|
|
31
34
|
if (newMonth === endPoint || !newMonth) {
|
|
@@ -48,15 +51,19 @@ function getChangedMonth(values, event, focusOrders, keyActions) {
|
|
|
48
51
|
var keyString = String.fromCharCode(which);
|
|
49
52
|
var newValue = isNewType ? keyString : month.toString() + keyString;
|
|
50
53
|
newValue = Number.parseInt(newValue);
|
|
54
|
+
|
|
51
55
|
if (isNewType) {
|
|
52
56
|
isChanged = true;
|
|
57
|
+
|
|
53
58
|
if (newValue * 10 > endPoint) {
|
|
54
59
|
newFocusOrder += 1;
|
|
55
60
|
}
|
|
61
|
+
|
|
56
62
|
newMonth = newValue;
|
|
57
63
|
} else {
|
|
58
64
|
isChanged = true;
|
|
59
65
|
newFocusOrder += 1;
|
|
66
|
+
|
|
60
67
|
if (newValue > endPoint) {
|
|
61
68
|
newMonth = endPoint;
|
|
62
69
|
} else if (!newValue) {
|
|
@@ -69,12 +76,15 @@ function getChangedMonth(values, event, focusOrders, keyActions) {
|
|
|
69
76
|
isChanged = true;
|
|
70
77
|
newMonth = '';
|
|
71
78
|
}
|
|
79
|
+
|
|
72
80
|
var dayEnd = (0, _index.getDayEnd)(newMonth, newYear);
|
|
73
81
|
var dayChanged = false;
|
|
82
|
+
|
|
74
83
|
if (newDay && newDay > dayEnd) {
|
|
75
84
|
dayChanged = true;
|
|
76
85
|
newDay = dayEnd;
|
|
77
86
|
}
|
|
87
|
+
|
|
78
88
|
return {
|
|
79
89
|
day: dayChanged ? newDay : day,
|
|
80
90
|
month: newMonth,
|
|
@@ -6,30 +6,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getChangedHour = getChangedHour;
|
|
7
7
|
exports.getChangedMinute = getChangedMinute;
|
|
8
8
|
exports.getChangedNoon = getChangedNoon;
|
|
9
|
+
|
|
9
10
|
var _index = require("./index");
|
|
11
|
+
|
|
10
12
|
var _Common = require("../../utils/Common");
|
|
13
|
+
|
|
11
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
|
|
12
16
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
|
|
13
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
|
|
15
|
-
function
|
|
19
|
+
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
21
|
+
|
|
22
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
23
|
+
|
|
16
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
+
|
|
17
26
|
function getChangedHour(values, event, focusOrders, keyActions) {
|
|
18
27
|
var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
_ref$is24Hour = _ref.is24Hour,
|
|
29
|
+
is24Hour = _ref$is24Hour === void 0 ? false : _ref$is24Hour;
|
|
30
|
+
|
|
21
31
|
var keyCode = event.keyCode,
|
|
22
|
-
|
|
32
|
+
which = event.which;
|
|
23
33
|
var _values$hour = values.hour,
|
|
24
|
-
|
|
34
|
+
hour = _values$hour === void 0 ? '' : _values$hour;
|
|
25
35
|
var isChanged = false;
|
|
26
36
|
var newHour = Number.parseInt(hour) || 0;
|
|
27
37
|
var focusOrder = focusOrders.focusOrder;
|
|
28
38
|
var newFocusOrder = focusOrder;
|
|
29
39
|
var isNewType = (0, _index.getIsNewValueType)(focusOrders, keyActions);
|
|
40
|
+
|
|
30
41
|
var _getHourDetails = (0, _index.getHourDetails)(is24Hour),
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
startPoint = _getHourDetails.startPoint,
|
|
43
|
+
endPoint = _getHourDetails.endPoint;
|
|
44
|
+
|
|
33
45
|
if (keyCode === 38) {
|
|
34
46
|
//up arrow
|
|
35
47
|
if (newHour === endPoint || (0, _index.getIsEmptyHour)(newHour, is24Hour)) {
|
|
@@ -52,15 +64,19 @@ function getChangedHour(values, event, focusOrders, keyActions) {
|
|
|
52
64
|
var keyString = String.fromCharCode(which);
|
|
53
65
|
var newValue = isNewType ? keyString : hour.toString() + keyString;
|
|
54
66
|
newValue = Number.parseInt(newValue);
|
|
67
|
+
|
|
55
68
|
if (isNewType) {
|
|
56
69
|
isChanged = true;
|
|
70
|
+
|
|
57
71
|
if (newValue * 10 > endPoint) {
|
|
58
72
|
newFocusOrder += 1;
|
|
59
73
|
}
|
|
74
|
+
|
|
60
75
|
newHour = newValue;
|
|
61
76
|
} else {
|
|
62
77
|
isChanged = true;
|
|
63
78
|
newFocusOrder += 1;
|
|
79
|
+
|
|
64
80
|
if (newValue > endPoint) {
|
|
65
81
|
newHour = endPoint;
|
|
66
82
|
} else if (!newValue) {
|
|
@@ -73,26 +89,30 @@ function getChangedHour(values, event, focusOrders, keyActions) {
|
|
|
73
89
|
isChanged = true;
|
|
74
90
|
newHour = '';
|
|
75
91
|
}
|
|
92
|
+
|
|
76
93
|
return {
|
|
77
94
|
hour: newHour,
|
|
78
95
|
isChanged: isChanged,
|
|
79
96
|
focusOrder: newFocusOrder
|
|
80
97
|
};
|
|
81
98
|
}
|
|
99
|
+
|
|
82
100
|
function getChangedMinute(values, event, focusOrders, keyActions) {
|
|
83
101
|
var keyCode = event.keyCode,
|
|
84
|
-
|
|
102
|
+
which = event.which;
|
|
85
103
|
var _values$minute = values.minute,
|
|
86
|
-
|
|
104
|
+
minute = _values$minute === void 0 ? '' : _values$minute;
|
|
87
105
|
var isChanged = false;
|
|
88
106
|
var isEmptyMinute = (0, _Common.getIsEmptyValue)(minute);
|
|
89
107
|
var newMinute = isEmptyMinute ? '' : Number.parseInt(minute);
|
|
90
108
|
var focusOrder = focusOrders.focusOrder;
|
|
91
109
|
var newFocusOrder = focusOrder;
|
|
92
110
|
var isNewType = (0, _index.getIsNewValueType)(focusOrders, keyActions);
|
|
111
|
+
|
|
93
112
|
var _getMinuteDetails = (0, _index.getMinuteDetails)(),
|
|
94
|
-
|
|
95
|
-
|
|
113
|
+
startPoint = _getMinuteDetails.startPoint,
|
|
114
|
+
endPoint = _getMinuteDetails.endPoint;
|
|
115
|
+
|
|
96
116
|
if (keyCode === 38) {
|
|
97
117
|
//up arrow
|
|
98
118
|
if (newMinute === endPoint || isEmptyMinute) {
|
|
@@ -115,15 +135,19 @@ function getChangedMinute(values, event, focusOrders, keyActions) {
|
|
|
115
135
|
var keyString = String.fromCharCode(which);
|
|
116
136
|
var newValue = isNewType ? keyString : minute.toString() + keyString;
|
|
117
137
|
newValue = Number.parseInt(newValue);
|
|
138
|
+
|
|
118
139
|
if (isNewType) {
|
|
119
140
|
isChanged = true;
|
|
141
|
+
|
|
120
142
|
if (newValue * 10 > endPoint) {
|
|
121
143
|
newFocusOrder += 1;
|
|
122
144
|
}
|
|
145
|
+
|
|
123
146
|
newMinute = newValue;
|
|
124
147
|
} else {
|
|
125
148
|
isChanged = true;
|
|
126
149
|
newFocusOrder += 1;
|
|
150
|
+
|
|
127
151
|
if (newValue > endPoint) {
|
|
128
152
|
newMinute = endPoint;
|
|
129
153
|
} else {
|
|
@@ -134,30 +158,35 @@ function getChangedMinute(values, event, focusOrders, keyActions) {
|
|
|
134
158
|
isChanged = true;
|
|
135
159
|
newMinute = '';
|
|
136
160
|
}
|
|
161
|
+
|
|
137
162
|
return {
|
|
138
163
|
minute: newMinute,
|
|
139
164
|
isChanged: isChanged,
|
|
140
165
|
focusOrder: newFocusOrder
|
|
141
166
|
};
|
|
142
167
|
}
|
|
143
|
-
|
|
168
|
+
|
|
169
|
+
function getChangedNoon(values, event, focusOrders
|
|
170
|
+
/*keyActions*/
|
|
171
|
+
) {
|
|
144
172
|
var keyCode = event.keyCode,
|
|
145
|
-
|
|
173
|
+
which = event.which;
|
|
146
174
|
var _values$noon = values.noon,
|
|
147
|
-
|
|
175
|
+
noon = _values$noon === void 0 ? '' : _values$noon;
|
|
148
176
|
var isChanged = false;
|
|
149
177
|
var newNoon = noon;
|
|
150
178
|
var focusOrder = focusOrders.focusOrder;
|
|
151
|
-
var newFocusOrder = focusOrder;
|
|
152
|
-
|
|
153
|
-
// const isNewType = getIsNewValueType(focusOrders, keyActions);
|
|
179
|
+
var newFocusOrder = focusOrder; // const isNewType = getIsNewValueType(focusOrders, keyActions);
|
|
154
180
|
|
|
155
181
|
var _getNoonDetails = (0, _index.getNoonDetails)(),
|
|
156
|
-
|
|
182
|
+
allowedValues = _getNoonDetails.allowedValues;
|
|
183
|
+
|
|
157
184
|
var _allowedValues = _slicedToArray(allowedValues, 1),
|
|
158
|
-
|
|
185
|
+
startPoint = _allowedValues[0];
|
|
186
|
+
|
|
159
187
|
var endPoint = allowedValues[allowedValues.length - 1];
|
|
160
188
|
var currentNoonIndex = allowedValues.indexOf(newNoon);
|
|
189
|
+
|
|
161
190
|
if (keyCode === 38) {
|
|
162
191
|
//up arrow
|
|
163
192
|
if (newNoon === endPoint || !newNoon) {
|
|
@@ -177,11 +206,11 @@ function getChangedNoon(values, event, focusOrders /*keyActions*/) {
|
|
|
177
206
|
newNoon = allowedValues[currentNoonIndex - 1];
|
|
178
207
|
}
|
|
179
208
|
} else if ((0, _index.getIsNoonValueTyped)(event)) {
|
|
180
|
-
var keyString = String.fromCharCode(which);
|
|
209
|
+
var keyString = String.fromCharCode(which); // let newValue = isNewType ? keyString : noon.toString() + keyString;
|
|
181
210
|
|
|
182
|
-
// let newValue = isNewType ? keyString : noon.toString() + keyString;
|
|
183
211
|
var newValue = keyString;
|
|
184
212
|
var needChangeNoon = newNoon.indexOf(newValue) === -1 ? true : false;
|
|
213
|
+
|
|
185
214
|
if (needChangeNoon) {
|
|
186
215
|
var newValueIndex = currentNoonIndex;
|
|
187
216
|
allowedValues.some(function (val, index) {
|
|
@@ -189,8 +218,10 @@ function getChangedNoon(values, event, focusOrders /*keyActions*/) {
|
|
|
189
218
|
newValueIndex = index;
|
|
190
219
|
return true;
|
|
191
220
|
}
|
|
221
|
+
|
|
192
222
|
return false;
|
|
193
223
|
});
|
|
224
|
+
|
|
194
225
|
if (currentNoonIndex !== newValueIndex) {
|
|
195
226
|
isChanged = true;
|
|
196
227
|
newNoon = allowedValues[newValueIndex];
|
|
@@ -200,6 +231,7 @@ function getChangedNoon(values, event, focusOrders /*keyActions*/) {
|
|
|
200
231
|
isChanged = true;
|
|
201
232
|
newNoon = '';
|
|
202
233
|
}
|
|
234
|
+
|
|
203
235
|
return {
|
|
204
236
|
noon: newNoon,
|
|
205
237
|
isChanged: isChanged,
|