intelicoreact 0.0.93 → 0.0.96
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/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +1 -1
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +33 -9
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.scss +5 -0
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +27 -6
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +20 -9
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +7 -5
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +29 -24
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +13 -7
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +427 -0
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +120 -0
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js +56 -0
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +11 -8
- package/dist/Atomic/UI/Calendar/Calendar.js +16 -13
- package/dist/Functions/customEventListener.js +66 -0
- package/dist/Functions/useMouseUpOutside.js +23 -0
- package/package.json +1 -1
- package/src/Atomic/FormElements/Dropdown/Dropdown.stories.js +1 -1
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.js +45 -6
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.scss +5 -0
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +15 -6
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +57 -22
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +10 -8
- package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +391 -392
- package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +11 -3
- package/src/Atomic/FormElements/MobileCalendar/MobileCalendar.js +315 -0
- package/src/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +120 -0
- package/src/Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js +30 -0
- package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.js +132 -126
- package/src/Atomic/UI/Calendar/Calendar.js +29 -12
- package/src/Functions/customEventListener.js +58 -0
- package/src/Functions/useMouseUpOutside.js +16 -0
|
@@ -102,7 +102,7 @@ var Template = function Template(args) {
|
|
|
102
102
|
var DropdownTemplate = Template.bind({});
|
|
103
103
|
exports.DropdownTemplate = DropdownTemplate;
|
|
104
104
|
DropdownTemplate.args = {
|
|
105
|
-
isListTop: true,
|
|
105
|
+
// isListTop: true,
|
|
106
106
|
entity: 'entity',
|
|
107
107
|
value: 'drop6',
|
|
108
108
|
placeholder: 'Placeholder',
|
|
@@ -17,6 +17,8 @@ var _moment = _interopRequireDefault(require("moment"));
|
|
|
17
17
|
|
|
18
18
|
var _reactInputMask = _interopRequireDefault(require("react-input-mask"));
|
|
19
19
|
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
20
22
|
var _Calendar = _interopRequireDefault(require("../../UI/Calendar/Calendar"));
|
|
21
23
|
|
|
22
24
|
var _useClickOutside = require("../../../Functions/useClickOutside");
|
|
@@ -31,6 +33,9 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
31
33
|
var value = _ref.value,
|
|
32
34
|
minDate = _ref.minDate,
|
|
33
35
|
maxDate = _ref.maxDate,
|
|
36
|
+
_ref$format = _ref.format,
|
|
37
|
+
format = _ref$format === void 0 ? 'MM/DD/YYYY' : _ref$format,
|
|
38
|
+
isDontLimitFuture = _ref.isDontLimitFuture,
|
|
34
39
|
onChange = _ref.onChange,
|
|
35
40
|
_ref$className = _ref.className,
|
|
36
41
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
@@ -38,8 +43,8 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
38
43
|
placeholder = _ref$placeholder === void 0 ? 'mm/dd/yyyy' : _ref$placeholder,
|
|
39
44
|
_ref$mask = _ref.mask,
|
|
40
45
|
mask = _ref$mask === void 0 ? '99/99/9999' : _ref$mask,
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
isListTop = _ref.isListTop,
|
|
47
|
+
disabled = _ref.disabled;
|
|
43
48
|
|
|
44
49
|
var _useState = (0, _react.useState)(false),
|
|
45
50
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -47,6 +52,10 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
47
52
|
setIsOpened = _useState2[1];
|
|
48
53
|
|
|
49
54
|
var calendarRef = (0, _react.useRef)(null);
|
|
55
|
+
var formatedMinDate = (0, _moment.default)(minDate).format(format) !== 'Invalid date' ? (0, _moment.default)(minDate).format(format) : null;
|
|
56
|
+
var formatedMaxDate = (0, _moment.default)(maxDate).format(format) !== 'Invalid date' ? (0, _moment.default)(maxDate).format(format) : null;
|
|
57
|
+
var momentMinDate = (0, _moment.default)(formatedMinDate, format).startOf('day');
|
|
58
|
+
var momentMaxDate = (0, _moment.default)(formatedMaxDate, format).startOf('day');
|
|
50
59
|
(0, _useClickOutside.useClickOutside)(calendarRef, function () {
|
|
51
60
|
return setIsOpened(false);
|
|
52
61
|
});
|
|
@@ -65,8 +74,15 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
65
74
|
return (0, _moment.default)(new Date()).format('L');
|
|
66
75
|
};
|
|
67
76
|
|
|
77
|
+
var handleBlur = function handleBlur(e) {
|
|
78
|
+
var value = e.target.value;
|
|
79
|
+
if ((0, _moment.default)(value).format(format) === 'Invalid date') onChange('');else if ((0, _moment.default)(value).startOf('day').isBefore(momentMinDate, 'days')) onChange(formatedMinDate);else if ((0, _moment.default)(value).endOf('day').isAfter(momentMaxDate, 'days')) onChange(formatedMaxDate);else onChange((0, _moment.default)(value).format(format));
|
|
80
|
+
};
|
|
81
|
+
|
|
68
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
-
className:
|
|
83
|
+
className: (0, _classnames.default)('input__wrap calendar-container', className, {
|
|
84
|
+
'calendar-container_disabled': disabled
|
|
85
|
+
}),
|
|
70
86
|
ref: calendarRef
|
|
71
87
|
}, /*#__PURE__*/_react.default.createElement(_reactInputMask.default, {
|
|
72
88
|
mask: mask,
|
|
@@ -77,20 +93,28 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
77
93
|
},
|
|
78
94
|
className: "calendar-dropdown",
|
|
79
95
|
onFocus: function onFocus() {
|
|
80
|
-
return setIsOpened(
|
|
96
|
+
return setIsOpened(true);
|
|
97
|
+
},
|
|
98
|
+
onBlur: !isOpened ? handleBlur : function () {},
|
|
99
|
+
onKeyUp: function onKeyUp(e) {
|
|
100
|
+
if (e.key === 'Enter') e.target.blur();
|
|
101
|
+
setIsOpened(false);
|
|
81
102
|
}
|
|
82
103
|
}), isOpened ? /*#__PURE__*/_react.default.createElement(_Calendar.default, {
|
|
83
|
-
className: isListTop ? '' : '',
|
|
84
104
|
date: getCalendarValue(value),
|
|
85
105
|
setDate: function setDate(newDate) {
|
|
86
106
|
return changeCalendarDay(newDate);
|
|
87
107
|
},
|
|
88
108
|
params: {
|
|
89
|
-
|
|
90
|
-
|
|
109
|
+
format: format,
|
|
110
|
+
minDate: formatedMinDate,
|
|
111
|
+
maxDate: formatedMaxDate,
|
|
112
|
+
momentMinDate: momentMinDate,
|
|
113
|
+
momentMaxDate: momentMaxDate,
|
|
114
|
+
isDontLimitFuture: isDontLimitFuture
|
|
91
115
|
},
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
isListTop: isListTop,
|
|
117
|
+
setIsOpened: setIsOpened
|
|
94
118
|
}) : null);
|
|
95
119
|
};
|
|
96
120
|
|
|
@@ -39,20 +39,41 @@ var Template = function Template(args) {
|
|
|
39
39
|
date = _useState2[0],
|
|
40
40
|
setDate = _useState2[1];
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
var _useState3 = (0, _react.useState)(false),
|
|
43
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
44
|
+
disabled = _useState4[0],
|
|
45
|
+
setDisabled = _useState4[1];
|
|
46
|
+
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_InputCalendar.default, (0, _extends2.default)({}, args, {
|
|
43
48
|
value: date,
|
|
44
49
|
onChange: function onChange(val) {
|
|
45
50
|
return setDate(val);
|
|
51
|
+
},
|
|
52
|
+
disabled: disabled
|
|
53
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
style: {
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexFlow: 'row nowrap',
|
|
57
|
+
justifyContent: 'flex-end',
|
|
58
|
+
marginTop: '10px'
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
61
|
+
style: {
|
|
62
|
+
border: 'solid 1px black',
|
|
63
|
+
padding: '10px',
|
|
64
|
+
width: '80px'
|
|
65
|
+
},
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
return setDisabled(!disabled);
|
|
46
68
|
}
|
|
47
|
-
}));
|
|
69
|
+
}, disabled ? 'Enable' : 'Disable')));
|
|
48
70
|
};
|
|
49
71
|
|
|
50
72
|
var CalendarTemplate = Template.bind({});
|
|
51
73
|
exports.CalendarTemplate = CalendarTemplate;
|
|
52
74
|
CalendarTemplate.args = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
isDontLimitFuture: true // isListTop: true,
|
|
75
|
+
minDate: '01/10/2022',
|
|
76
|
+
maxDate: '04/20/2022' // isDontLimitFuture: true,
|
|
77
|
+
// isListTop: true,
|
|
57
78
|
|
|
58
79
|
};
|
|
@@ -59,7 +59,14 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
59
59
|
_props$minDate = props.minDate,
|
|
60
60
|
minDate = _props$minDate === void 0 ? null : _props$minDate,
|
|
61
61
|
_props$maxDate = props.maxDate,
|
|
62
|
-
maxDate = _props$maxDate === void 0 ? null : _props$maxDate
|
|
62
|
+
maxDate = _props$maxDate === void 0 ? null : _props$maxDate,
|
|
63
|
+
_props$format = props.format,
|
|
64
|
+
format = _props$format === void 0 ? 'MM/DD/YYYY' : _props$format,
|
|
65
|
+
isDontLimitFuture = props.isDontLimitFuture;
|
|
66
|
+
var formatedMinDate = (0, _momentTimezone.default)(minDate).format(format) !== 'Invalid date' ? (0, _momentTimezone.default)(minDate).format(format) : null;
|
|
67
|
+
var formatedMaxDate = (0, _momentTimezone.default)(maxDate).format(format) !== 'Invalid date' ? (0, _momentTimezone.default)(maxDate).format(format) : null;
|
|
68
|
+
var momentMinDate = (0, _momentTimezone.default)(formatedMinDate, format).startOf('day');
|
|
69
|
+
var momentMaxDate = (0, _momentTimezone.default)(formatedMaxDate, format).startOf('day');
|
|
63
70
|
var actualValues = (0, _dependencies.getActualDateRange)(value);
|
|
64
71
|
|
|
65
72
|
var _useToggle = (0, _dependencies.useToggle)(false),
|
|
@@ -86,14 +93,14 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
86
93
|
|
|
87
94
|
var formatedValue = _objectSpread(_objectSpread(_objectSpread({
|
|
88
95
|
intervalKey: newValue.intervalKey,
|
|
89
|
-
start: newValue.start ? (0, _momentTimezone.default)(newValue.start).format('YYYY-MM-DDTHH:mm') : newValue.start,
|
|
90
|
-
end: newValue.end ? (0, _momentTimezone.default)(newValue.end).format('YYYY-MM-DDTHH:mm') : newValue.end
|
|
96
|
+
start: newValue.start ? (0, _momentTimezone.default)(newValue.start).format(format || 'YYYY-MM-DDTHH:mm') : newValue.start,
|
|
97
|
+
end: newValue.end ? (0, _momentTimezone.default)(newValue.end).format(format || 'YYYY-MM-DDTHH:mm') : newValue.end
|
|
91
98
|
}, newValue.compare ? {
|
|
92
99
|
compare: newValue.compare
|
|
93
100
|
} : {}), newValue.startPrevDate ? {
|
|
94
|
-
startPrevDate: (0, _momentTimezone.default)(newValue.startPrevDate).format('YYYY-MM-DDTHH:mm')
|
|
101
|
+
startPrevDate: (0, _momentTimezone.default)(newValue.startPrevDate).format(format || 'YYYY-MM-DDTHH:mm')
|
|
95
102
|
} : {}), newValue.endPrevDate ? {
|
|
96
|
-
endPrevDate: (0, _momentTimezone.default)(newValue.endPrevDate).format('YYYY-MM-DDTHH:mm')
|
|
103
|
+
endPrevDate: (0, _momentTimezone.default)(newValue.endPrevDate).format(format || 'YYYY-MM-DDTHH:mm')
|
|
97
104
|
} : {});
|
|
98
105
|
|
|
99
106
|
onChange(formatedValue);
|
|
@@ -211,14 +218,14 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
211
218
|
onClick: function onClick() {
|
|
212
219
|
return handleArrowClick('left');
|
|
213
220
|
},
|
|
214
|
-
disabled: disabled || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === _dependencies.ALL_TIME_KEY
|
|
221
|
+
disabled: disabled || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === _dependencies.ALL_TIME_KEY || formatedMinDate && (0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.start).subtract((0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).diff(actualValues === null || actualValues === void 0 ? void 0 : actualValues.start, 'hours'), 'hours').isBefore(momentMinDate)
|
|
215
222
|
}), /*#__PURE__*/_react.default.createElement(_Arrow.default, {
|
|
216
223
|
type: "right",
|
|
217
224
|
className: "date-range-input__arrow",
|
|
218
225
|
onClick: function onClick() {
|
|
219
226
|
return handleArrowClick('right');
|
|
220
227
|
},
|
|
221
|
-
disabled: disabled || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === _dependencies.ALL_TIME_KEY || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.
|
|
228
|
+
disabled: disabled || (actualValues === null || actualValues === void 0 ? void 0 : actualValues.intervalKey) === _dependencies.ALL_TIME_KEY || !isDontLimitFuture && (formatedMaxDate ? (0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).endOf('day').subtract((0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).diff(actualValues === null || actualValues === void 0 ? void 0 : actualValues.start, 'hours'), 'hours').isAfter(momentMaxDate.startOf('day')) : (0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).add((0, _momentTimezone.default)(actualValues === null || actualValues === void 0 ? void 0 : actualValues.end).diff(actualValues === null || actualValues === void 0 ? void 0 : actualValues.start, 'hours'), 'hours').isAfter((0, _momentTimezone.default)().add(1, 'day').startOf('day')))
|
|
222
229
|
}))), isToggled && !isUseAbs && /*#__PURE__*/_react.default.createElement(_OpenedPart.default, (0, _extends2.default)({}, props, {
|
|
223
230
|
ref: internalContainerRef,
|
|
224
231
|
actualValues: actualValues,
|
|
@@ -228,8 +235,12 @@ var InputDateRange = function InputDateRange(props) {
|
|
|
228
235
|
setIsCompare: setIsCompare,
|
|
229
236
|
toggleOff: toggleOff,
|
|
230
237
|
onChange: handleChange,
|
|
231
|
-
minDate:
|
|
232
|
-
maxDate:
|
|
238
|
+
minDate: formatedMinDate,
|
|
239
|
+
maxDate: formatedMaxDate,
|
|
240
|
+
format: format,
|
|
241
|
+
momentMinDate: momentMinDate,
|
|
242
|
+
momentMaxDate: momentMaxDate,
|
|
243
|
+
isDontLimitFuture: isDontLimitFuture
|
|
233
244
|
})))), error && /*#__PURE__*/_react.default.createElement("span", {
|
|
234
245
|
className: "date-range-input__error-block"
|
|
235
246
|
}, error));
|
|
@@ -17,6 +17,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
21
|
+
|
|
20
22
|
var _InputDateRange = _interopRequireDefault(require("./InputDateRange"));
|
|
21
23
|
|
|
22
24
|
var _Table = _interopRequireDefault(require("../Table/Table"));
|
|
@@ -48,9 +50,7 @@ var Template = function Template(args) {
|
|
|
48
50
|
var _useState = (0, _react.useState)(dateRange),
|
|
49
51
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
50
52
|
value = _useState2[0],
|
|
51
|
-
setValue = _useState2[1];
|
|
52
|
-
// return <InputDateRange {...restOfProps} value={value} onChange={setValue} />;
|
|
53
|
-
|
|
53
|
+
setValue = _useState2[1];
|
|
54
54
|
|
|
55
55
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
56
56
|
className: "mb20"
|
|
@@ -77,8 +77,10 @@ InputDateRangeTemplate.args = {
|
|
|
77
77
|
error: false,
|
|
78
78
|
disabled: false,
|
|
79
79
|
isHoverable: false,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
// format: 'DD/MM/YYYY',
|
|
81
|
+
minDate: '01/10/2022',
|
|
82
|
+
maxDate: '04/20/2022',
|
|
83
|
+
// isDontLimitFuture: true,
|
|
82
84
|
// short: true,
|
|
83
85
|
isCompact: false,
|
|
84
86
|
// isFocused: true,
|
|
@@ -68,10 +68,12 @@ var Datepicker = function Datepicker(props) {
|
|
|
68
68
|
handleItemClick = props.handleItemClick,
|
|
69
69
|
setActiveInterval = props.setActiveInterval,
|
|
70
70
|
isShortWeekNames = props.isShortWeekNames,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
minDate = props.minDate,
|
|
72
|
+
maxDate = props.maxDate,
|
|
73
|
+
momentMinDate = props.momentMinDate,
|
|
74
|
+
momentMaxDate = props.momentMaxDate,
|
|
75
|
+
isDontLimitFuture = props.isDontLimitFuture,
|
|
76
|
+
format = props.format;
|
|
75
77
|
var _values$start = values.start,
|
|
76
78
|
start = _values$start === void 0 ? null : _values$start,
|
|
77
79
|
_values$end = values.end,
|
|
@@ -348,18 +350,15 @@ var Datepicker = function Datepicker(props) {
|
|
|
348
350
|
var newDate;
|
|
349
351
|
|
|
350
352
|
if (!(0, _momentTimezone.default)(startDateInput).isValid()) {
|
|
351
|
-
newDate = startDate;
|
|
353
|
+
newDate = (0, _momentTimezone.default)(startDate);
|
|
352
354
|
} else {
|
|
353
|
-
if (minDate &&
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
} else {
|
|
358
|
-
newDate = (0, _momentTimezone.default)(startDateInput);
|
|
359
|
-
}
|
|
355
|
+
if (minDate && (0, _momentTimezone.default)(startDateInput).isBefore(minDate)) newDate = momentMinDate;else if (!isDontLimitFuture) {
|
|
356
|
+
var edge = maxDate ? momentMaxDate : (0, _momentTimezone.default)().add(1, 'day').startOf('day');
|
|
357
|
+
if ((0, _momentTimezone.default)(startDateInput).isAfter(edge)) newDate = edge;else newDate = (0, _momentTimezone.default)(startDateInput);
|
|
358
|
+
} else newDate = (0, _momentTimezone.default)(startDateInput);
|
|
360
359
|
}
|
|
361
360
|
|
|
362
|
-
setStartDateInput(newDate);
|
|
361
|
+
setStartDateInput(newDate.format(format));
|
|
363
362
|
setStartDate(newDate.set('hour', parseInt(startHour, 10)).toDate());
|
|
364
363
|
doBlur('start', e);
|
|
365
364
|
setDate1((0, _momentTimezone.default)(newDate).isSameOrAfter((0, _momentTimezone.default)(date2), 'month') ? (0, _momentTimezone.default)(date2).subtract(1, 'month') : (0, _momentTimezone.default)(newDate));
|
|
@@ -377,19 +376,16 @@ var Datepicker = function Datepicker(props) {
|
|
|
377
376
|
var newDate;
|
|
378
377
|
|
|
379
378
|
if (!(0, _momentTimezone.default)(endDateInput).isValid()) {
|
|
380
|
-
newDate = endDate;
|
|
379
|
+
newDate = (0, _momentTimezone.default)(endDate);
|
|
381
380
|
} else {
|
|
382
|
-
if (minDate &&
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
} else {
|
|
387
|
-
newDate = (0, _momentTimezone.default)(endDateInput);
|
|
388
|
-
}
|
|
381
|
+
if (minDate && (0, _momentTimezone.default)(endDateInput).isBefore(minDate)) newDate = momentMinDate;else if (!isDontLimitFuture) {
|
|
382
|
+
var edge = maxDate ? momentMaxDate : (0, _momentTimezone.default)().endOf('day');
|
|
383
|
+
if ((0, _momentTimezone.default)(endDateInput).isAfter(edge)) newDate = maxDate ? edge : edge.startOf('day');else newDate = (0, _momentTimezone.default)(startDateInput);
|
|
384
|
+
} else newDate = (0, _momentTimezone.default)(startDateInput);
|
|
389
385
|
}
|
|
390
386
|
|
|
391
387
|
setEndDate(addDay(newDate.set('hour', parseInt(endHour, 10)).toDate()));
|
|
392
|
-
setEndDateInput(newDate);
|
|
388
|
+
setEndDateInput(newDate.format(format));
|
|
393
389
|
doBlur('end', e);
|
|
394
390
|
setDate2(newDate);
|
|
395
391
|
};
|
|
@@ -480,7 +476,11 @@ var Datepicker = function Datepicker(props) {
|
|
|
480
476
|
onClick: handleClick,
|
|
481
477
|
onHover: handleHover,
|
|
482
478
|
limitRange: limitRange,
|
|
483
|
-
isShortWeekNames: isShortWeekNames
|
|
479
|
+
isShortWeekNames: isShortWeekNames,
|
|
480
|
+
minDate: minDate,
|
|
481
|
+
maxDate: maxDate,
|
|
482
|
+
momentMinDate: momentMinDate,
|
|
483
|
+
momentMaxDate: momentMaxDate
|
|
484
484
|
}), /*#__PURE__*/_react.default.createElement(_RangeCalendar.default, {
|
|
485
485
|
className: "date-picker__calendar",
|
|
486
486
|
date: date2,
|
|
@@ -492,7 +492,12 @@ var Datepicker = function Datepicker(props) {
|
|
|
492
492
|
endPrevDate: endPrevDate,
|
|
493
493
|
onClick: handleClick,
|
|
494
494
|
onHover: handleHover,
|
|
495
|
-
isShortWeekNames: isShortWeekNames
|
|
495
|
+
isShortWeekNames: isShortWeekNames,
|
|
496
|
+
minDate: minDate,
|
|
497
|
+
maxDate: maxDate,
|
|
498
|
+
momentMinDate: momentMinDate,
|
|
499
|
+
momentMaxDate: momentMaxDate,
|
|
500
|
+
isDontLimitFuture: isDontLimitFuture
|
|
496
501
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
497
502
|
className: (0, _classnames.default)('date-picker__footer', {
|
|
498
503
|
'date-picker__footer_once-element': isCompareHidden
|
|
@@ -57,10 +57,12 @@ var OpenedPart = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
57
57
|
setIsCompare = props.setIsCompare,
|
|
58
58
|
toggleOff = props.toggleOff,
|
|
59
59
|
isShortWeekNames = props.isShortWeekNames,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
minDate = props.minDate,
|
|
61
|
+
maxDate = props.maxDate,
|
|
62
|
+
format = props.format,
|
|
63
|
+
momentMinDate = props.momentMinDate,
|
|
64
|
+
momentMaxDate = props.momentMaxDate,
|
|
65
|
+
isDontLimitFuture = props.isDontLimitFuture;
|
|
64
66
|
|
|
65
67
|
var items = isCompact ? (0, _toConsumableArray2.default)(Object.keys(_dependencies.INTERVALS)) : [].concat((0, _toConsumableArray2.default)(Object.keys(_dependencies.INTERVALS)), [_dependencies.CUSTOM_INTERVAL_KEY]);
|
|
66
68
|
|
|
@@ -118,7 +120,7 @@ var OpenedPart = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
118
120
|
// { 'form-select-options--hoverable': isHoverable },
|
|
119
121
|
)
|
|
120
122
|
}, items.map(function (item, index) {
|
|
121
|
-
var _intervals$item;
|
|
123
|
+
var _intervals$item, _intervals$item2, _intervals$item2$star, _intervals$item2$star2, _intervals$item2$star3;
|
|
122
124
|
|
|
123
125
|
return /*#__PURE__*/_react.default.createElement(_SelectItem.default, {
|
|
124
126
|
key: index,
|
|
@@ -128,7 +130,7 @@ var OpenedPart = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
128
130
|
onItemClick: function onItemClick() {
|
|
129
131
|
return handleItemClick(item.value || item);
|
|
130
132
|
},
|
|
131
|
-
disabled: item === _dependencies.CUSTOM_INTERVAL_KEY
|
|
133
|
+
disabled: item === _dependencies.CUSTOM_INTERVAL_KEY || minDate && ((_intervals$item2 = _dependencies.INTERVALS[item]) === null || _intervals$item2 === void 0 ? void 0 : (_intervals$item2$star = _intervals$item2.start) === null || _intervals$item2$star === void 0 ? void 0 : (_intervals$item2$star2 = _intervals$item2$star.call(_intervals$item2)) === null || _intervals$item2$star2 === void 0 ? void 0 : (_intervals$item2$star3 = _intervals$item2$star2.isBefore) === null || _intervals$item2$star3 === void 0 ? void 0 : _intervals$item2$star3.call(_intervals$item2$star2, momentMinDate))
|
|
132
134
|
});
|
|
133
135
|
})), !isCompact && /*#__PURE__*/_react.default.createElement(_Datepicker.default, {
|
|
134
136
|
className: (0, _classnames.default)('opened-part__date-picker'),
|
|
@@ -154,7 +156,11 @@ var OpenedPart = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
154
156
|
setActiveInterval: setActiveInterval,
|
|
155
157
|
isShortWeekNames: isShortWeekNames,
|
|
156
158
|
minDate: minDate,
|
|
157
|
-
maxDate: maxDate
|
|
159
|
+
maxDate: maxDate,
|
|
160
|
+
format: format,
|
|
161
|
+
momentMinDate: momentMinDate,
|
|
162
|
+
momentMaxDate: momentMaxDate,
|
|
163
|
+
isDontLimitFuture: isDontLimitFuture
|
|
158
164
|
})));
|
|
159
165
|
});
|
|
160
166
|
|