@zohodesk/components 1.0.0-temp-158 → 1.0.0-temp-160
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 +6 -67
- 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/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/__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/__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 +5 -16
- 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 +156 -240
- package/lib/DateTime/DateTimePopupFooter.js +8 -31
- package/lib/DateTime/DateTimePopupHeader.js +17 -48
- package/lib/DateTime/DateWidget.js +250 -352
- package/lib/DateTime/DaysRow.js +5 -27
- package/lib/DateTime/Time.js +32 -73
- package/lib/DateTime/YearView.js +28 -77
- 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 +22 -54
- 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/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 +19 -39
- 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 +27 -48
- package/lib/ListItem/ListItem.js +45 -69
- package/lib/ListItem/ListItemWithAvatar.js +48 -75
- package/lib/ListItem/ListItemWithCheckBox.js +39 -64
- package/lib/ListItem/ListItemWithIcon.js +44 -68
- 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 +10 -45
- package/lib/Modal/props/propTypes.js +0 -3
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +166 -294
- package/lib/MultiSelect/AdvancedMultiSelect.js +125 -202
- package/lib/MultiSelect/EmptyState.js +24 -45
- package/lib/MultiSelect/MultiSelect.js +206 -323
- package/lib/MultiSelect/MultiSelectHeader.js +8 -30
- package/lib/MultiSelect/MultiSelectWithAvatar.js +63 -105
- package/lib/MultiSelect/SelectedOptions.js +17 -43
- package/lib/MultiSelect/Suggestions.js +32 -64
- 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 +81 -158
- package/lib/Popup/__tests__/Popup.spec.js +8 -43
- 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 +38 -61
- package/lib/Radio/__tests__/Radiospec.js +5 -9
- package/lib/Radio/props/propTypes.js +0 -3
- package/lib/Responsive/CustomResponsive.js +29 -73
- package/lib/Responsive/RefWrapper.js +11 -17
- package/lib/Responsive/ResizeComponent.js +36 -62
- package/lib/Responsive/ResizeObserver.js +10 -24
- package/lib/Responsive/Responsive.js +30 -80
- 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 +13 -33
- 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 +130 -229
- package/lib/Select/Select.js +209 -290
- package/lib/Select/SelectWithAvatar.js +56 -102
- package/lib/Select/SelectWithIcon.js +76 -132
- package/lib/Select/__tests__/Select.spec.js +91 -133
- 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 +10 -29
- 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 +27 -40
- 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 +91 -171
- 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 +59 -85
- 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 +5 -14
- package/lib/TextBoxIcon/props/propTypes.js +0 -3
- package/lib/Textarea/Textarea.js +29 -54
- 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 +23 -46
- 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 +5 -34
- package/lib/utils/debounce.js +1 -6
- package/lib/utils/dropDownUtils.js +59 -175
- 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
|
@@ -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 {
|
|
@@ -182,28 +165,24 @@ export default class DateTime extends React.PureComponent {
|
|
|
182
165
|
mins,
|
|
183
166
|
amPm
|
|
184
167
|
} = selectedInfo;
|
|
185
|
-
|
|
186
168
|
if (!is24Hour) {
|
|
187
169
|
if (parseInt(hours) === 12) {
|
|
188
170
|
hours = amPm === 'AM' ? 0 : 12;
|
|
189
171
|
}
|
|
190
|
-
|
|
191
172
|
if (amPm === 'PM') {
|
|
192
173
|
if (hours < 12) {
|
|
193
174
|
hours = parseInt(hours) + 12;
|
|
194
175
|
}
|
|
195
176
|
}
|
|
196
177
|
}
|
|
197
|
-
|
|
198
178
|
let minInMillis = min ? datetime.millis(min) : null,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
179
|
+
maxInMillis = max ? datetime.millis(max) : null,
|
|
180
|
+
selectedInMillis,
|
|
181
|
+
selectedValue = '',
|
|
182
|
+
formattedValue;
|
|
203
183
|
let currentDate = new Date();
|
|
204
184
|
let sec = currentDate.getSeconds();
|
|
205
185
|
let milliSec = currentDate.getMilliseconds();
|
|
206
|
-
|
|
207
186
|
if (isDateTimeField || customDateFormat) {
|
|
208
187
|
selectedInMillis = datetime.tz.tzToUtc(Date.UTC(year, month, date, hours, mins, sec, milliSec), timeZone);
|
|
209
188
|
selectedValue = datetime.ISO(selectedInMillis);
|
|
@@ -213,10 +192,8 @@ export default class DateTime extends React.PureComponent {
|
|
|
213
192
|
selectedValue = formatDate(new Date(year, month, date), 'YYYY-MM-DD');
|
|
214
193
|
formattedValue = formatDate(new Date(year, month, date), dateFormat);
|
|
215
194
|
}
|
|
216
|
-
|
|
217
195
|
let isError = false;
|
|
218
196
|
let errorType = '';
|
|
219
|
-
|
|
220
197
|
if (minInMillis && minInMillis > selectedInMillis) {
|
|
221
198
|
isError = true;
|
|
222
199
|
errorType = 'MIN';
|
|
@@ -224,7 +201,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
224
201
|
isError = true;
|
|
225
202
|
errorType = 'MAX';
|
|
226
203
|
}
|
|
227
|
-
|
|
228
204
|
return {
|
|
229
205
|
isError,
|
|
230
206
|
errorType,
|
|
@@ -232,7 +208,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
232
208
|
formattedValue
|
|
233
209
|
};
|
|
234
210
|
}
|
|
235
|
-
|
|
236
211
|
handleSelect(e) {
|
|
237
212
|
e && e.preventDefault();
|
|
238
213
|
const {
|
|
@@ -262,7 +237,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
262
237
|
mins,
|
|
263
238
|
amPm
|
|
264
239
|
});
|
|
265
|
-
|
|
266
240
|
if (isError) {
|
|
267
241
|
if (errorType === 'MIN') {
|
|
268
242
|
onError && onError(minErrorText, true);
|
|
@@ -273,7 +247,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
273
247
|
onSelect(selectedValue, formattedValue, e);
|
|
274
248
|
}
|
|
275
249
|
}
|
|
276
|
-
|
|
277
250
|
handleChange() {
|
|
278
251
|
let selectedInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
279
252
|
const {
|
|
@@ -306,7 +279,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
306
279
|
mins: getIsEmptyValue(mins) ? oldMins : mins,
|
|
307
280
|
amPm: getIsEmptyValue(amPm) ? oldAMPM : amPm
|
|
308
281
|
};
|
|
309
|
-
|
|
310
282
|
if (onChange) {
|
|
311
283
|
const {
|
|
312
284
|
isError,
|
|
@@ -314,7 +286,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
314
286
|
selectedValue,
|
|
315
287
|
formattedValue
|
|
316
288
|
} = this.handleGetSelectedDate(newSelectedInfo);
|
|
317
|
-
|
|
318
289
|
if (isError) {
|
|
319
290
|
if (errorType === 'MIN') {
|
|
320
291
|
onError && onError(minErrorText, true);
|
|
@@ -329,20 +300,17 @@ export default class DateTime extends React.PureComponent {
|
|
|
329
300
|
this.setState(newSelectedInfo);
|
|
330
301
|
}
|
|
331
302
|
}
|
|
332
|
-
|
|
333
303
|
handleClear(e) {
|
|
334
304
|
const {
|
|
335
305
|
onSelect,
|
|
336
306
|
onClear
|
|
337
307
|
} = this.props;
|
|
338
|
-
|
|
339
308
|
if (onClear) {
|
|
340
309
|
onClear(e);
|
|
341
310
|
} else {
|
|
342
311
|
onSelect('', '', e);
|
|
343
312
|
}
|
|
344
313
|
}
|
|
345
|
-
|
|
346
314
|
dateSelect(date, month, year, e) {
|
|
347
315
|
this.handleChange({
|
|
348
316
|
date,
|
|
@@ -374,7 +342,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
374
342
|
mins,
|
|
375
343
|
amPm
|
|
376
344
|
});
|
|
377
|
-
|
|
378
345
|
if (isError) {
|
|
379
346
|
if (errorType === 'MIN') {
|
|
380
347
|
onError && onError(minErrorText, true);
|
|
@@ -385,31 +352,26 @@ export default class DateTime extends React.PureComponent {
|
|
|
385
352
|
onDateSelect && onDateSelect(selectedValue, formattedValue, e);
|
|
386
353
|
}
|
|
387
354
|
}
|
|
388
|
-
|
|
389
355
|
hoursSelect(hours) {
|
|
390
356
|
this.handleChange({
|
|
391
357
|
hours
|
|
392
358
|
});
|
|
393
359
|
}
|
|
394
|
-
|
|
395
360
|
minutesSelect(mins) {
|
|
396
361
|
this.handleChange({
|
|
397
362
|
mins
|
|
398
363
|
});
|
|
399
364
|
}
|
|
400
|
-
|
|
401
365
|
amPmSelect(amPm) {
|
|
402
366
|
this.handleChange({
|
|
403
367
|
amPm
|
|
404
368
|
});
|
|
405
369
|
}
|
|
406
|
-
/*global closeGroupPopups*/
|
|
407
|
-
|
|
408
370
|
|
|
371
|
+
/*global closeGroupPopups*/
|
|
409
372
|
closePopup() {
|
|
410
373
|
closeGroupPopups('calender');
|
|
411
374
|
}
|
|
412
|
-
|
|
413
375
|
handleCalendarNavigation(type, selectedInfo) {
|
|
414
376
|
const {
|
|
415
377
|
year: stateYear,
|
|
@@ -419,12 +381,10 @@ export default class DateTime extends React.PureComponent {
|
|
|
419
381
|
let date = stateDate;
|
|
420
382
|
let month = stateMonth;
|
|
421
383
|
const year = stateYear;
|
|
422
|
-
|
|
423
384
|
const getDate = (month, year) => {
|
|
424
385
|
const monthEnd = getMonthEnd(month, year);
|
|
425
386
|
return monthEnd >= parseInt(date) ? date : monthEnd;
|
|
426
387
|
};
|
|
427
|
-
|
|
428
388
|
const modifyCalendarRecursion = recursionType => {
|
|
429
389
|
if (recursionType === 'nextYear') {
|
|
430
390
|
//Click next year icon
|
|
@@ -448,7 +408,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
448
408
|
month = 0;
|
|
449
409
|
return modifyCalendarRecursion('nextYear');
|
|
450
410
|
}
|
|
451
|
-
|
|
452
411
|
const newMonth = month + 1;
|
|
453
412
|
return {
|
|
454
413
|
date: getDate(newMonth, year),
|
|
@@ -461,7 +420,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
461
420
|
month = 11;
|
|
462
421
|
return modifyCalendarRecursion('previousYear');
|
|
463
422
|
}
|
|
464
|
-
|
|
465
423
|
const newMonth = month - 1;
|
|
466
424
|
return {
|
|
467
425
|
date: getDate(newMonth, year),
|
|
@@ -470,12 +428,10 @@ export default class DateTime extends React.PureComponent {
|
|
|
470
428
|
};
|
|
471
429
|
} else if (recursionType === 'nextDate') {
|
|
472
430
|
const monthEnd = getMonthEnd(month, year);
|
|
473
|
-
|
|
474
431
|
if (date === monthEnd) {
|
|
475
432
|
date = 1;
|
|
476
433
|
return modifyCalendarRecursion('nextMonth');
|
|
477
434
|
}
|
|
478
|
-
|
|
479
435
|
const newDate = parseInt(date) + 1;
|
|
480
436
|
return {
|
|
481
437
|
date: newDate,
|
|
@@ -487,7 +443,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
487
443
|
date = month === 0 ? getMonthEnd(11, year - 1) : getMonthEnd(month - 1, year);
|
|
488
444
|
return modifyCalendarRecursion('previousMonth');
|
|
489
445
|
}
|
|
490
|
-
|
|
491
446
|
const newDate = parseInt(date) - 1;
|
|
492
447
|
return {
|
|
493
448
|
date: newDate,
|
|
@@ -496,10 +451,8 @@ export default class DateTime extends React.PureComponent {
|
|
|
496
451
|
};
|
|
497
452
|
}
|
|
498
453
|
};
|
|
499
|
-
|
|
500
454
|
return modifyCalendarRecursion(type);
|
|
501
455
|
}
|
|
502
|
-
|
|
503
456
|
modifyCalendar(type) {
|
|
504
457
|
const {
|
|
505
458
|
year,
|
|
@@ -512,11 +465,9 @@ export default class DateTime extends React.PureComponent {
|
|
|
512
465
|
date
|
|
513
466
|
}));
|
|
514
467
|
}
|
|
515
|
-
|
|
516
468
|
handleDateReset() {
|
|
517
469
|
this.setState(this.getStateFromProps(this.props));
|
|
518
470
|
}
|
|
519
|
-
|
|
520
471
|
handleGetStateValues() {
|
|
521
472
|
const {
|
|
522
473
|
isActive
|
|
@@ -531,20 +482,17 @@ export default class DateTime extends React.PureComponent {
|
|
|
531
482
|
isMonthOpen
|
|
532
483
|
};
|
|
533
484
|
}
|
|
534
|
-
|
|
535
485
|
handleYearViewToggle(isYearOpen, isMonthOpen) {
|
|
536
486
|
this.setState({
|
|
537
487
|
isYearView: isYearOpen,
|
|
538
488
|
isMonthOpen
|
|
539
489
|
});
|
|
540
490
|
}
|
|
541
|
-
|
|
542
491
|
handleExposeMethods(isMount) {
|
|
543
492
|
const {
|
|
544
493
|
getMethods
|
|
545
494
|
} = this.props;
|
|
546
495
|
let methods = {};
|
|
547
|
-
|
|
548
496
|
if (isMount) {
|
|
549
497
|
methods = {
|
|
550
498
|
resetLocalDate: this.handleDateReset,
|
|
@@ -558,10 +506,8 @@ export default class DateTime extends React.PureComponent {
|
|
|
558
506
|
toggleYearView: null
|
|
559
507
|
};
|
|
560
508
|
}
|
|
561
|
-
|
|
562
509
|
getMethods && getMethods(methods);
|
|
563
510
|
}
|
|
564
|
-
|
|
565
511
|
handleOpenYearView() {
|
|
566
512
|
const {
|
|
567
513
|
isYearView,
|
|
@@ -572,14 +518,12 @@ export default class DateTime extends React.PureComponent {
|
|
|
572
518
|
isMonthOpen: !isMonthOpen
|
|
573
519
|
});
|
|
574
520
|
}
|
|
575
|
-
|
|
576
521
|
handleSelectYear(year) {
|
|
577
522
|
this.setState({
|
|
578
523
|
year,
|
|
579
524
|
isMonthOpen: true
|
|
580
525
|
});
|
|
581
526
|
}
|
|
582
|
-
|
|
583
527
|
handleSelectMonth(month) {
|
|
584
528
|
const {
|
|
585
529
|
date,
|
|
@@ -587,17 +531,14 @@ export default class DateTime extends React.PureComponent {
|
|
|
587
531
|
} = this.state;
|
|
588
532
|
const monthEnd = getMonthEnd(month, year);
|
|
589
533
|
let newDate = date;
|
|
590
|
-
|
|
591
534
|
if (date > monthEnd) {
|
|
592
535
|
newDate = monthEnd;
|
|
593
536
|
}
|
|
594
|
-
|
|
595
537
|
this.setState({
|
|
596
538
|
month,
|
|
597
539
|
date: newDate
|
|
598
540
|
});
|
|
599
541
|
}
|
|
600
|
-
|
|
601
542
|
handleSelectMonthViaYearView(month) {
|
|
602
543
|
this.handleSelectMonth(month);
|
|
603
544
|
this.setState({
|
|
@@ -605,7 +546,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
605
546
|
isMonthOpen: false
|
|
606
547
|
});
|
|
607
548
|
}
|
|
608
|
-
|
|
609
549
|
render() {
|
|
610
550
|
const {
|
|
611
551
|
date,
|
|
@@ -741,7 +681,6 @@ export default class DateTime extends React.PureComponent {
|
|
|
741
681
|
portalId: dropBoxPortalId
|
|
742
682
|
}, /*#__PURE__*/React.createElement(Box, null, childEle)) : null;
|
|
743
683
|
}
|
|
744
|
-
|
|
745
684
|
}
|
|
746
685
|
DateTime.propTypes = DateTime_propTypes;
|
|
747
686
|
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
|
}
|