@capillarytech/blaze-ui 6.0.4 → 6.1.0
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/CapEventCalendar/CalendarCanvas/index.d.ts +52 -3
- package/CapEventCalendar/CalendarCanvas/index.d.ts.map +1 -1
- package/CapEventCalendar/CalendarCanvas/index.js +50 -31
- package/CapEventCalendar/CalendarCanvas/utils.d.ts +9 -5
- package/CapEventCalendar/CalendarCanvas/utils.d.ts.map +1 -1
- package/CapEventCalendar/CalendarCanvas/utils.js +6 -6
- package/CapEventCalendar/components/DayDropdown/index.d.ts +13 -3
- package/CapEventCalendar/components/DayDropdown/index.d.ts.map +1 -1
- package/CapEventCalendar/components/DayDropdown/index.js +14 -32
- package/CapEventCalendar/components/MonthHeader/index.d.ts +9 -3
- package/CapEventCalendar/components/MonthHeader/index.d.ts.map +1 -1
- package/CapEventCalendar/components/MonthHeader/index.js +9 -4
- package/CapEventCalendar/drawUtils.d.ts +71 -9
- package/CapEventCalendar/drawUtils.d.ts.map +1 -1
- package/CapEventCalendar/drawUtils.js +4 -12
- package/CapEventCalendar/index.d.ts +80 -4
- package/CapEventCalendar/index.d.ts.map +1 -1
- package/CapEventCalendar/index.js +85 -60
- package/CapEventCalendar/styles.css +81 -9
- package/CapEventCalendar/styles.scss +107 -34
- package/CapEventCalendar/utils.d.ts +9 -11
- package/CapEventCalendar/utils.d.ts.map +1 -1
- package/CapEventCalendar/utils.js +7 -10
- package/CapSelectFilter/index.d.ts.map +1 -1
- package/CapSelectFilter/index.js +10 -11
- package/CapSelectFilter/styles.css +11 -10
- package/CapSelectFilter/styles.module.scss.js +8 -10
- package/CapSelectFilter/styles.scss +11 -8
- package/CapSelectFilter/types.d.ts +1 -1
- package/CapSelectFilter/types.d.ts.map +1 -1
- package/CapTabV3/tests/CapTabV3.mockData.d.ts +26 -26
- package/CapTabV3/tests/CapTabV3.mockData.d.ts.map +1 -1
- package/index.d.ts +0 -2
- package/index.d.ts.map +1 -1
- package/index.js +221 -223
- package/package.json +1 -1
- package/utils/dayjs.d.ts +0 -1
- package/utils/dayjs.d.ts.map +1 -1
- package/utils/dayjs.js +0 -1
- package/CapEventCalendar/CalendarCanvas/calendarCanvasStyles.css +0 -21
- package/CapEventCalendar/CalendarCanvas/calendarCanvasStyles.module.scss.js +0 -8
- package/CapEventCalendar/CalendarCanvas/calendarCanvasStyles.scss +0 -17
- package/CapEventCalendar/components/MonthHeader/monthHeaderStyles.css +0 -20
- package/CapEventCalendar/components/MonthHeader/monthHeaderStyles.module.scss.js +0 -7
- package/CapEventCalendar/components/MonthHeader/monthHeaderStyles.scss +0 -15
- package/CapEventCalendar/messages.d.ts +0 -25
- package/CapEventCalendar/messages.d.ts.map +0 -1
- package/CapEventCalendar/messages.js +0 -28
- package/CapEventCalendar/styles.module.scss.js +0 -12
- package/CapEventCalendar/tests/types.d.ts +0 -26
- package/CapEventCalendar/tests/types.d.ts.map +0 -1
- package/CapEventCalendar/types.d.ts +0 -188
- package/CapEventCalendar/types.d.ts.map +0 -1
- package/CapEventCalendar/types.js +0 -1
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
3
4
|
import { useState, useEffect } from "react";
|
|
4
|
-
import { injectIntl } from "react-intl";
|
|
5
5
|
import "../utils/dayjs.js";
|
|
6
6
|
import EmptyStateIllustrationForPromos from "../assets/images/EmptyStateIllustrationForPromos.png.js";
|
|
7
7
|
import CapIcon from "../CapIcon/index.js";
|
|
8
8
|
import CapIllustration from "../CapIllustration/index.js";
|
|
9
|
-
import CapLabelWithStatic from "../CapLabel/index.js";
|
|
10
9
|
import CapRow from "../CapRow/index.js";
|
|
11
10
|
import { FONT_SIZE_S, FONT_FAMILY } from "../styles/_variables.js";
|
|
12
11
|
import CalendarCanvas from "./CalendarCanvas/index.js";
|
|
13
12
|
import DayDropdown from "./components/DayDropdown/index.js";
|
|
14
13
|
import MonthHeader from "./components/MonthHeader/index.js";
|
|
15
|
-
import { QUARTERS,
|
|
16
|
-
import
|
|
17
|
-
import styles from "./styles.module.scss.js";
|
|
14
|
+
import { QUARTERS, MONTH_LABELS, DAY_LABELS, QUARTER_LABELS } from "./constants.js";
|
|
15
|
+
import './styles.css';/* empty css */
|
|
18
16
|
import { splitMonthsArrayToQuarterChunks, getMonthsForQuarter, formatDataToSuitCanvas, handleYearChange } from "./utils.js";
|
|
19
17
|
import dayjs from "dayjs";
|
|
20
18
|
const DefaultPopover = ({ title }) => /* @__PURE__ */ jsx("div", { children: title });
|
|
19
|
+
DefaultPopover.propTypes = {
|
|
20
|
+
title: PropTypes.string
|
|
21
|
+
};
|
|
21
22
|
const CapEventCalendar = ({
|
|
22
|
-
intl: { formatMessage },
|
|
23
23
|
calendarDate = dayjs().format(),
|
|
24
|
-
events
|
|
25
|
-
popoverContent
|
|
24
|
+
events,
|
|
25
|
+
popoverContent,
|
|
26
26
|
onQuarterChange,
|
|
27
27
|
selectedQuarter,
|
|
28
28
|
calendarGridLineLabel,
|
|
29
|
-
dayLabels
|
|
30
|
-
allQuartersLabel
|
|
31
|
-
monthLabels
|
|
29
|
+
dayLabels,
|
|
30
|
+
allQuartersLabel,
|
|
31
|
+
monthLabels,
|
|
32
32
|
todayTooltipProps,
|
|
33
|
-
dashLineOffsetY
|
|
34
|
-
eventHeight
|
|
35
|
-
eventRowGap
|
|
36
|
-
textPadding
|
|
37
|
-
eventStartYOffset
|
|
38
|
-
minCanvasHeight
|
|
39
|
-
canvasFont
|
|
40
|
-
popoverPlacement
|
|
33
|
+
dashLineOffsetY,
|
|
34
|
+
eventHeight,
|
|
35
|
+
eventRowGap,
|
|
36
|
+
textPadding,
|
|
37
|
+
eventStartYOffset,
|
|
38
|
+
minCanvasHeight,
|
|
39
|
+
canvasFont,
|
|
40
|
+
popoverPlacement,
|
|
41
41
|
emptyState,
|
|
42
42
|
emptyStateTitle,
|
|
43
43
|
emptyStateDescription,
|
|
44
44
|
emptyStateButtonLabel,
|
|
45
45
|
onEmptyStateButtonClick,
|
|
46
|
-
isButtonDisabled
|
|
46
|
+
isButtonDisabled
|
|
47
47
|
}) => {
|
|
48
48
|
const [carouselDate, setCarouselDate] = useState(calendarDate);
|
|
49
49
|
const [quarter, setQuarter] = useState(
|
|
@@ -54,27 +54,25 @@ const CapEventCalendar = ({
|
|
|
54
54
|
const [error, showError] = useState(false);
|
|
55
55
|
const [dayGrid, setDayGrid] = useState(1);
|
|
56
56
|
const [quarterMonths] = useState(splitMonthsArrayToQuarterChunks(monthLabels));
|
|
57
|
-
const resolvedCalendarGridLineLabel = calendarGridLineLabel || formatMessage(messages.calendarGridLineLabel);
|
|
58
|
-
const resolvedEmptyStateTitle = emptyStateTitle || formatMessage(messages.emptyStateTitle);
|
|
59
|
-
const resolvedEmptyStateDescription = emptyStateDescription || formatMessage(messages.emptyStateDescription);
|
|
60
|
-
const resolvedEmptyStateButtonLabel = emptyStateButtonLabel || formatMessage(messages.emptyStateButtonLabel);
|
|
61
|
-
const resolvedTodayTooltipProps = todayTooltipProps || {
|
|
62
|
-
title: formatMessage(messages.todayLabel)
|
|
63
|
-
};
|
|
64
57
|
useEffect(() => {
|
|
65
58
|
const _quarter = selectedQuarter ? QUARTERS[selectedQuarter] : quarter;
|
|
66
59
|
setDisplayMonths(
|
|
67
60
|
getMonthsForQuarter(_quarter, quarterMonths)
|
|
68
61
|
//show months of the quarter
|
|
69
62
|
);
|
|
70
|
-
setFormattedEvents(
|
|
63
|
+
setFormattedEvents(
|
|
64
|
+
formatDataToSuitCanvas(
|
|
65
|
+
events,
|
|
66
|
+
selectedQuarter ? QUARTERS[selectedQuarter] : quarter || dayjs().quarter()
|
|
67
|
+
)
|
|
68
|
+
);
|
|
71
69
|
}, [events]);
|
|
72
70
|
const handleCarouselClick = (currentQuarter, date, increment, referenceDate) => {
|
|
73
71
|
if (increment) showError(false);
|
|
74
72
|
const values = handleYearChange(currentQuarter, date, increment, referenceDate);
|
|
75
73
|
if (values) {
|
|
76
74
|
setCarouselDate(values[1]);
|
|
77
|
-
onQuarterChange
|
|
75
|
+
onQuarterChange(values[0], dayjs(values[1]));
|
|
78
76
|
if (values[2]) showError(true);
|
|
79
77
|
return values[0];
|
|
80
78
|
}
|
|
@@ -96,30 +94,26 @@ const CapEventCalendar = ({
|
|
|
96
94
|
const onClickQuarterRight = () => handleQuarterSelection(false);
|
|
97
95
|
const getIllustrationProps = (hasAccess) => ({
|
|
98
96
|
illustrationImage: EmptyStateIllustrationForPromos,
|
|
99
|
-
title:
|
|
97
|
+
title: emptyStateTitle,
|
|
100
98
|
hasAccess,
|
|
101
|
-
description:
|
|
99
|
+
description: emptyStateDescription,
|
|
102
100
|
descriptionPosition: "bottom",
|
|
103
|
-
buttonLabel:
|
|
101
|
+
buttonLabel: emptyStateButtonLabel,
|
|
104
102
|
//prevents the required warning in the console
|
|
105
|
-
onClick: onEmptyStateButtonClick
|
|
106
|
-
}),
|
|
103
|
+
onClick: onEmptyStateButtonClick,
|
|
107
104
|
//prevents the required warning in the console
|
|
108
105
|
disabled: isButtonDisabled
|
|
109
106
|
});
|
|
110
107
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
111
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
112
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
108
|
+
/* @__PURE__ */ jsxs("div", { className: "event-calendar__header", children: [
|
|
109
|
+
/* @__PURE__ */ jsxs("div", { className: "event-calendar__header__left", children: [
|
|
113
110
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
114
111
|
/* @__PURE__ */ jsx(
|
|
115
112
|
CapIcon,
|
|
116
113
|
{
|
|
117
114
|
type: "chevron-left",
|
|
118
115
|
style: { cursor: "pointer" },
|
|
119
|
-
className: classNames({
|
|
120
|
-
[styles["disable-left"]]: error,
|
|
121
|
-
[styles["carousel-icon"]]: true
|
|
122
|
-
}),
|
|
116
|
+
className: classNames({ "disable-left": error, "carousel-icon": true }),
|
|
123
117
|
onClick: onClickQuarterLeft,
|
|
124
118
|
"data-testid": "event-calander-left-chevron"
|
|
125
119
|
}
|
|
@@ -128,38 +122,30 @@ const CapEventCalendar = ({
|
|
|
128
122
|
CapIcon,
|
|
129
123
|
{
|
|
130
124
|
type: "chevron-right",
|
|
131
|
-
className:
|
|
125
|
+
className: "carousel-icon",
|
|
132
126
|
onClick: onClickQuarterRight,
|
|
133
127
|
"data-testid": "event-calander-right-chevron"
|
|
134
128
|
}
|
|
135
129
|
)
|
|
136
130
|
] }),
|
|
137
|
-
/* @__PURE__ */ jsxs(
|
|
138
|
-
/* @__PURE__ */ jsx(
|
|
139
|
-
|
|
131
|
+
/* @__PURE__ */ jsxs("div", { className: "quarter-label", children: [
|
|
132
|
+
/* @__PURE__ */ jsx("span", { children: allQuartersLabel[quarter - 1] }),
|
|
133
|
+
dayjs(carouselDate).year()
|
|
140
134
|
] })
|
|
141
135
|
] }),
|
|
142
|
-
/* @__PURE__ */ jsxs(
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
|
|
146
|
-
justify: "space-between",
|
|
147
|
-
align: "middle",
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ jsx(CapLabelWithStatic, { type: "label15", children: resolvedCalendarGridLineLabel }),
|
|
150
|
-
/* @__PURE__ */ jsx(DayDropdown, { fetchDay: handleDayGridSelection, day: dayGrid, dayLabels })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
)
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "event-calendar__header__right", children: [
|
|
137
|
+
calendarGridLineLabel,
|
|
138
|
+
/* @__PURE__ */ jsx(DayDropdown, { fetchDay: handleDayGridSelection, day: dayGrid, dayLabels })
|
|
139
|
+
] })
|
|
154
140
|
] }),
|
|
155
|
-
emptyState && !formattedEvents.length && /* @__PURE__ */ jsx(CapRow, {
|
|
141
|
+
emptyState && !formattedEvents.length && /* @__PURE__ */ jsx(CapRow, { children: /* @__PURE__ */ jsx(CapIllustration, { ...getIllustrationProps(true) }) }),
|
|
156
142
|
formattedEvents.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
157
143
|
/* @__PURE__ */ jsx(MonthHeader, { displayMonths }),
|
|
158
144
|
/* @__PURE__ */ jsx(
|
|
159
145
|
CalendarCanvas,
|
|
160
146
|
{
|
|
161
147
|
...{
|
|
162
|
-
todayTooltipProps
|
|
148
|
+
todayTooltipProps,
|
|
163
149
|
formattedEvents,
|
|
164
150
|
dayGrid,
|
|
165
151
|
displayMonths,
|
|
@@ -179,7 +165,46 @@ const CapEventCalendar = ({
|
|
|
179
165
|
] })
|
|
180
166
|
] });
|
|
181
167
|
};
|
|
182
|
-
|
|
168
|
+
CapEventCalendar.propTypes = {
|
|
169
|
+
calendarDate: PropTypes.string,
|
|
170
|
+
events: PropTypes.array,
|
|
171
|
+
popoverContent: PropTypes.any,
|
|
172
|
+
onQuarterChange: PropTypes.func,
|
|
173
|
+
selectedQuarter: PropTypes.string,
|
|
174
|
+
calendarGridLineLabel: PropTypes.string,
|
|
175
|
+
dayLabels: PropTypes.array,
|
|
176
|
+
allQuartersLabel: PropTypes.array,
|
|
177
|
+
monthLabels: PropTypes.array,
|
|
178
|
+
todayTooltipProps: PropTypes.object,
|
|
179
|
+
dashLineOffsetY: PropTypes.number,
|
|
180
|
+
eventHeight: PropTypes.number,
|
|
181
|
+
eventRowGap: PropTypes.number,
|
|
182
|
+
textPadding: PropTypes.number,
|
|
183
|
+
eventStartYOffset: PropTypes.number,
|
|
184
|
+
minCanvasHeight: PropTypes.number,
|
|
185
|
+
canvasFont: PropTypes.string,
|
|
186
|
+
popoverPlacement: PropTypes.string
|
|
187
|
+
};
|
|
188
|
+
CapEventCalendar.defaultProps = {
|
|
189
|
+
popoverContent: DefaultPopover,
|
|
190
|
+
dashLineOffsetY: 20,
|
|
191
|
+
eventHeight: 24,
|
|
192
|
+
eventRowGap: 12,
|
|
193
|
+
textPadding: 12,
|
|
194
|
+
eventStartYOffset: 40,
|
|
195
|
+
minCanvasHeight: 0,
|
|
196
|
+
todayTooltipProps: { title: "Today" },
|
|
197
|
+
allQuartersLabel: QUARTER_LABELS,
|
|
198
|
+
dayLabels: DAY_LABELS,
|
|
199
|
+
monthLabels: MONTH_LABELS,
|
|
200
|
+
canvasFont: `normal ${FONT_SIZE_S} ${FONT_FAMILY}`,
|
|
201
|
+
calendarGridLineLabel: "Calendar Grid Line",
|
|
202
|
+
popoverPlacement: "leftTop",
|
|
203
|
+
emptyStateTitle: "You have no events for this quarter",
|
|
204
|
+
emptyStateDescription: "Please create an event to view it here",
|
|
205
|
+
emptyStateButtonLabel: "Create Event",
|
|
206
|
+
isButtonDisabled: false
|
|
207
|
+
};
|
|
183
208
|
export {
|
|
184
|
-
|
|
209
|
+
CapEventCalendar as default
|
|
185
210
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/* Transition */
|
|
8
8
|
/* Timezones Footer */
|
|
9
9
|
.event-calendar {
|
|
10
|
-
height:
|
|
10
|
+
height: 700px;
|
|
11
11
|
}
|
|
12
12
|
.event-calendar__header {
|
|
13
13
|
display: flex;
|
|
@@ -19,22 +19,94 @@
|
|
|
19
19
|
padding-top: 0.571rem;
|
|
20
20
|
}
|
|
21
21
|
.event-calendar__header__left .quarter-label {
|
|
22
|
-
width:
|
|
22
|
+
width: 152px;
|
|
23
23
|
height: 1.428rem;
|
|
24
|
-
margin:
|
|
25
|
-
gap: 0.857rem;
|
|
26
|
-
}
|
|
27
|
-
.event-calendar__header__left .quarter-label__text {
|
|
24
|
+
margin: 2px 0 2px 0.571rem;
|
|
28
25
|
font-size: 1.143rem;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
font-stretch: normal;
|
|
28
|
+
font-style: normal;
|
|
29
|
+
line-height: 1.25;
|
|
30
|
+
letter-spacing: normal;
|
|
31
|
+
color: #091e42;
|
|
32
|
+
}
|
|
33
|
+
.event-calendar__header__left .quarter-label span {
|
|
34
|
+
margin-right: 10px;
|
|
29
35
|
}
|
|
30
36
|
.event-calendar__header__left .disable-left {
|
|
31
|
-
color:
|
|
37
|
+
color: grey;
|
|
32
38
|
cursor: not-allowed;
|
|
33
39
|
pointer-events: none;
|
|
34
40
|
}
|
|
35
41
|
.event-calendar__header__left .carousel-icon {
|
|
36
42
|
cursor: pointer;
|
|
37
43
|
}
|
|
38
|
-
.event-calendar__header__right {
|
|
39
|
-
|
|
44
|
+
.event-calendar__header__right .grid-label {
|
|
45
|
+
width: 111px;
|
|
46
|
+
height: 1.428rem;
|
|
47
|
+
margin: 9px 0.571rem 11px 0;
|
|
48
|
+
font-size: 1rem;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
font-stretch: normal;
|
|
51
|
+
font-style: normal;
|
|
52
|
+
line-height: 1.43;
|
|
53
|
+
letter-spacing: normal;
|
|
54
|
+
color: #091e42;
|
|
55
|
+
}
|
|
56
|
+
.event-calendar__header .ant-btn-flat {
|
|
57
|
+
width: 140px !important;
|
|
58
|
+
height: 2.857rem !important;
|
|
59
|
+
margin: 0 0 0 0.571rem !important;
|
|
60
|
+
padding: 0.571rem !important;
|
|
61
|
+
border-radius: 0.285rem !important;
|
|
62
|
+
border: solid 1px #b3bac5 !important;
|
|
63
|
+
color: #091e42;
|
|
64
|
+
font-weight: normal;
|
|
65
|
+
}
|
|
66
|
+
.event-calendar__header .ant-btn-flat .cap-button-v2-suffix {
|
|
67
|
+
position: absolute;
|
|
68
|
+
right: 0.571rem;
|
|
69
|
+
}
|
|
70
|
+
.event-calendar__header .flat-btn:hover {
|
|
71
|
+
background-color: #ffffff !important;
|
|
72
|
+
}
|
|
73
|
+
.event-calendar__month-header {
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
position: relative;
|
|
77
|
+
text-align: center;
|
|
78
|
+
top: 0;
|
|
79
|
+
margin-bottom: 10px;
|
|
80
|
+
margin-top: 25px;
|
|
81
|
+
}
|
|
82
|
+
.event-calendar__month-header__label {
|
|
83
|
+
width: 33.33%;
|
|
84
|
+
height: 1.428rem;
|
|
85
|
+
text-align: center;
|
|
86
|
+
color: #091e42;
|
|
87
|
+
font-size: 1rem;
|
|
88
|
+
font-weight: 500;
|
|
89
|
+
font-stretch: normal;
|
|
90
|
+
font-style: normal;
|
|
91
|
+
line-height: 1.43;
|
|
92
|
+
letter-spacing: normal;
|
|
93
|
+
}
|
|
94
|
+
.ant-dropdown-placement-bottomCenter .ant-dropdown-menu-item {
|
|
95
|
+
height: 2.857rem !important;
|
|
96
|
+
padding: 9px 0.571rem 11px 1.142rem !important;
|
|
97
|
+
background-color: #ffffff !important;
|
|
98
|
+
color: #091e42 !important;
|
|
99
|
+
font-size: 1rem;
|
|
100
|
+
}
|
|
101
|
+
.ant-dropdown-placement-bottomCenter .ant-dropdown-menu-item:hover {
|
|
102
|
+
background-color: #fefcf0 !important;
|
|
103
|
+
}
|
|
104
|
+
.ant-dropdown-placement-bottomCenter .ant-dropdown-menu-item-selected {
|
|
105
|
+
background-color: #e9f0fe !important;
|
|
106
|
+
border-left: 1px solid #2466ea !important;
|
|
107
|
+
color: #091e42 !important;
|
|
108
|
+
}
|
|
109
|
+
.ant-dropdown-placement-bottomCenter .ant-dropdown-menu-vertical {
|
|
110
|
+
width: 140px !important;
|
|
111
|
+
margin-left: 35px !important;
|
|
40
112
|
}
|
|
@@ -1,41 +1,114 @@
|
|
|
1
|
-
@import '../styles/_variables.scss';
|
|
2
1
|
|
|
3
|
-
.
|
|
4
|
-
height: 50rem;
|
|
2
|
+
@import "../styles/_variables.scss";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
.event-calendar{
|
|
5
|
+
height: 700px;
|
|
6
|
+
&__header{
|
|
7
|
+
display: flex;
|
|
8
|
+
position: relative;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
&__left{
|
|
11
|
+
display: flex;
|
|
12
|
+
padding-top: $CAP_SPACE_08;
|
|
13
|
+
.quarter-label{
|
|
14
|
+
width: 152px;
|
|
15
|
+
height: $CAP_SPACE_20;
|
|
16
|
+
margin: 2px 0 2px $CAP_SPACE_08;
|
|
17
|
+
font-size: $FONT_SIZE_L;
|
|
18
|
+
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
19
|
+
font-stretch: normal;
|
|
20
|
+
font-style: normal;
|
|
21
|
+
line-height: 1.25;
|
|
22
|
+
letter-spacing: normal;
|
|
23
|
+
color: $FONT_COLOR_01;
|
|
24
|
+
span{
|
|
25
|
+
margin-right: 10px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.disable-left{
|
|
29
|
+
color:grey;
|
|
30
|
+
cursor: not-allowed;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
.carousel-icon{
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
&__right{
|
|
38
|
+
.grid-label{
|
|
39
|
+
width: 111px;
|
|
40
|
+
height: $CAP_SPACE_20;
|
|
41
|
+
margin: 9px $CAP_SPACE_08 11px 0;
|
|
42
|
+
font-size: $FONT_SIZE_M;
|
|
43
|
+
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
44
|
+
font-stretch: normal;
|
|
45
|
+
font-style: normal;
|
|
46
|
+
line-height: 1.43;
|
|
47
|
+
letter-spacing: normal;
|
|
48
|
+
color: $FONT_COLOR_01;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.ant-btn-flat{
|
|
52
|
+
width: 140px !important;
|
|
53
|
+
height: $CAP_SPACE_40 !important;
|
|
54
|
+
margin: 0 0 0 $CAP_SPACE_08 !important;
|
|
55
|
+
padding: $CAP_SPACE_08 !important;
|
|
56
|
+
border-radius: $CAP_SPACE_04 !important;
|
|
57
|
+
border: solid 1px $CAP_G06 !important;
|
|
58
|
+
color: $FONT_COLOR_01;
|
|
59
|
+
font-weight: normal;
|
|
60
|
+
.cap-button-v2-suffix{
|
|
61
|
+
position: absolute;
|
|
62
|
+
right: $CAP_SPACE_08;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
.flat-btn:hover{
|
|
66
|
+
background-color: $CAP_WHITE!important;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
&__month-header{
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
position: relative;
|
|
73
|
+
text-align: center;
|
|
74
|
+
top: 0;
|
|
75
|
+
margin-bottom: 10px;
|
|
76
|
+
margin-top: 25px;
|
|
77
|
+
&__label{
|
|
78
|
+
width: 33.33%;
|
|
79
|
+
height: $CAP_SPACE_20;
|
|
80
|
+
text-align: center;
|
|
81
|
+
color: $FONT_COLOR_01;
|
|
82
|
+
font-size:$FONT_SIZE_M ;
|
|
83
|
+
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
84
|
+
font-stretch: normal;
|
|
85
|
+
font-style: normal;
|
|
86
|
+
line-height: 1.43;
|
|
87
|
+
letter-spacing: normal;
|
|
23
88
|
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.disable-left {
|
|
27
|
-
color: $FONT_COLOR_03 !important;
|
|
28
|
-
cursor: not-allowed;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.carousel-icon {
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
89
|
}
|
|
90
|
+
}
|
|
36
91
|
|
|
37
|
-
|
|
38
|
-
|
|
92
|
+
.ant-dropdown-placement-bottomCenter{
|
|
93
|
+
.ant-dropdown-menu-item{
|
|
94
|
+
height: $CAP_SPACE_40 !important;
|
|
95
|
+
padding: 9px $CAP_SPACE_08 11px $CAP_SPACE_16 !important;
|
|
96
|
+
background-color: $CAP_WHITE !important;
|
|
97
|
+
color: $FONT_COLOR_01 !important;
|
|
98
|
+
font-size: $FONT_SIZE_M;
|
|
99
|
+
}
|
|
100
|
+
.ant-dropdown-menu-item:hover{
|
|
101
|
+
background-color: $BG_02 !important;
|
|
102
|
+
}
|
|
103
|
+
.ant-dropdown-menu-item-selected{
|
|
104
|
+
background-color: $CAP_PALE_GREY !important;
|
|
105
|
+
border-left: 1px solid $FONT_COLOR_05 !important;
|
|
106
|
+
color: $FONT_COLOR_01 !important;
|
|
107
|
+
}
|
|
108
|
+
.ant-dropdown-menu-vertical{
|
|
109
|
+
width: 140px !important;
|
|
110
|
+
margin-left: 35px !important;
|
|
39
111
|
}
|
|
40
|
-
}
|
|
41
112
|
}
|
|
113
|
+
|
|
114
|
+
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const getQuarterForDate: (date: string | Dayjs) => number;
|
|
4
|
-
export declare const splitMonthsArrayToQuarterChunks: (monthLabels?: string[]) => string[][];
|
|
1
|
+
export declare const getQuarterForDate: (date: any) => number;
|
|
2
|
+
export declare const splitMonthsArrayToQuarterChunks: (monthLabels?: string[]) => any[];
|
|
5
3
|
/**
|
|
6
4
|
* The start and end of the months is calculated along with other information needed for month
|
|
7
5
|
* This is being used for drawing the canvas via the displayMonths state value in CapEventCalendar
|
|
@@ -9,13 +7,13 @@ export declare const splitMonthsArrayToQuarterChunks: (monthLabels?: string[]) =
|
|
|
9
7
|
* @param {*} monthNames this is for localization of month strings when displaying the month names in the header
|
|
10
8
|
* @returns
|
|
11
9
|
*/
|
|
12
|
-
export declare const getMonthsForQuarter: (quarter:
|
|
10
|
+
export declare const getMonthsForQuarter: (quarter: any, monthNames: any) => any[];
|
|
13
11
|
/**
|
|
14
12
|
* To display the dates in the header and caculate the rectangles to be drawn in the canvas
|
|
15
13
|
* @param {*} date
|
|
16
14
|
* @returns
|
|
17
15
|
*/
|
|
18
|
-
export declare const getDaysOfMonth: (date:
|
|
16
|
+
export declare const getDaysOfMonth: (date: any) => string[];
|
|
19
17
|
/**
|
|
20
18
|
* Checks if the date lies between start and end or
|
|
21
19
|
* if it is same as start date or end date
|
|
@@ -26,7 +24,7 @@ export declare const getDaysOfMonth: (date: string | Dayjs) => string[];
|
|
|
26
24
|
* @param {*} end
|
|
27
25
|
* @returns
|
|
28
26
|
*/
|
|
29
|
-
export declare const checkIfDateIsInRange: (date:
|
|
27
|
+
export declare const checkIfDateIsInRange: (date: any, start: any, end: any) => boolean;
|
|
30
28
|
/**
|
|
31
29
|
* This is to check if the given event spans a longer duration( quarter long or spans multiple quarter)
|
|
32
30
|
* So as to create a new array for such events
|
|
@@ -34,7 +32,7 @@ export declare const checkIfDateIsInRange: (date: string | Dayjs, start: string
|
|
|
34
32
|
* @param {*} newEvent
|
|
35
33
|
* @returns
|
|
36
34
|
*/
|
|
37
|
-
export declare const isEventLong: (eventInRow:
|
|
35
|
+
export declare const isEventLong: (eventInRow: any, newEvent: any) => boolean;
|
|
38
36
|
/**
|
|
39
37
|
* In order to decide if events are to be displayed in new row, we follow rules
|
|
40
38
|
* 1- event start and end dates should not be in-between/same of any existing event in the row
|
|
@@ -43,8 +41,8 @@ export declare const isEventLong: (eventInRow: CapEventCalendarEvent | Formatted
|
|
|
43
41
|
* @param {Number} chosenQuarter
|
|
44
42
|
* @returns
|
|
45
43
|
*/
|
|
46
|
-
export declare const formatDataToSuitCanvas: (events:
|
|
47
|
-
export declare const getFirstDateOfQuarter: (quarter:
|
|
44
|
+
export declare const formatDataToSuitCanvas: (events: any) => any[];
|
|
45
|
+
export declare const getFirstDateOfQuarter: (quarter: any, year: any) => string;
|
|
48
46
|
/**
|
|
49
47
|
* Check if the year needs to be incremented/decremented based on the following rules
|
|
50
48
|
* For decrement:
|
|
@@ -61,5 +59,5 @@ export declare const getFirstDateOfQuarter: (quarter: number, year: number) => s
|
|
|
61
59
|
* @param {String} referenceDate
|
|
62
60
|
* @returns
|
|
63
61
|
*/
|
|
64
|
-
export declare const handleYearChange: (quarter:
|
|
62
|
+
export declare const handleYearChange: (quarter: any, date: any, increment: any, referenceDate: any) => false | any[];
|
|
65
63
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../components/CapEventCalendar/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../components/CapEventCalendar/utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,GAAI,SAAI,WAA0B,CAAC;AAEjE,eAAO,MAAM,+BAA+B,GAAI,sBAA0B,UAQzE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAO,EAAE,eAAU,UAwCtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,SAAI,aAalC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAI,EAAE,UAAK,EAAE,QAAG,YAUpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,eAAU,EAAE,aAAQ,YAQ/C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,WAAM,UA+C5C,CAAC;AASF,eAAO,MAAM,qBAAqB,GAAI,YAAO,EAAE,SAAI,WACwC,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAO,EAAE,SAAI,EAAE,cAAS,EAAE,kBAAa,kBA2BvE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forEach, some } from "lodash";
|
|
2
|
-
import {
|
|
2
|
+
import { momentToDayjs, TIME_UNITS } from "../utils/dayjs.js";
|
|
3
3
|
import { MONTH_LABELS, DATE_STRING_FORMAT } from "./constants.js";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
const getQuarterForDate = (date) => dayjs(date).quarter();
|
|
@@ -50,16 +50,13 @@ const getMonthsForQuarter = (quarter, monthNames) => {
|
|
|
50
50
|
const getDaysOfMonth = (date) => {
|
|
51
51
|
const month = dayjs(date).month();
|
|
52
52
|
const year = dayjs(date).year();
|
|
53
|
-
const monthDate = dayjs(
|
|
54
|
-
`${year}-${String(month + 1).padStart(2, "0")}`,
|
|
55
|
-
FORMAT_TOKENS.YEAR_MONTH
|
|
56
|
-
);
|
|
53
|
+
const monthDate = dayjs(`${year}-${month + 1}`, "YYYY-MM");
|
|
57
54
|
const daysInMonth = monthDate.daysInMonth();
|
|
58
55
|
const arrDays = [monthDate.format()];
|
|
59
56
|
let current = monthDate.format();
|
|
60
57
|
for (let i = 1; i < daysInMonth; ) {
|
|
61
|
-
current = dayjs(current).add(1, TIME_UNITS.DAY)
|
|
62
|
-
arrDays.push(current);
|
|
58
|
+
current = dayjs(current).add(1, TIME_UNITS.DAY);
|
|
59
|
+
arrDays.push(current.format());
|
|
63
60
|
i++;
|
|
64
61
|
}
|
|
65
62
|
return arrDays;
|
|
@@ -130,8 +127,8 @@ const startMonthOfQuarter = {
|
|
|
130
127
|
const getFirstDateOfQuarter = (quarter, year) => dayjs().year(year).month(startMonthOfQuarter[quarter]).startOf(TIME_UNITS.MONTH).format();
|
|
131
128
|
const handleYearChange = (quarter, date, increment, referenceDate) => {
|
|
132
129
|
const year = dayjs(date).year();
|
|
133
|
-
const refYear = referenceDate
|
|
134
|
-
if (referenceDate
|
|
130
|
+
const refYear = referenceDate && dayjs(referenceDate).year();
|
|
131
|
+
if (referenceDate) {
|
|
135
132
|
if (year === refYear - 1 && quarter === 1) return false;
|
|
136
133
|
if (quarter === 1 && !increment) {
|
|
137
134
|
const updatedDate2 = dayjs().year(year - 1).month(11);
|
|
@@ -147,7 +144,7 @@ const handleYearChange = (quarter, date, increment, referenceDate) => {
|
|
|
147
144
|
return [
|
|
148
145
|
_quarter,
|
|
149
146
|
updatedDate.startOf(TIME_UNITS.MONTH).format(),
|
|
150
|
-
quarter === 2 &&
|
|
147
|
+
quarter === 2 && year === refYear - 1
|
|
151
148
|
];
|
|
152
149
|
};
|
|
153
150
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapSelectFilter/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAM7E,eAAO,MAAM,cAAc,GAAI,OAAO,uBAAuB,EAAE,EAAE,gBAAgB,MAAM;;;;;GAStF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,KAAK,CAAC,SAAS,EACrB,oBAAoB,MAAM,EAC1B,gBAAgB,MAAM,4CAcvB,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapSelectFilter/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAM7E,eAAO,MAAM,cAAc,GAAI,OAAO,uBAAuB,EAAE,EAAE,gBAAgB,MAAM;;;;;GAStF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,KAAK,CAAC,SAAS,EACrB,oBAAoB,MAAM,EAC1B,gBAAgB,MAAM,4CAcvB,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAyDnD,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,YAAY,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC"}
|