sag_components 1.0.627 → 1.0.628
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.
|
@@ -466,7 +466,7 @@ const FilterPanel = props => {
|
|
|
466
466
|
var _default = exports.default = FilterPanel;
|
|
467
467
|
FilterPanel.defaultProps = {
|
|
468
468
|
availableQuarters: ['Q1-2024'],
|
|
469
|
-
availableMonths: ['Jan 2024'],
|
|
469
|
+
availableMonths: ['Jan 2024', 'Feb 2024', 'Mar 2024'],
|
|
470
470
|
fieldsData: [],
|
|
471
471
|
width: '800px',
|
|
472
472
|
height: '600px',
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
|
-
var _ChervronRightIcon = _interopRequireDefault(require("./icons/ChervronRightIcon"));
|
|
13
|
-
var _ChervronLeftIcon = _interopRequireDefault(require("./icons/ChervronLeftIcon"));
|
|
14
12
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
15
13
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
16
14
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
@@ -39,16 +37,6 @@ const MonthPopupPicker = _ref => {
|
|
|
39
37
|
setSelectedMonth(date);
|
|
40
38
|
onChangeDate(date);
|
|
41
39
|
};
|
|
42
|
-
const handlePrevMonth = () => {
|
|
43
|
-
const prevDate = currentStartDate ? new Date(currentStartDate) : new Date();
|
|
44
|
-
prevDate.setMonth(prevDate.getMonth() - 1);
|
|
45
|
-
setCurrentStartDate(prevDate);
|
|
46
|
-
};
|
|
47
|
-
const handleNextMonth = () => {
|
|
48
|
-
const nextDate = currentStartDate ? new Date(currentStartDate) : new Date();
|
|
49
|
-
nextDate.setMonth(nextDate.getMonth() + 1);
|
|
50
|
-
setCurrentStartDate(nextDate);
|
|
51
|
-
};
|
|
52
40
|
(0, _react.useEffect)(() => {
|
|
53
41
|
if (value === '' || value === undefined) {
|
|
54
42
|
setSelectedMonth(null);
|
|
@@ -58,6 +46,7 @@ const MonthPopupPicker = _ref => {
|
|
|
58
46
|
}, [value, isOpen]);
|
|
59
47
|
const renderDatePicker = () => {
|
|
60
48
|
const currentDate = currentStartDate || new Date();
|
|
49
|
+
console.log('currentDate', years.indexOf(currentDate.getFullYear()));
|
|
61
50
|
const startMonth = currentDate.getMonth(); // Get the start month index
|
|
62
51
|
const selectedYear = currentDate.getFullYear();
|
|
63
52
|
const endDate = new Date(selectedYear, 11, 1);
|
|
@@ -71,7 +60,7 @@ const MonthPopupPicker = _ref => {
|
|
|
71
60
|
monthCount++;
|
|
72
61
|
}
|
|
73
62
|
return /*#__PURE__*/_react.default.createElement(DatePickerPopup, null, /*#__PURE__*/_react.default.createElement(DatePickerHeader, null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(DatePickerSelect, {
|
|
74
|
-
defaultValue:
|
|
63
|
+
defaultValue: currentDate.getFullYear(),
|
|
75
64
|
onChange: e => {
|
|
76
65
|
const newDate = new Date(currentDate);
|
|
77
66
|
newDate.setFullYear(parseInt(e.target.value, 10));
|
|
@@ -82,48 +71,59 @@ const MonthPopupPicker = _ref => {
|
|
|
82
71
|
}, years.map(year => /*#__PURE__*/_react.default.createElement("option", {
|
|
83
72
|
key: "".concat(year),
|
|
84
73
|
value: "".concat(year)
|
|
85
|
-
}, year)))), /*#__PURE__*/_react.default.createElement(
|
|
86
|
-
|
|
87
|
-
}, /*#__PURE__*/_react.default.createElement(_ChervronLeftIcon.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
88
|
-
onClick: handleNextMonth
|
|
89
|
-
}, /*#__PURE__*/_react.default.createElement(_ChervronRightIcon.default, null)))), /*#__PURE__*/_react.default.createElement(DatePickerCalendar, null, dates.map(date => {
|
|
90
|
-
if (selectedMonth && date.toLocaleString('default', {
|
|
74
|
+
}, year))))), /*#__PURE__*/_react.default.createElement(DatePickerCalendar, null, dates.map(date => {
|
|
75
|
+
const monthYear = "".concat(date.toLocaleString('default', {
|
|
91
76
|
month: 'short'
|
|
92
|
-
})
|
|
77
|
+
}), " ").concat(date.getFullYear());
|
|
78
|
+
const isAvailableMonth = availableMonths.includes(monthYear);
|
|
79
|
+
const isDisabled = !isAvailableMonth || date.getMonth() === 0 && date.getFullYear() === 2022;
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(DateCell, {
|
|
81
|
+
key: date.toISOString()
|
|
82
|
+
// eslint-disable-next-line no-nested-ternary
|
|
83
|
+
,
|
|
84
|
+
className: isDisabled ? 'disable' : selectedMonth && date.getMonth() === selectedMonth.getMonth() && date.getFullYear() === selectedMonth.getFullYear() ? 'selected' : '',
|
|
85
|
+
onClick: () => !isDisabled && handleDateSelect(date)
|
|
86
|
+
}, date.toLocaleString('default', {
|
|
93
87
|
month: 'short'
|
|
94
|
-
}))
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
month: 'short'
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
// if (date.getMonth() === currentDate.getMonth() - 1) {
|
|
122
|
-
// return <DateCell />;
|
|
88
|
+
}));
|
|
89
|
+
// if (
|
|
90
|
+
// selectedMonth
|
|
91
|
+
// && (date.toLocaleString('default', {month: 'short' }) === selectedMonth.toLocaleString('default', {month: 'short' }))
|
|
92
|
+
// ) {
|
|
93
|
+
// return (
|
|
94
|
+
// <DateCell
|
|
95
|
+
// key={date.toISOString()}
|
|
96
|
+
// className="selected"
|
|
97
|
+
// onClick={() => handleDateSelect(date)}
|
|
98
|
+
// >
|
|
99
|
+
// {date.toLocaleString('default', { month: 'short' })}
|
|
100
|
+
// </DateCell>
|
|
101
|
+
// );
|
|
102
|
+
// }
|
|
103
|
+
// if (!availableMonths.includes(`${date.toLocaleString('default', { month: 'short' })} ${currentDate.getFullYear()}`)) {
|
|
104
|
+
// return (
|
|
105
|
+
// <DateCell
|
|
106
|
+
// key={date.toISOString()}
|
|
107
|
+
// className="disable"
|
|
108
|
+
// >
|
|
109
|
+
// {date.toLocaleString('default', { month: 'short' })}
|
|
110
|
+
// </DateCell>
|
|
111
|
+
// );
|
|
123
112
|
// }
|
|
124
|
-
|
|
113
|
+
// if (date.getFullYear() === currentDate.getFullYear()) {
|
|
114
|
+
// return (
|
|
115
|
+
// <DateCell
|
|
116
|
+
// key={date.toISOString()}
|
|
117
|
+
// onClick={() => handleDateSelect(date)}
|
|
118
|
+
// >
|
|
119
|
+
// {date.toLocaleString('default', { month: 'short' })}
|
|
120
|
+
// </DateCell>
|
|
121
|
+
// );
|
|
122
|
+
// }
|
|
123
|
+
// return null;
|
|
125
124
|
})));
|
|
126
125
|
};
|
|
126
|
+
|
|
127
127
|
return /*#__PURE__*/_react.default.createElement(DatePickerContainer, null, isOpen && renderDatePicker());
|
|
128
128
|
};
|
|
129
129
|
var _default = exports.default = MonthPopupPicker;
|