@zohodesk/components 1.0.0-temp-158 → 1.0.0-temp-159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Accordion/Accordion.js +3 -7
- package/es/Accordion/AccordionItem.js +2 -4
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +5 -13
- package/es/Avatar/Avatar.js +11 -23
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/Button/Button.js +3 -4
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Card/Card.js +10 -21
- package/es/CheckBox/CheckBox.js +3 -5
- package/es/DateTime/CalendarView.js +20 -32
- package/es/DateTime/DateTime.js +10 -75
- package/es/DateTime/DateTimePopupFooter.js +2 -4
- package/es/DateTime/DateTimePopupHeader.js +2 -8
- package/es/DateTime/DateWidget.js +35 -98
- package/es/DateTime/DaysRow.js +2 -4
- package/es/DateTime/Time.js +2 -10
- package/es/DateTime/YearView.js +4 -28
- 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/dateFormats.js +1 -0
- package/es/DateTime/dateFormatUtils/dayChange.js +4 -13
- package/es/DateTime/dateFormatUtils/index.js +2 -32
- 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/objectUtils.js +20 -14
- package/es/DateTime/props/defaultProps.js +1 -2
- package/es/DateTime/typeChecker.js +0 -3
- package/es/DateTime/validator.js +6 -58
- package/es/DropBox/DropBox.js +2 -6
- package/es/DropBox/DropBoxElement/DropBoxElement.js +0 -7
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +3 -5
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +0 -3
- package/es/DropBox/props/defaultProps.js +2 -1
- package/es/DropBox/props/propTypes.js +2 -1
- package/es/DropDown/DropDown.js +4 -8
- package/es/DropDown/DropDownHeading.js +5 -4
- package/es/DropDown/DropDownItem.js +0 -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/Heading/Heading.js +3 -2
- package/es/Label/Label.js +3 -2
- package/es/Layout/Box.js +0 -13
- package/es/Layout/Container.js +1 -12
- package/es/Layout/index.js +2 -1
- package/es/ListItem/ListContainer.js +3 -8
- package/es/ListItem/ListItem.js +3 -9
- package/es/ListItem/ListItemWithAvatar.js +3 -9
- package/es/ListItem/ListItemWithCheckBox.js +2 -7
- package/es/ListItem/ListItemWithIcon.js +3 -8
- package/es/ListItem/ListItemWithRadio.js +3 -7
- package/es/Modal/Modal.js +11 -28
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +13 -89
- package/es/MultiSelect/AdvancedMultiSelect.js +9 -32
- package/es/MultiSelect/EmptyState.js +0 -2
- package/es/MultiSelect/MultiSelect.js +32 -99
- package/es/MultiSelect/MultiSelectHeader.js +0 -3
- package/es/MultiSelect/MultiSelectWithAvatar.js +6 -12
- package/es/MultiSelect/SelectedOptions.js +3 -6
- package/es/MultiSelect/Suggestions.js +3 -7
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +6 -4
- package/es/MultiSelect/props/propTypes.js +0 -2
- package/es/PopOver/PopOver.js +2 -18
- package/es/PopOver/__tests__/PopOver.spec.js +1 -2
- package/es/Popup/Popup.js +24 -77
- package/es/Popup/__tests__/Popup.spec.js +5 -17
- package/es/Popup/viewPort.js +4 -16
- package/es/Provider/IdProvider.js +5 -10
- package/es/Provider/LibraryContext.js +4 -6
- package/es/Provider/NumberGenerator/NumberGenerator.js +7 -21
- package/es/Provider/ZindexProvider.js +2 -9
- package/es/Radio/Radio.js +2 -4
- package/es/Responsive/CustomResponsive.js +18 -30
- 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 -34
- package/es/Responsive/index.js +3 -1
- 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 +0 -4
- package/es/Ribbon/Ribbon.js +2 -3
- package/es/RippleEffect/RippleEffect.js +3 -1
- package/es/Select/GroupSelect.js +14 -58
- package/es/Select/Select.js +33 -79
- package/es/Select/SelectWithAvatar.js +4 -17
- package/es/Select/SelectWithIcon.js +5 -46
- package/es/Select/__tests__/Select.spec.js +8 -6
- package/es/Select/props/propTypes.js +0 -1
- package/es/Stencils/Stencils.js +3 -3
- package/es/Switch/Switch.js +3 -5
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/TabContent.js +0 -1
- package/es/Tab/TabContentWrapper.js +0 -2
- package/es/Tab/TabWrapper.js +2 -5
- package/es/Tab/Tabs.js +7 -54
- package/es/Tab/__tests__/Tab.spec.js +3 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +0 -1
- package/es/Tag/Tag.js +3 -6
- package/es/TextBox/TextBox.js +3 -15
- package/es/TextBox/TextBox.module.css +8 -5
- package/es/TextBox/__tests__/TextBox.spec.js +4 -1
- package/es/TextBoxIcon/TextBoxIcon.js +2 -9
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +7 -2
- package/es/Textarea/Textarea.js +3 -12
- package/es/Textarea/Textarea.module.css +3 -4
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +14 -58
- package/es/Tooltip/__tests__/Tooltip.spec.js +0 -5
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +2 -3
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +5 -7
- package/es/deprecated/PortalLayer/PortalLayer.js +20 -25
- package/es/semantic/Button/Button.js +2 -3
- package/es/utils/Common.js +9 -54
- 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/css/compileClassNames.js +0 -5
- package/es/utils/css/mergeStyle.js +6 -7
- package/es/utils/css/utils.js +0 -1
- package/es/utils/datetime/common.js +7 -31
- package/es/utils/debounce.js +1 -5
- package/es/utils/dropDownUtils.js +11 -68
- package/es/utils/getInitial.js +0 -4
- package/es/utils/shallowEqual.js +0 -6
- package/lib/Accordion/Accordion.js +18 -42
- package/lib/Accordion/AccordionItem.js +18 -40
- package/lib/Accordion/__tests__/Accordion.spec.js +0 -3
- package/lib/Accordion/index.js +0 -3
- package/lib/Accordion/props/propTypes.js +0 -3
- package/lib/Animation/Animation.js +18 -38
- package/lib/Animation/__tests__/Animation.spec.js +7 -11
- package/lib/Animation/props/propTypes.js +0 -3
- package/lib/AppContainer/AppContainer.js +21 -56
- package/lib/AppContainer/props/propTypes.js +0 -3
- package/lib/Avatar/Avatar.js +38 -78
- package/lib/Avatar/__tests__/Avatar.spec.js +0 -44
- package/lib/Avatar/props/propTypes.js +0 -3
- package/lib/AvatarTeam/AvatarTeam.js +30 -52
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +0 -13
- package/lib/AvatarTeam/props/propTypes.js +0 -3
- package/lib/Button/Button.js +20 -31
- package/lib/Button/css/cssJSLogic.js +17 -18
- package/lib/Button/index.js +0 -3
- package/lib/Button/props/defaultProps.js +0 -2
- package/lib/Button/props/propTypes.js +0 -3
- package/lib/Buttongroup/Buttongroup.js +12 -32
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +0 -10
- package/lib/Buttongroup/props/propTypes.js +0 -3
- package/lib/Card/Card.js +46 -102
- package/lib/Card/__tests__/Card.spec.js +1 -10
- package/lib/Card/index.js +0 -4
- package/lib/Card/props/propTypes.js +0 -3
- package/lib/CheckBox/CheckBox.js +47 -71
- package/lib/CheckBox/__tests__/CheckBox.spec.js +0 -3
- package/lib/CheckBox/props/propTypes.js +0 -3
- package/lib/DateTime/CalendarView.js +42 -82
- package/lib/DateTime/DateTime.js +159 -247
- package/lib/DateTime/DateTimePopupFooter.js +9 -32
- package/lib/DateTime/DateTimePopupHeader.js +18 -49
- package/lib/DateTime/DateWidget.js +251 -353
- package/lib/DateTime/DaysRow.js +6 -28
- package/lib/DateTime/Time.js +33 -74
- package/lib/DateTime/YearView.js +29 -78
- package/lib/DateTime/__tests__/CalendarView.spec.js +5 -13
- package/lib/DateTime/__tests__/DateTime.spec.js +37 -51
- package/lib/DateTime/__tests__/DateWidget.spec.js +8 -10
- package/lib/DateTime/common.js +0 -6
- package/lib/DateTime/constants.js +0 -1
- package/lib/DateTime/dateFormatUtils/dateFormat.js +122 -184
- package/lib/DateTime/dateFormatUtils/dateFormats.js +1 -0
- package/lib/DateTime/dateFormatUtils/dayChange.js +7 -14
- package/lib/DateTime/dateFormatUtils/index.js +16 -74
- package/lib/DateTime/dateFormatUtils/monthChange.js +9 -19
- package/lib/DateTime/dateFormatUtils/timeChange.js +23 -55
- package/lib/DateTime/dateFormatUtils/yearChange.js +11 -22
- package/lib/DateTime/index.js +0 -2
- package/lib/DateTime/objectUtils.js +20 -24
- package/lib/DateTime/props/defaultProps.js +1 -2
- package/lib/DateTime/props/propTypes.js +1 -11
- package/lib/DateTime/typeChecker.js +0 -4
- package/lib/DateTime/validator.js +10 -73
- package/lib/DropBox/DropBox.js +10 -34
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +37 -58
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +33 -41
- package/lib/DropBox/DropBoxElement/props/propTypes.js +0 -3
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +9 -14
- package/lib/DropBox/__tests__/DropBox.spec.js +2 -6
- package/lib/DropBox/css/cssJSLogic.js +1 -3
- package/lib/DropBox/props/defaultProps.js +4 -8
- package/lib/DropBox/props/propTypes.js +4 -10
- package/lib/DropDown/DropDown.js +8 -52
- package/lib/DropDown/DropDownHeading.js +20 -39
- package/lib/DropDown/DropDownItem.js +20 -42
- package/lib/DropDown/DropDownSearch.js +17 -40
- package/lib/DropDown/DropDownSeparator.js +4 -24
- package/lib/DropDown/__tests__/DropDown.spec.js +9 -15
- package/lib/DropDown/__tests__/DropDownItem.spec.js +4 -9
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +0 -3
- package/lib/DropDown/index.js +0 -9
- package/lib/DropDown/props/propTypes.js +4 -6
- package/lib/Heading/Heading.js +15 -37
- package/lib/Heading/props/propTypes.js +0 -3
- package/lib/Label/Label.js +22 -40
- package/lib/Label/__tests__/Label.spec.js +1 -14
- package/lib/Label/props/propTypes.js +0 -3
- package/lib/Layout/Box.js +11 -31
- package/lib/Layout/Container.js +10 -29
- package/lib/Layout/__tests__/Box.spec.js +49 -65
- package/lib/Layout/__tests__/Container.spec.js +50 -67
- package/lib/Layout/index.js +0 -3
- package/lib/Layout/props/propTypes.js +0 -3
- package/lib/Layout/utils.js +0 -10
- package/lib/ListItem/ListContainer.js +28 -49
- package/lib/ListItem/ListItem.js +46 -70
- package/lib/ListItem/ListItemWithAvatar.js +49 -76
- package/lib/ListItem/ListItemWithCheckBox.js +39 -64
- package/lib/ListItem/ListItemWithIcon.js +45 -69
- package/lib/ListItem/ListItemWithRadio.js +41 -65
- package/lib/ListItem/index.js +0 -7
- package/lib/ListItem/props/propTypes.js +4 -6
- package/lib/Modal/Modal.js +11 -46
- package/lib/Modal/props/propTypes.js +0 -3
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +167 -295
- package/lib/MultiSelect/AdvancedMultiSelect.js +125 -203
- package/lib/MultiSelect/EmptyState.js +25 -46
- package/lib/MultiSelect/MultiSelect.js +206 -324
- package/lib/MultiSelect/MultiSelectHeader.js +9 -31
- package/lib/MultiSelect/MultiSelectWithAvatar.js +64 -106
- package/lib/MultiSelect/SelectedOptions.js +18 -44
- package/lib/MultiSelect/Suggestions.js +33 -65
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +75 -86
- package/lib/MultiSelect/index.js +0 -5
- package/lib/MultiSelect/props/defaultProps.js +0 -2
- package/lib/MultiSelect/props/propTypes.js +0 -5
- package/lib/PopOver/PopOver.js +49 -95
- package/lib/PopOver/__tests__/PopOver.spec.js +1 -4
- package/lib/PopOver/index.js +0 -4
- package/lib/PopOver/props/propTypes.js +0 -3
- package/lib/Popup/Popup.js +82 -159
- package/lib/Popup/__tests__/Popup.spec.js +9 -44
- package/lib/Popup/viewPort.js +14 -28
- package/lib/Provider/AvatarSize.js +0 -4
- package/lib/Provider/Config.js +0 -2
- package/lib/Provider/CssProvider.js +0 -4
- package/lib/Provider/IdProvider.js +6 -17
- package/lib/Provider/LibraryContext.js +15 -35
- package/lib/Provider/LibraryContextInit.js +0 -4
- package/lib/Provider/NumberGenerator/NumberGenerator.js +15 -44
- package/lib/Provider/ZindexProvider.js +3 -15
- package/lib/Provider/index.js +0 -5
- package/lib/Radio/Radio.js +39 -62
- package/lib/Radio/__tests__/Radiospec.js +5 -9
- package/lib/Radio/props/propTypes.js +0 -3
- package/lib/Responsive/CustomResponsive.js +28 -73
- package/lib/Responsive/RefWrapper.js +11 -17
- package/lib/Responsive/ResizeComponent.js +39 -63
- package/lib/Responsive/ResizeObserver.js +10 -24
- package/lib/Responsive/Responsive.js +31 -81
- package/lib/Responsive/index.js +0 -4
- package/lib/Responsive/props/propTypes.js +0 -3
- package/lib/Responsive/sizeObservers.js +17 -53
- package/lib/Responsive/utils/index.js +3 -11
- package/lib/Responsive/utils/shallowCompare.js +2 -11
- package/lib/Responsive/windowResizeObserver.js +0 -8
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +17 -45
- package/lib/ResponsiveDropBox/props/propTypes.js +0 -3
- package/lib/Ribbon/Ribbon.js +14 -34
- package/lib/Ribbon/__tests__/Ribbon.spec.js +0 -22
- package/lib/Ribbon/props/propTypes.js +0 -3
- package/lib/RippleEffect/RippleEffect.js +10 -18
- package/lib/RippleEffect/props/propTypes.js +0 -3
- package/lib/Select/GroupSelect.js +131 -230
- package/lib/Select/Select.js +209 -291
- package/lib/Select/SelectWithAvatar.js +57 -103
- package/lib/Select/SelectWithIcon.js +77 -133
- package/lib/Select/__tests__/Select.spec.js +92 -134
- package/lib/Select/index.js +0 -5
- package/lib/Select/props/defaultProps.js +4 -5
- package/lib/Select/props/propTypes.js +0 -4
- package/lib/Stencils/Stencils.js +11 -30
- package/lib/Stencils/__tests__/Stencils.spec.js +0 -12
- package/lib/Stencils/props/propTypes.js +0 -3
- package/lib/Switch/Switch.js +34 -57
- package/lib/Switch/props/propTypes.js +0 -3
- package/lib/Tab/Tab.js +28 -41
- package/lib/Tab/TabContent.js +5 -12
- package/lib/Tab/TabContentWrapper.js +6 -13
- package/lib/Tab/TabWrapper.js +19 -37
- package/lib/Tab/Tabs.js +98 -172
- package/lib/Tab/__tests__/Tab.spec.js +58 -67
- package/lib/Tab/__tests__/TabContent.spec.js +6 -10
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +20 -28
- package/lib/Tab/__tests__/TabWrapper.spec.js +0 -12
- package/lib/Tab/__tests__/Tabs.spec.js +39 -53
- package/lib/Tab/index.js +0 -6
- package/lib/Tab/props/propTypes.js +0 -3
- package/lib/Tag/Tag.js +43 -72
- package/lib/Tag/__tests__/Tag.spec.js +8 -14
- package/lib/Tag/props/propTypes.js +0 -3
- package/lib/TextBox/TextBox.js +60 -86
- package/lib/TextBox/TextBox.module.css +8 -5
- package/lib/TextBox/__tests__/TextBox.spec.js +4 -14
- package/lib/TextBox/props/propTypes.js +4 -6
- package/lib/TextBoxIcon/TextBoxIcon.js +52 -79
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +4 -14
- package/lib/TextBoxIcon/props/propTypes.js +0 -3
- package/lib/Textarea/Textarea.js +30 -55
- package/lib/Textarea/Textarea.module.css +3 -4
- package/lib/Textarea/__tests__/Textarea.spec.js +2 -14
- package/lib/Textarea/props/propTypes.js +0 -3
- package/lib/Tooltip/Tooltip.js +31 -94
- package/lib/Tooltip/__tests__/Tooltip.spec.js +3 -24
- package/lib/Tooltip/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +16 -40
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +25 -53
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/index.js +0 -3
- package/lib/css.js +0 -40
- package/lib/deprecated/PortalLayer/PortalLayer.js +24 -47
- package/lib/deprecated/PortalLayer/props/propTypes.js +0 -3
- package/lib/index.js +0 -57
- package/lib/semantic/Button/Button.js +22 -42
- package/lib/semantic/Button/props/propTypes.js +0 -3
- package/lib/semantic/index.js +0 -2
- package/lib/utils/Common.js +18 -108
- package/lib/utils/ContextOptimizer.js +10 -16
- package/lib/utils/__tests__/constructFullName.spec.js +0 -1
- package/lib/utils/__tests__/debounce.spec.js +2 -3
- package/lib/utils/__tests__/getInitial.spec.js +0 -1
- package/lib/utils/constructFullName.js +4 -13
- package/lib/utils/css/compileClassNames.js +0 -6
- package/lib/utils/css/mergeStyle.js +7 -10
- package/lib/utils/css/utils.js +0 -8
- package/lib/utils/datetime/common.js +7 -52
- package/lib/utils/debounce.js +1 -6
- package/lib/utils/dropDownUtils.js +60 -176
- package/lib/utils/dummyFunction.js +0 -2
- package/lib/utils/getHTMLFontSize.js +0 -1
- package/lib/utils/getInitial.js +0 -6
- package/lib/utils/index.js +0 -4
- package/lib/utils/scrollTo.js +0 -2
- package/lib/utils/shallowEqual.js +0 -8
- package/package.json +2 -2
- package/es/utils/datetime/GMTZones.js +0 -48
- package/lib/utils/datetime/GMTZones.js +0 -55
|
@@ -5,21 +5,19 @@ import { Container, Box } from '../Layout';
|
|
|
5
5
|
import style from './DateTime.module.css';
|
|
6
6
|
import { getMonthEnd } from '../utils/datetime/common';
|
|
7
7
|
import DaysRow from './DaysRow';
|
|
8
|
-
/* eslint css-modules/no-unused-class: [0, { markAsUsed: ['container', 'header', 'thArrowConatainer', 'thArrow', 'thMonYear', 'days', 'daysStr', 'timesection', 'timeStr', 'dropDownContainer', 'dropDown', 'footer', 'space'] }] */
|
|
9
8
|
|
|
9
|
+
/* eslint css-modules/no-unused-class: [0, { markAsUsed: ['container', 'header', 'thArrowConatainer', 'thArrow', 'thMonYear', 'days', 'daysStr', 'timesection', 'timeStr', 'dropDownContainer', 'dropDown', 'footer', 'space'] }] */
|
|
10
10
|
export default class CalendarView extends React.PureComponent {
|
|
11
11
|
constructor(props) {
|
|
12
12
|
super(props);
|
|
13
13
|
this.handleSelect = this.handleSelect.bind(this);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
handleSelect(day, month, year, e) {
|
|
17
16
|
const {
|
|
18
17
|
onSelect
|
|
19
18
|
} = this.props;
|
|
20
19
|
onSelect(day, month, year, e);
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
render() {
|
|
24
22
|
const {
|
|
25
23
|
date,
|
|
@@ -39,7 +37,9 @@ export default class CalendarView extends React.PureComponent {
|
|
|
39
37
|
const userSeeMonth = userSeeDate.getMonth();
|
|
40
38
|
const monthEnd = getMonthEnd(month, year);
|
|
41
39
|
const lastMonth = 11;
|
|
42
|
-
const firstMonth = 0;
|
|
40
|
+
const firstMonth = 0;
|
|
41
|
+
|
|
42
|
+
// let noOfRow = 5;
|
|
43
43
|
// if (
|
|
44
44
|
// (monthEnd === 31 && userSeeDay >= 6) ||
|
|
45
45
|
// (monthEnd === 30 && userSeeDay === 7)
|
|
@@ -53,21 +53,16 @@ export default class CalendarView extends React.PureComponent {
|
|
|
53
53
|
let incremleti = 1;
|
|
54
54
|
let isSelectedDay = false;
|
|
55
55
|
let isToday = false;
|
|
56
|
-
|
|
57
56
|
const rows = (() => {
|
|
58
57
|
const rowArr = [];
|
|
59
|
-
|
|
60
58
|
for (let j = 1; j <= 6; j++) {
|
|
61
59
|
const dayArr = [];
|
|
62
60
|
let output = null;
|
|
63
|
-
|
|
64
61
|
for (let i = 1; i < 8; i++) {
|
|
65
62
|
let tdclass = `${style.datesStr} ${style.grid}`;
|
|
66
|
-
|
|
67
63
|
if (i === 1) {
|
|
68
64
|
tdclass += ` ${style.sunday}`;
|
|
69
65
|
}
|
|
70
|
-
|
|
71
66
|
if (incremleti >= userSeeDay && incremday <= monthEnd) {
|
|
72
67
|
if (parseInt(date) === incremday && parseInt(month) === userSeeMonth && parseInt(year) === userSeeYear) {
|
|
73
68
|
isSelectedDay = true;
|
|
@@ -78,7 +73,6 @@ export default class CalendarView extends React.PureComponent {
|
|
|
78
73
|
isSelectedDay = false;
|
|
79
74
|
isToday = false;
|
|
80
75
|
}
|
|
81
|
-
|
|
82
76
|
output = /*#__PURE__*/React.createElement(Span, {
|
|
83
77
|
i: i,
|
|
84
78
|
isActive: isSelectedDay,
|
|
@@ -94,51 +88,54 @@ export default class CalendarView extends React.PureComponent {
|
|
|
94
88
|
} else if (incremleti < userSeeDay) {
|
|
95
89
|
let prevMonth = userSeeMonth - 1;
|
|
96
90
|
let prevYear = userSeeYear;
|
|
97
|
-
|
|
98
91
|
if (userSeeMonth === firstMonth) {
|
|
99
92
|
prevMonth = lastMonth;
|
|
100
93
|
prevYear = userSeeYear - 1;
|
|
101
94
|
}
|
|
102
|
-
|
|
103
95
|
const prevMonthEnd = getMonthEnd(prevMonth, prevYear);
|
|
104
|
-
const prevDate = prevMonthEnd - (userSeeDay - 1) + incremleti;
|
|
96
|
+
const prevDate = prevMonthEnd - (userSeeDay - 1) + incremleti;
|
|
105
97
|
|
|
106
|
-
|
|
98
|
+
// isSelectedDay =
|
|
99
|
+
prevDate === parseInt(date) && parseInt(month) === prevMonth && parseInt(year) === prevYear ? true : false;
|
|
100
|
+
// isToday = prevDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear ? true : false;
|
|
107
101
|
|
|
108
102
|
output = /*#__PURE__*/React.createElement(Span, {
|
|
109
|
-
i: i
|
|
103
|
+
i: i
|
|
104
|
+
//isActive={isSelectedDay}
|
|
110
105
|
,
|
|
111
106
|
tdclass: `${tdclass} ${style.invalidDate}`,
|
|
112
107
|
handleSelect: this.handleSelect,
|
|
113
108
|
incremday: prevDate,
|
|
114
109
|
userSeeMonth: prevMonth,
|
|
115
110
|
userSeeYear: prevYear,
|
|
116
|
-
dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`
|
|
117
|
-
|
|
111
|
+
dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`
|
|
112
|
+
// isToday={isToday}
|
|
118
113
|
});
|
|
119
114
|
} else if (incremleti > monthEnd) {
|
|
120
115
|
let nextMonth = userSeeMonth + 1;
|
|
121
116
|
let nextYear = userSeeYear;
|
|
122
|
-
|
|
123
117
|
if (userSeeMonth === lastMonth) {
|
|
124
118
|
nextMonth = firstMonth;
|
|
125
119
|
nextYear = userSeeYear + 1;
|
|
126
120
|
}
|
|
121
|
+
const nextDate = incremleti - (userSeeDay - 1) - monthEnd;
|
|
127
122
|
|
|
128
|
-
|
|
123
|
+
// isSelectedDay =
|
|
124
|
+
nextDate === parseInt(date) && parseInt(month) === nextMonth && parseInt(year) === nextYear ? true : false;
|
|
129
125
|
|
|
130
|
-
|
|
126
|
+
// isToday = nextDate === incremday && todayMonth === userSeeMonth && todayYear === userSeeYear ? true : false;
|
|
131
127
|
|
|
132
128
|
output = /*#__PURE__*/React.createElement(Span, {
|
|
133
|
-
i: i
|
|
129
|
+
i: i
|
|
130
|
+
// isActive={isSelectedDay}
|
|
134
131
|
,
|
|
135
132
|
tdclass: `${tdclass} ${style.invalidDate}`,
|
|
136
133
|
handleSelect: this.handleSelect,
|
|
137
134
|
incremday: nextDate,
|
|
138
135
|
userSeeMonth: nextMonth,
|
|
139
136
|
userSeeYear: nextYear,
|
|
140
|
-
dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`
|
|
141
|
-
|
|
137
|
+
dataId: isSelectedDay ? `${dataId}_dateSelected` : `${dataId}_invalidDate`
|
|
138
|
+
//isToday={isToday}
|
|
142
139
|
});
|
|
143
140
|
} else {
|
|
144
141
|
output = /*#__PURE__*/React.createElement(Box, {
|
|
@@ -146,13 +143,10 @@ export default class CalendarView extends React.PureComponent {
|
|
|
146
143
|
className: `${style.grid}`
|
|
147
144
|
});
|
|
148
145
|
}
|
|
149
|
-
|
|
150
146
|
incremleti++;
|
|
151
147
|
dayArr.push(output);
|
|
152
148
|
}
|
|
153
149
|
/* eslint-disable react/forbid-component-props */
|
|
154
|
-
|
|
155
|
-
|
|
156
150
|
rowArr.push( /*#__PURE__*/React.createElement(Container, {
|
|
157
151
|
key: j,
|
|
158
152
|
alignBox: "row",
|
|
@@ -161,10 +155,8 @@ export default class CalendarView extends React.PureComponent {
|
|
|
161
155
|
className: style.dateRow
|
|
162
156
|
}, dayArr));
|
|
163
157
|
}
|
|
164
|
-
|
|
165
158
|
return rowArr;
|
|
166
159
|
})();
|
|
167
|
-
|
|
168
160
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DaysRow, {
|
|
169
161
|
dayNames: dayNames,
|
|
170
162
|
dayNamesShort: dayNamesShort,
|
|
@@ -174,7 +166,6 @@ export default class CalendarView extends React.PureComponent {
|
|
|
174
166
|
className: `${style.dateContainer} ${needBorder ? style.separator : ''}`
|
|
175
167
|
}, rows));
|
|
176
168
|
}
|
|
177
|
-
|
|
178
169
|
}
|
|
179
170
|
CalendarView.propTypes = CalendarView_propTypes;
|
|
180
171
|
CalendarView.defaultProps = CalendarView_defaultProps;
|
|
@@ -183,7 +174,6 @@ export class Span extends React.PureComponent {
|
|
|
183
174
|
super(props);
|
|
184
175
|
this.handleSelectChild = this.handleSelectChild.bind(this);
|
|
185
176
|
}
|
|
186
|
-
|
|
187
177
|
handleSelectChild(e) {
|
|
188
178
|
const {
|
|
189
179
|
handleSelect,
|
|
@@ -193,7 +183,6 @@ export class Span extends React.PureComponent {
|
|
|
193
183
|
} = this.props;
|
|
194
184
|
handleSelect(incremday, userSeeMonth, userSeeYear, e);
|
|
195
185
|
}
|
|
196
|
-
|
|
197
186
|
render() {
|
|
198
187
|
const {
|
|
199
188
|
tdclass,
|
|
@@ -211,7 +200,6 @@ export class Span extends React.PureComponent {
|
|
|
211
200
|
"aria-label": incremday
|
|
212
201
|
}, incremday);
|
|
213
202
|
}
|
|
214
|
-
|
|
215
203
|
}
|
|
216
204
|
Span.propTypes = Span_propTypes;
|
|
217
205
|
Span.defaultProps = Span_defaultProps;
|
package/es/DateTime/DateTime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint css-modules/no-unused-class: [0, { markAsUsed: ['datesStr', 'dateContainer', 'dateRow', 'today', 'emptySpan', 'dropDown'] }] */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable react/forbid-component-props */
|
|
3
|
+
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { DateTime_propTypes } from './props/propTypes';
|
|
6
6
|
import { DateTime_defaultProps } from './props/defaultProps';
|
|
@@ -17,13 +17,11 @@ import { monthNamesDefault, monthNamesShortDefault, dayNamesDefault, dayNamesSho
|
|
|
17
17
|
import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
18
18
|
import { Box } from '../Layout';
|
|
19
19
|
import { getHourSuggestions, getMinuteSuggestions, addZeroIfNeeded } from './dateFormatUtils';
|
|
20
|
-
|
|
21
20
|
function title(date, year, month) {
|
|
22
21
|
let monthNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
23
22
|
const HeadingText = `${monthNames[month] || ''} ${year}`;
|
|
24
23
|
return HeadingText;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
export default class DateTime extends React.PureComponent {
|
|
28
26
|
constructor(props) {
|
|
29
27
|
super(props);
|
|
@@ -49,7 +47,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
49
47
|
const {
|
|
50
48
|
ampmText = ampmTextDefault
|
|
51
49
|
} = props.i18nKeys;
|
|
52
|
-
|
|
53
50
|
this.ampmSuggestions = (() => {
|
|
54
51
|
const ampmSuggestions = [];
|
|
55
52
|
ampmText.forEach((text, index) => {
|
|
@@ -67,29 +64,24 @@ export default class DateTime extends React.PureComponent {
|
|
|
67
64
|
});
|
|
68
65
|
return ampmSuggestions;
|
|
69
66
|
})();
|
|
70
|
-
|
|
71
67
|
const initalStateObj = this.getStateFromProps(props);
|
|
72
68
|
this.state = Object.assign({}, initalStateObj, {
|
|
73
69
|
isYearView: false,
|
|
74
70
|
isMonthOpen: false
|
|
75
71
|
});
|
|
76
72
|
}
|
|
77
|
-
|
|
78
73
|
componentDidMount() {
|
|
79
74
|
this.handleExposeMethods(true);
|
|
80
75
|
}
|
|
81
|
-
|
|
82
76
|
componentDidUpdate(prevProps) {
|
|
83
77
|
const {
|
|
84
78
|
value,
|
|
85
79
|
isActive,
|
|
86
80
|
is24Hour
|
|
87
81
|
} = this.props;
|
|
88
|
-
|
|
89
82
|
if (prevProps.value !== value || is24Hour !== prevProps.is24Hour) {
|
|
90
83
|
this.setState(this.getStateFromProps(this.props));
|
|
91
84
|
}
|
|
92
|
-
|
|
93
85
|
if (prevProps.isActive !== isActive && !isActive) {
|
|
94
86
|
this.setState({
|
|
95
87
|
isYearView: false,
|
|
@@ -97,11 +89,9 @@ export default class DateTime extends React.PureComponent {
|
|
|
97
89
|
});
|
|
98
90
|
}
|
|
99
91
|
}
|
|
100
|
-
|
|
101
92
|
componentWillUnmount() {
|
|
102
93
|
this.handleExposeMethods(false);
|
|
103
94
|
}
|
|
104
|
-
|
|
105
95
|
getStateFromProps(props) {
|
|
106
96
|
let date, month, year, hours, mins, amPm;
|
|
107
97
|
let {
|
|
@@ -112,20 +102,17 @@ export default class DateTime extends React.PureComponent {
|
|
|
112
102
|
isDateTimeField,
|
|
113
103
|
is24Hour
|
|
114
104
|
} = props; //defaultTime --> 12:00:PM
|
|
115
|
-
|
|
116
105
|
defaultTime = needDefaultTime ? defaultTime ? defaultTime : '12:00:PM' : '';
|
|
117
106
|
let defaultHour, defaultMin, defaultAmPm;
|
|
118
107
|
let todayObj = new Date();
|
|
119
108
|
let todayDate = todayObj.getDate();
|
|
120
109
|
let todayMonth = todayObj.getMonth();
|
|
121
110
|
let todayYear = todayObj.getFullYear();
|
|
122
|
-
|
|
123
111
|
if (!value) {
|
|
124
112
|
[defaultHour, defaultMin, defaultAmPm] = defaultTime ? defaultTime.split(':') : [];
|
|
125
113
|
defaultHour = parseInt(defaultHour);
|
|
126
114
|
defaultMin = parseInt(defaultMin);
|
|
127
115
|
}
|
|
128
|
-
|
|
129
116
|
const dateObj = isDateTimeField ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : value ? datetime.toDate(value) : todayObj;
|
|
130
117
|
date = dateObj.getDate();
|
|
131
118
|
month = dateObj.getMonth();
|
|
@@ -147,10 +134,8 @@ export default class DateTime extends React.PureComponent {
|
|
|
147
134
|
todayYear
|
|
148
135
|
};
|
|
149
136
|
}
|
|
150
|
-
|
|
151
137
|
getHours(hoursParam, is24Hour) {
|
|
152
138
|
let hours = hoursParam;
|
|
153
|
-
|
|
154
139
|
if (!is24Hour) {
|
|
155
140
|
if (hours === 0) {
|
|
156
141
|
hours = 12;
|
|
@@ -158,11 +143,9 @@ export default class DateTime extends React.PureComponent {
|
|
|
158
143
|
hours -= 12;
|
|
159
144
|
}
|
|
160
145
|
}
|
|
161
|
-
|
|
162
146
|
hours = addZeroIfNeeded(hours);
|
|
163
147
|
return hours;
|
|
164
148
|
}
|
|
165
|
-
|
|
166
149
|
handleGetSelectedDate() {
|
|
167
150
|
let selectedInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
168
151
|
const {
|
|
@@ -171,8 +154,7 @@ export default class DateTime extends React.PureComponent {
|
|
|
171
154
|
timeZone,
|
|
172
155
|
isDateTimeField,
|
|
173
156
|
dateFormat,
|
|
174
|
-
is24Hour
|
|
175
|
-
customDateFormat
|
|
157
|
+
is24Hour
|
|
176
158
|
} = this.props;
|
|
177
159
|
let {
|
|
178
160
|
year,
|
|
@@ -182,41 +164,32 @@ export default class DateTime extends React.PureComponent {
|
|
|
182
164
|
mins,
|
|
183
165
|
amPm
|
|
184
166
|
} = selectedInfo;
|
|
185
|
-
|
|
186
167
|
if (!is24Hour) {
|
|
187
168
|
if (parseInt(hours) === 12) {
|
|
188
169
|
hours = amPm === 'AM' ? 0 : 12;
|
|
189
170
|
}
|
|
190
|
-
|
|
191
171
|
if (amPm === 'PM') {
|
|
192
172
|
if (hours < 12) {
|
|
193
173
|
hours = parseInt(hours) + 12;
|
|
194
174
|
}
|
|
195
175
|
}
|
|
196
176
|
}
|
|
197
|
-
|
|
198
177
|
let minInMillis = min ? datetime.millis(min) : null,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
let milliSec = currentDate.getMilliseconds();
|
|
206
|
-
|
|
207
|
-
if (isDateTimeField || customDateFormat) {
|
|
208
|
-
selectedInMillis = datetime.tz.tzToUtc(Date.UTC(year, month, date, hours, mins, sec, milliSec), timeZone);
|
|
178
|
+
maxInMillis = max ? datetime.millis(max) : null,
|
|
179
|
+
selectedInMillis,
|
|
180
|
+
selectedValue = '',
|
|
181
|
+
formattedValue;
|
|
182
|
+
if (isDateTimeField) {
|
|
183
|
+
selectedInMillis = datetime.tz.tzToUtc(Date.UTC(year, month, date, hours, mins), timeZone);
|
|
209
184
|
selectedValue = datetime.ISO(selectedInMillis);
|
|
210
|
-
formattedValue = formatDate(new Date(year, month, date, hours, mins
|
|
185
|
+
formattedValue = formatDate(new Date(year, month, date, hours, mins), is24Hour ? `${dateFormat} HH:mm` : `${dateFormat} hh:mm A`);
|
|
211
186
|
} else {
|
|
212
187
|
selectedInMillis = Date.UTC(year, month, date);
|
|
213
188
|
selectedValue = formatDate(new Date(year, month, date), 'YYYY-MM-DD');
|
|
214
189
|
formattedValue = formatDate(new Date(year, month, date), dateFormat);
|
|
215
190
|
}
|
|
216
|
-
|
|
217
191
|
let isError = false;
|
|
218
192
|
let errorType = '';
|
|
219
|
-
|
|
220
193
|
if (minInMillis && minInMillis > selectedInMillis) {
|
|
221
194
|
isError = true;
|
|
222
195
|
errorType = 'MIN';
|
|
@@ -224,7 +197,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
224
197
|
isError = true;
|
|
225
198
|
errorType = 'MAX';
|
|
226
199
|
}
|
|
227
|
-
|
|
228
200
|
return {
|
|
229
201
|
isError,
|
|
230
202
|
errorType,
|
|
@@ -232,7 +204,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
232
204
|
formattedValue
|
|
233
205
|
};
|
|
234
206
|
}
|
|
235
|
-
|
|
236
207
|
handleSelect(e) {
|
|
237
208
|
e && e.preventDefault();
|
|
238
209
|
const {
|
|
@@ -262,7 +233,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
262
233
|
mins,
|
|
263
234
|
amPm
|
|
264
235
|
});
|
|
265
|
-
|
|
266
236
|
if (isError) {
|
|
267
237
|
if (errorType === 'MIN') {
|
|
268
238
|
onError && onError(minErrorText, true);
|
|
@@ -273,7 +243,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
273
243
|
onSelect(selectedValue, formattedValue, e);
|
|
274
244
|
}
|
|
275
245
|
}
|
|
276
|
-
|
|
277
246
|
handleChange() {
|
|
278
247
|
let selectedInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
279
248
|
const {
|
|
@@ -306,7 +275,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
306
275
|
mins: getIsEmptyValue(mins) ? oldMins : mins,
|
|
307
276
|
amPm: getIsEmptyValue(amPm) ? oldAMPM : amPm
|
|
308
277
|
};
|
|
309
|
-
|
|
310
278
|
if (onChange) {
|
|
311
279
|
const {
|
|
312
280
|
isError,
|
|
@@ -314,7 +282,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
314
282
|
selectedValue,
|
|
315
283
|
formattedValue
|
|
316
284
|
} = this.handleGetSelectedDate(newSelectedInfo);
|
|
317
|
-
|
|
318
285
|
if (isError) {
|
|
319
286
|
if (errorType === 'MIN') {
|
|
320
287
|
onError && onError(minErrorText, true);
|
|
@@ -329,20 +296,17 @@ export default class DateTime extends React.PureComponent {
|
|
|
329
296
|
this.setState(newSelectedInfo);
|
|
330
297
|
}
|
|
331
298
|
}
|
|
332
|
-
|
|
333
299
|
handleClear(e) {
|
|
334
300
|
const {
|
|
335
301
|
onSelect,
|
|
336
302
|
onClear
|
|
337
303
|
} = this.props;
|
|
338
|
-
|
|
339
304
|
if (onClear) {
|
|
340
305
|
onClear(e);
|
|
341
306
|
} else {
|
|
342
307
|
onSelect('', '', e);
|
|
343
308
|
}
|
|
344
309
|
}
|
|
345
|
-
|
|
346
310
|
dateSelect(date, month, year, e) {
|
|
347
311
|
this.handleChange({
|
|
348
312
|
date,
|
|
@@ -374,7 +338,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
374
338
|
mins,
|
|
375
339
|
amPm
|
|
376
340
|
});
|
|
377
|
-
|
|
378
341
|
if (isError) {
|
|
379
342
|
if (errorType === 'MIN') {
|
|
380
343
|
onError && onError(minErrorText, true);
|
|
@@ -385,31 +348,26 @@ export default class DateTime extends React.PureComponent {
|
|
|
385
348
|
onDateSelect && onDateSelect(selectedValue, formattedValue, e);
|
|
386
349
|
}
|
|
387
350
|
}
|
|
388
|
-
|
|
389
351
|
hoursSelect(hours) {
|
|
390
352
|
this.handleChange({
|
|
391
353
|
hours
|
|
392
354
|
});
|
|
393
355
|
}
|
|
394
|
-
|
|
395
356
|
minutesSelect(mins) {
|
|
396
357
|
this.handleChange({
|
|
397
358
|
mins
|
|
398
359
|
});
|
|
399
360
|
}
|
|
400
|
-
|
|
401
361
|
amPmSelect(amPm) {
|
|
402
362
|
this.handleChange({
|
|
403
363
|
amPm
|
|
404
364
|
});
|
|
405
365
|
}
|
|
406
|
-
/*global closeGroupPopups*/
|
|
407
|
-
|
|
408
366
|
|
|
367
|
+
/*global closeGroupPopups*/
|
|
409
368
|
closePopup() {
|
|
410
369
|
closeGroupPopups('calender');
|
|
411
370
|
}
|
|
412
|
-
|
|
413
371
|
handleCalendarNavigation(type, selectedInfo) {
|
|
414
372
|
const {
|
|
415
373
|
year: stateYear,
|
|
@@ -419,12 +377,10 @@ export default class DateTime extends React.PureComponent {
|
|
|
419
377
|
let date = stateDate;
|
|
420
378
|
let month = stateMonth;
|
|
421
379
|
const year = stateYear;
|
|
422
|
-
|
|
423
380
|
const getDate = (month, year) => {
|
|
424
381
|
const monthEnd = getMonthEnd(month, year);
|
|
425
382
|
return monthEnd >= parseInt(date) ? date : monthEnd;
|
|
426
383
|
};
|
|
427
|
-
|
|
428
384
|
const modifyCalendarRecursion = recursionType => {
|
|
429
385
|
if (recursionType === 'nextYear') {
|
|
430
386
|
//Click next year icon
|
|
@@ -448,7 +404,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
448
404
|
month = 0;
|
|
449
405
|
return modifyCalendarRecursion('nextYear');
|
|
450
406
|
}
|
|
451
|
-
|
|
452
407
|
const newMonth = month + 1;
|
|
453
408
|
return {
|
|
454
409
|
date: getDate(newMonth, year),
|
|
@@ -461,7 +416,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
461
416
|
month = 11;
|
|
462
417
|
return modifyCalendarRecursion('previousYear');
|
|
463
418
|
}
|
|
464
|
-
|
|
465
419
|
const newMonth = month - 1;
|
|
466
420
|
return {
|
|
467
421
|
date: getDate(newMonth, year),
|
|
@@ -470,12 +424,10 @@ export default class DateTime extends React.PureComponent {
|
|
|
470
424
|
};
|
|
471
425
|
} else if (recursionType === 'nextDate') {
|
|
472
426
|
const monthEnd = getMonthEnd(month, year);
|
|
473
|
-
|
|
474
427
|
if (date === monthEnd) {
|
|
475
428
|
date = 1;
|
|
476
429
|
return modifyCalendarRecursion('nextMonth');
|
|
477
430
|
}
|
|
478
|
-
|
|
479
431
|
const newDate = parseInt(date) + 1;
|
|
480
432
|
return {
|
|
481
433
|
date: newDate,
|
|
@@ -487,7 +439,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
487
439
|
date = month === 0 ? getMonthEnd(11, year - 1) : getMonthEnd(month - 1, year);
|
|
488
440
|
return modifyCalendarRecursion('previousMonth');
|
|
489
441
|
}
|
|
490
|
-
|
|
491
442
|
const newDate = parseInt(date) - 1;
|
|
492
443
|
return {
|
|
493
444
|
date: newDate,
|
|
@@ -496,10 +447,8 @@ export default class DateTime extends React.PureComponent {
|
|
|
496
447
|
};
|
|
497
448
|
}
|
|
498
449
|
};
|
|
499
|
-
|
|
500
450
|
return modifyCalendarRecursion(type);
|
|
501
451
|
}
|
|
502
|
-
|
|
503
452
|
modifyCalendar(type) {
|
|
504
453
|
const {
|
|
505
454
|
year,
|
|
@@ -512,11 +461,9 @@ export default class DateTime extends React.PureComponent {
|
|
|
512
461
|
date
|
|
513
462
|
}));
|
|
514
463
|
}
|
|
515
|
-
|
|
516
464
|
handleDateReset() {
|
|
517
465
|
this.setState(this.getStateFromProps(this.props));
|
|
518
466
|
}
|
|
519
|
-
|
|
520
467
|
handleGetStateValues() {
|
|
521
468
|
const {
|
|
522
469
|
isActive
|
|
@@ -531,20 +478,17 @@ export default class DateTime extends React.PureComponent {
|
|
|
531
478
|
isMonthOpen
|
|
532
479
|
};
|
|
533
480
|
}
|
|
534
|
-
|
|
535
481
|
handleYearViewToggle(isYearOpen, isMonthOpen) {
|
|
536
482
|
this.setState({
|
|
537
483
|
isYearView: isYearOpen,
|
|
538
484
|
isMonthOpen
|
|
539
485
|
});
|
|
540
486
|
}
|
|
541
|
-
|
|
542
487
|
handleExposeMethods(isMount) {
|
|
543
488
|
const {
|
|
544
489
|
getMethods
|
|
545
490
|
} = this.props;
|
|
546
491
|
let methods = {};
|
|
547
|
-
|
|
548
492
|
if (isMount) {
|
|
549
493
|
methods = {
|
|
550
494
|
resetLocalDate: this.handleDateReset,
|
|
@@ -558,10 +502,8 @@ export default class DateTime extends React.PureComponent {
|
|
|
558
502
|
toggleYearView: null
|
|
559
503
|
};
|
|
560
504
|
}
|
|
561
|
-
|
|
562
505
|
getMethods && getMethods(methods);
|
|
563
506
|
}
|
|
564
|
-
|
|
565
507
|
handleOpenYearView() {
|
|
566
508
|
const {
|
|
567
509
|
isYearView,
|
|
@@ -572,14 +514,12 @@ export default class DateTime extends React.PureComponent {
|
|
|
572
514
|
isMonthOpen: !isMonthOpen
|
|
573
515
|
});
|
|
574
516
|
}
|
|
575
|
-
|
|
576
517
|
handleSelectYear(year) {
|
|
577
518
|
this.setState({
|
|
578
519
|
year,
|
|
579
520
|
isMonthOpen: true
|
|
580
521
|
});
|
|
581
522
|
}
|
|
582
|
-
|
|
583
523
|
handleSelectMonth(month) {
|
|
584
524
|
const {
|
|
585
525
|
date,
|
|
@@ -587,17 +527,14 @@ export default class DateTime extends React.PureComponent {
|
|
|
587
527
|
} = this.state;
|
|
588
528
|
const monthEnd = getMonthEnd(month, year);
|
|
589
529
|
let newDate = date;
|
|
590
|
-
|
|
591
530
|
if (date > monthEnd) {
|
|
592
531
|
newDate = monthEnd;
|
|
593
532
|
}
|
|
594
|
-
|
|
595
533
|
this.setState({
|
|
596
534
|
month,
|
|
597
535
|
date: newDate
|
|
598
536
|
});
|
|
599
537
|
}
|
|
600
|
-
|
|
601
538
|
handleSelectMonthViaYearView(month) {
|
|
602
539
|
this.handleSelectMonth(month);
|
|
603
540
|
this.setState({
|
|
@@ -605,7 +542,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
605
542
|
isMonthOpen: false
|
|
606
543
|
});
|
|
607
544
|
}
|
|
608
|
-
|
|
609
545
|
render() {
|
|
610
546
|
const {
|
|
611
547
|
date,
|
|
@@ -741,7 +677,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
741
677
|
portalId: dropBoxPortalId
|
|
742
678
|
}, /*#__PURE__*/React.createElement(Box, null, childEle)) : null;
|
|
743
679
|
}
|
|
744
|
-
|
|
745
680
|
}
|
|
746
681
|
DateTime.propTypes = DateTime_propTypes;
|
|
747
682
|
DateTime.defaultProps = DateTime_defaultProps;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/* eslint-disable react/forbid-component-props */
|
|
2
|
-
|
|
3
2
|
/** ** Libraries *** */
|
|
4
3
|
import React, { PureComponent } from 'react';
|
|
5
|
-
/** ** Components *** */
|
|
6
4
|
|
|
5
|
+
/** ** Components *** */
|
|
7
6
|
import { Container } from '../Layout';
|
|
8
7
|
import Button from '../Button/Button';
|
|
9
|
-
/** ** CSS *** */
|
|
10
8
|
|
|
9
|
+
/** ** CSS *** */
|
|
11
10
|
import style from './DateTime.module.css';
|
|
12
11
|
export default class DateTimePopupFooter extends PureComponent {
|
|
13
12
|
render() {
|
|
@@ -39,5 +38,4 @@ export default class DateTimePopupFooter extends PureComponent {
|
|
|
39
38
|
dataId: `${dataId}_clearBtn`
|
|
40
39
|
}));
|
|
41
40
|
}
|
|
42
|
-
|
|
43
41
|
}
|
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
/** ** Libraries *** */
|
|
4
4
|
import React, { PureComponent } from 'react';
|
|
5
|
-
/** ** Components *** */
|
|
6
5
|
|
|
6
|
+
/** ** Components *** */
|
|
7
7
|
import { Container, Box } from '../Layout';
|
|
8
8
|
import { Icon } from '@zohodesk/icons';
|
|
9
9
|
import Heading from '../Heading/Heading';
|
|
10
|
-
/** ** CSS *** */
|
|
11
10
|
|
|
11
|
+
/** ** CSS *** */
|
|
12
12
|
import style from './DateTime.module.css';
|
|
13
|
-
|
|
14
13
|
class Span extends React.PureComponent {
|
|
15
14
|
constructor(props) {
|
|
16
15
|
super(props);
|
|
17
16
|
this.modifyCalendarChild = this.modifyCalendarChild.bind(this);
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
modifyCalendarChild() {
|
|
21
19
|
const {
|
|
22
20
|
modifyCalendar,
|
|
@@ -24,7 +22,6 @@ class Span extends React.PureComponent {
|
|
|
24
22
|
} = this.props;
|
|
25
23
|
modifyCalendar(type);
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
render() {
|
|
29
26
|
const {
|
|
30
27
|
dataTitle,
|
|
@@ -42,9 +39,7 @@ class Span extends React.PureComponent {
|
|
|
42
39
|
tabindex: "0"
|
|
43
40
|
}, children);
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
export default class DateTimePopupHeader extends PureComponent {
|
|
49
44
|
render() {
|
|
50
45
|
const {
|
|
@@ -99,5 +94,4 @@ export default class DateTimePopupHeader extends PureComponent {
|
|
|
99
94
|
isBold: true
|
|
100
95
|
}))) : null);
|
|
101
96
|
}
|
|
102
|
-
|
|
103
97
|
}
|