@quillsql/react 2.8.6 → 2.8.8
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/AddToDashboardModal.js +181 -146
- package/dist/BarList.js +44 -36
- package/dist/Chart.js +132 -99
- package/dist/ChartBuilder.js +89 -80
- package/dist/ChartEditor.js +21 -14
- package/dist/Context.js +57 -52
- package/dist/Dashboard.js +213 -180
- package/dist/Dashboard.js.map +1 -1
- package/dist/DateRangePicker/Calendar.js +46 -41
- package/dist/DateRangePicker/DateRangePicker.js +61 -32
- package/dist/DateRangePicker/DateRangePickerButton.js +17 -14
- package/dist/DateRangePicker/dateRangePickerUtils.js +90 -76
- package/dist/DateRangePicker/dateRangePickerUtils.js.map +1 -1
- package/dist/DateRangePicker/index.js +9 -1
- package/dist/PieChart.js +70 -35
- package/dist/QuillProvider.js +7 -4
- package/dist/ReportBuilder.js +129 -120
- package/dist/SQLEditor.js +65 -56
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +71 -60
- package/dist/Table.js.map +1 -1
- package/dist/TableChart.js +45 -17
- package/dist/assets/ArrowDownHeadIcon.js +6 -3
- package/dist/assets/ArrowDownIcon.js +6 -3
- package/dist/assets/ArrowDownRightIcon.js +6 -3
- package/dist/assets/ArrowLeftHeadIcon.js +6 -3
- package/dist/assets/ArrowRightHeadIcon.js +6 -3
- package/dist/assets/ArrowRightIcon.js +6 -3
- package/dist/assets/ArrowUpHeadIcon.js +6 -3
- package/dist/assets/ArrowUpIcon.js +6 -3
- package/dist/assets/ArrowUpRightIcon.js +6 -3
- package/dist/assets/CalendarIcon.js +6 -3
- package/dist/assets/CalendarNormalIcon.js +6 -3
- package/dist/assets/DoubleArrowLeftHeadIcon.js +6 -3
- package/dist/assets/DoubleArrowRightHeadIcon.js +6 -3
- package/dist/assets/ExclamationFilledIcon.js +6 -3
- package/dist/assets/FilterIcon.js +6 -3
- package/dist/assets/LoadingSpinner.js +6 -3
- package/dist/assets/RefreshIcon.js +6 -3
- package/dist/assets/SearchIcon.js +6 -3
- package/dist/assets/UpLeftArrowsIcon.js +6 -3
- package/dist/assets/XCircleIcon.js +6 -3
- package/dist/assets/XIcon.js +6 -3
- package/dist/assets/index.js +49 -21
- package/dist/components/BigModal/BigModal.js +39 -13
- package/dist/components/Dropdown/Dropdown.js +53 -24
- package/dist/components/Dropdown/DropdownItem.js +35 -9
- package/dist/components/Dropdown/index.js +11 -2
- package/dist/components/Modal/Modal.js +39 -13
- package/dist/components/Modal/index.js +9 -1
- package/dist/components/QuillCard.js +13 -8
- package/dist/components/SqlTextEditor.js +11 -4
- package/dist/components/SqlTextEditor.js.map +1 -0
- package/dist/components/UiComponents.js +51 -37
- package/dist/components/selectUtils.js +17 -6
- package/dist/contexts/BaseColorContext.js +6 -3
- package/dist/contexts/HoveredValueContext.js +6 -3
- package/dist/contexts/RootStylesContext.js +6 -3
- package/dist/contexts/SelectedValueContext.js +6 -3
- package/dist/contexts/index.js +15 -4
- package/dist/hooks/index.js +15 -4
- package/dist/hooks/useDashboard.js +17 -11
- package/dist/hooks/useDashboard.js.map +1 -0
- package/dist/hooks/useInternalState.js +6 -3
- package/dist/hooks/useOnClickOutside.js +6 -3
- package/dist/hooks/useOnWindowResize.js +7 -4
- package/dist/hooks/useQuill.js +16 -11
- package/dist/hooks/useSelectOnKeyDown.js +7 -4
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/dist/internals/ReportBuilder/PivotList.js +20 -14
- package/dist/internals/ReportBuilder/PivotModal.js +92 -84
- package/dist/internals/ReportBuilder/PivotModal.spec.js +73 -70
- package/dist/lib/font.js +6 -2
- package/dist/lib/index.js +20 -3
- package/dist/lib/inputTypes.js +3 -1
- package/dist/lib/utils.js +19 -8
- package/dist/utils/aggregate.js +35 -28
- package/dist/utils/colorToHex.js +5 -1
- package/dist/utils/dataFetcher.js +8 -2
- package/dist/utils/downloadCSV.js +6 -1
- package/package.json +2 -1
package/dist/Dashboard.js
CHANGED
|
@@ -1,19 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.QuillDateRangePicker = exports.DashboardFilter = exports.COMPARISON_OPTIONS = void 0;
|
|
30
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
31
|
// @ts-nocheck
|
|
3
32
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
33
|
+
const react_1 = __importStar(require("react"));
|
|
34
|
+
const Chart_1 = __importDefault(require("./Chart"));
|
|
35
|
+
const dateRangePickerUtils_1 = require("./DateRangePicker/dateRangePickerUtils");
|
|
36
|
+
const Context_1 = require("./Context");
|
|
37
|
+
const date_fns_1 = require("date-fns");
|
|
38
|
+
const Modal_1 = __importDefault(require("./components/Modal/Modal"));
|
|
39
|
+
const contexts_1 = require("./contexts");
|
|
40
|
+
const Dropdown_1 = require("./components/Dropdown");
|
|
41
|
+
const assets_1 = require("./assets");
|
|
42
|
+
const hooks_1 = require("./hooks");
|
|
43
|
+
const locale_1 = require("date-fns/locale");
|
|
44
|
+
const useDashboard_1 = require("./hooks/useDashboard");
|
|
45
|
+
exports.COMPARISON_OPTIONS = [
|
|
17
46
|
{
|
|
18
47
|
value: 'PREV_PERIOD',
|
|
19
48
|
text: 'Previous Period',
|
|
@@ -35,10 +64,10 @@ export const COMPARISON_OPTIONS = [
|
|
|
35
64
|
text: 'No comparison',
|
|
36
65
|
},
|
|
37
66
|
];
|
|
38
|
-
|
|
39
|
-
const [comparisonValue, setComparisonValue] = useState('');
|
|
40
|
-
const [filterValue, setFilterValue] = useState(null);
|
|
41
|
-
useEffect(() => {
|
|
67
|
+
function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateRangePickerComponent, theme, }) {
|
|
68
|
+
const [comparisonValue, setComparisonValue] = (0, react_1.useState)('');
|
|
69
|
+
const [filterValue, setFilterValue] = (0, react_1.useState)(null);
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
42
71
|
if (filter.filterType === 'date_range' &&
|
|
43
72
|
!filter.selectedValue &&
|
|
44
73
|
!filterValue) {
|
|
@@ -51,13 +80,13 @@ export function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateR
|
|
|
51
80
|
setFilterValue(filter.selectedValue);
|
|
52
81
|
}
|
|
53
82
|
if (filter.comparison) {
|
|
54
|
-
setComparisonValue(COMPARISON_OPTIONS.find((option) => {
|
|
83
|
+
setComparisonValue(exports.COMPARISON_OPTIONS.find((option) => {
|
|
55
84
|
return option.value === filter.comparisonRange.value;
|
|
56
85
|
}).value);
|
|
57
86
|
}
|
|
58
87
|
}, [filter]);
|
|
59
88
|
if (filter.filterType === 'string') {
|
|
60
|
-
return (
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(SelectComponent, { label: filter.label, value: filterValue, onChange: (e) => {
|
|
61
90
|
onChangeFilter(filter, e);
|
|
62
91
|
}, options: [
|
|
63
92
|
...filter.options.map((elem) => {
|
|
@@ -69,11 +98,11 @@ export function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateR
|
|
|
69
98
|
] }));
|
|
70
99
|
}
|
|
71
100
|
if (filter.filterType == 'date_range') {
|
|
72
|
-
return (
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
73
102
|
display: 'flex',
|
|
74
103
|
flexDirection: 'row',
|
|
75
104
|
alignItems: 'flex-end',
|
|
76
|
-
}, children: [
|
|
105
|
+
}, children: [(0, jsx_runtime_1.jsx)(DateRangePickerComponent, { dateRange: filterValue ? [filterValue[0], filterValue[1]] : [null, null], label: filter.label,
|
|
77
106
|
// value={filterValue}
|
|
78
107
|
onChangeDateRange: (dateRange) => {
|
|
79
108
|
onChangeFilter(filter, [dateRange[0], dateRange[1], null]);
|
|
@@ -82,7 +111,7 @@ export function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateR
|
|
|
82
111
|
? filterValue[2]
|
|
83
112
|
: '', onChangePreset: (preset) => {
|
|
84
113
|
if (typeof preset === 'string') {
|
|
85
|
-
const fullPreset = getRangeFromPreset(preset);
|
|
114
|
+
const fullPreset = (0, dateRangePickerUtils_1.getRangeFromPreset)(preset);
|
|
86
115
|
onChangeFilter(filter, fullPreset);
|
|
87
116
|
setFilterValue(fullPreset);
|
|
88
117
|
return;
|
|
@@ -97,19 +126,19 @@ export function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateR
|
|
|
97
126
|
new Date(),
|
|
98
127
|
preset?.value || '',
|
|
99
128
|
]);
|
|
100
|
-
}, presetOptions: defaultOptions }), filter.comparison && (
|
|
129
|
+
}, presetOptions: dateRangePickerUtils_1.defaultOptions }), filter.comparison && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
101
130
|
display: 'flex',
|
|
102
131
|
flexDirection: 'row',
|
|
103
132
|
alignItems: 'center',
|
|
104
|
-
}, children: [
|
|
133
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
105
134
|
paddingLeft: 16,
|
|
106
135
|
paddingRight: 12,
|
|
107
136
|
color: theme.secondaryTextColor,
|
|
108
|
-
}, children: "compared to" }),
|
|
109
|
-
onChangeFilter(filter, null, COMPARISON_OPTIONS.find((option) => {
|
|
137
|
+
}, children: "compared to" }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: comparisonValue, onChange: (e) => {
|
|
138
|
+
onChangeFilter(filter, null, exports.COMPARISON_OPTIONS.find((option) => {
|
|
110
139
|
return option.value === e;
|
|
111
140
|
}));
|
|
112
|
-
}, options: COMPARISON_OPTIONS.map((compareOption) => {
|
|
141
|
+
}, options: exports.COMPARISON_OPTIONS.map((compareOption) => {
|
|
113
142
|
return {
|
|
114
143
|
value: compareOption.value,
|
|
115
144
|
label: compareOption.text,
|
|
@@ -118,44 +147,45 @@ export function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateR
|
|
|
118
147
|
}
|
|
119
148
|
return null;
|
|
120
149
|
}
|
|
150
|
+
exports.DashboardFilter = DashboardFilter;
|
|
121
151
|
const options = [
|
|
122
152
|
{
|
|
123
|
-
date_range: [startOfWeek(startOfToday()), startOfToday(), 'wk'],
|
|
153
|
+
date_range: [(0, date_fns_1.startOfWeek)((0, date_fns_1.startOfToday)()), (0, date_fns_1.startOfToday)(), 'wk'],
|
|
124
154
|
},
|
|
125
155
|
{
|
|
126
|
-
date_range: [sub(startOfToday(), { days: 90 }), startOfToday(), '90d'],
|
|
156
|
+
date_range: [(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }), (0, date_fns_1.startOfToday)(), '90d'],
|
|
127
157
|
},
|
|
128
158
|
{
|
|
129
|
-
date_range: [sub(startOfToday(), { days: 30 }), startOfToday(), 't'],
|
|
159
|
+
date_range: [(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }), (0, date_fns_1.startOfToday)(), 't'],
|
|
130
160
|
},
|
|
131
161
|
{
|
|
132
|
-
date_range: [sub(startOfToday(), { years: 100 }), startOfToday(), 'at'],
|
|
162
|
+
date_range: [(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { years: 100 }), (0, date_fns_1.startOfToday)(), 'at'],
|
|
133
163
|
},
|
|
134
164
|
{
|
|
135
|
-
date_range: [startOfYear(startOfToday()), startOfToday(), 'y'],
|
|
165
|
+
date_range: [(0, date_fns_1.startOfYear)((0, date_fns_1.startOfToday)()), (0, date_fns_1.startOfToday)(), 'y'],
|
|
136
166
|
},
|
|
137
167
|
{
|
|
138
|
-
date_range: [startOfMonth(startOfToday()), startOfToday(), 'm'],
|
|
168
|
+
date_range: [(0, date_fns_1.startOfMonth)((0, date_fns_1.startOfToday)()), (0, date_fns_1.startOfToday)(), 'm'],
|
|
139
169
|
},
|
|
140
170
|
{
|
|
141
|
-
date_range: [sub(startOfToday(), { days: 7 }), startOfToday(), 'w'],
|
|
171
|
+
date_range: [(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 7 }), (0, date_fns_1.startOfToday)(), 'w'],
|
|
142
172
|
},
|
|
143
173
|
{
|
|
144
|
-
date_range: [sub(startOfToday(), { months: 6 }), startOfToday(), '6m'],
|
|
174
|
+
date_range: [(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { months: 6 }), (0, date_fns_1.startOfToday)(), '6m'],
|
|
145
175
|
},
|
|
146
176
|
];
|
|
147
177
|
const QuillDropdownComponent = ({ onChange, value, label, options, }) => {
|
|
148
|
-
const [theme] = useContext(ThemeContext);
|
|
149
|
-
const handleOnChange = useCallback((event) => {
|
|
178
|
+
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
179
|
+
const handleOnChange = (0, react_1.useCallback)((event) => {
|
|
150
180
|
onChange(event.target.value);
|
|
151
181
|
}, [onChange]);
|
|
152
|
-
return (
|
|
182
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [label && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
153
183
|
marginBottom: 6,
|
|
154
184
|
fontWeight: theme.labelFontWeight || '600',
|
|
155
185
|
color: theme.secondaryTextColor,
|
|
156
186
|
fontFamily: theme.fontFamily,
|
|
157
187
|
fontSize: 14,
|
|
158
|
-
}, children: label })),
|
|
188
|
+
}, children: label })), (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', height: 38 }, children: [(0, jsx_runtime_1.jsxs)("select", { onChange: handleOnChange, value: value ?? '', id: 'reportbuilderdropdown',
|
|
159
189
|
// defaultValue="Select"
|
|
160
190
|
style: {
|
|
161
191
|
width: '100%',
|
|
@@ -179,7 +209,7 @@ const QuillDropdownComponent = ({ onChange, value, label, options, }) => {
|
|
|
179
209
|
fontSize: 14,
|
|
180
210
|
fontWeight: 500,
|
|
181
211
|
boxSizing: 'border-box',
|
|
182
|
-
}, children: [
|
|
212
|
+
}, children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: "Select" }), options.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.value, children: option.label }, option.label + index)))] }), (0, jsx_runtime_1.jsx)(assets_1.ArrowDownHeadIcon, { style: {
|
|
183
213
|
height: '20px',
|
|
184
214
|
width: '20px',
|
|
185
215
|
flex: 'none',
|
|
@@ -190,27 +220,27 @@ const QuillDropdownComponent = ({ onChange, value, label, options, }) => {
|
|
|
190
220
|
}, "aria-hidden": "true" })] })] }));
|
|
191
221
|
};
|
|
192
222
|
const isBetween = (date, startDate, endDate) => {
|
|
193
|
-
return isAfter(date, startDate) && isBefore(date, endDate);
|
|
223
|
+
return (0, date_fns_1.isAfter)(date, startDate) && (0, date_fns_1.isBefore)(date, endDate);
|
|
194
224
|
};
|
|
195
225
|
function Calendar({ anchorDate, selectedDateRange, onClickDate, theme, localStartDate, localEndDate, }) {
|
|
196
|
-
const firstDayOfDisplayedMonth = startOfMonth(anchorDate);
|
|
197
|
-
const lastDayOfDisplayedMonth = endOfMonth(anchorDate);
|
|
198
|
-
const weekdays = getWeekdays(enUS).map((dayName) => capitalize(dayName, enUS));
|
|
199
|
-
const displayedDates = eachDayOfInterval({
|
|
200
|
-
start: isSunday(firstDayOfDisplayedMonth)
|
|
226
|
+
const firstDayOfDisplayedMonth = (0, date_fns_1.startOfMonth)(anchorDate);
|
|
227
|
+
const lastDayOfDisplayedMonth = (0, date_fns_1.endOfMonth)(anchorDate);
|
|
228
|
+
const weekdays = (0, dateRangePickerUtils_1.getWeekdays)(locale_1.enUS).map((dayName) => (0, dateRangePickerUtils_1.capitalize)(dayName, locale_1.enUS));
|
|
229
|
+
const displayedDates = (0, date_fns_1.eachDayOfInterval)({
|
|
230
|
+
start: (0, date_fns_1.isSunday)(firstDayOfDisplayedMonth)
|
|
201
231
|
? firstDayOfDisplayedMonth
|
|
202
|
-
: previousSunday(firstDayOfDisplayedMonth),
|
|
203
|
-
end: isSaturday(lastDayOfDisplayedMonth)
|
|
232
|
+
: (0, date_fns_1.previousSunday)(firstDayOfDisplayedMonth),
|
|
233
|
+
end: (0, date_fns_1.isSaturday)(lastDayOfDisplayedMonth)
|
|
204
234
|
? lastDayOfDisplayedMonth
|
|
205
|
-
: nextSaturday(lastDayOfDisplayedMonth),
|
|
235
|
+
: (0, date_fns_1.nextSaturday)(lastDayOfDisplayedMonth),
|
|
206
236
|
});
|
|
207
|
-
const displayedTitle = capitalize(format(firstDayOfDisplayedMonth, 'MMMM yyyy', { locale: enUS }), enUS);
|
|
208
|
-
return (
|
|
237
|
+
const displayedTitle = (0, dateRangePickerUtils_1.capitalize)((0, date_fns_1.format)(firstDayOfDisplayedMonth, 'MMMM yyyy', { locale: locale_1.enUS }), locale_1.enUS);
|
|
238
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
209
239
|
display: 'flex',
|
|
210
240
|
flexDirection: 'column',
|
|
211
241
|
flex: 1,
|
|
212
242
|
// alignItems: 'center',
|
|
213
|
-
}, children: [
|
|
243
|
+
}, children: [(0, jsx_runtime_1.jsx)("h2", { style: {
|
|
214
244
|
color: theme?.textColor || '#364153',
|
|
215
245
|
fontSize: '13px',
|
|
216
246
|
fontFamily: theme?.fontFamily,
|
|
@@ -224,7 +254,7 @@ function Calendar({ anchorDate, selectedDateRange, onClickDate, theme, localStar
|
|
|
224
254
|
justifyContent: 'center',
|
|
225
255
|
marginBottom: 3,
|
|
226
256
|
marginTop: 6,
|
|
227
|
-
}, children: displayedTitle }),
|
|
257
|
+
}, children: displayedTitle }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
228
258
|
color: theme?.primaryTextColor || '#364153',
|
|
229
259
|
textAlign: 'center',
|
|
230
260
|
fontSize: 12,
|
|
@@ -232,7 +262,7 @@ function Calendar({ anchorDate, selectedDateRange, onClickDate, theme, localStar
|
|
|
232
262
|
display: 'grid',
|
|
233
263
|
gridTemplateColumns: 'repeat(7, minmax(0, 1fr))',
|
|
234
264
|
paddingTop: 6,
|
|
235
|
-
}, children: weekdays.map((dayName) => (
|
|
265
|
+
}, children: weekdays.map((dayName) => ((0, jsx_runtime_1.jsx)("div", { style: { width: '100%', display: 'flex', justifyContent: 'center' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
236
266
|
display: 'flex',
|
|
237
267
|
alignItems: 'center',
|
|
238
268
|
justifyContent: 'center',
|
|
@@ -241,7 +271,7 @@ function Calendar({ anchorDate, selectedDateRange, onClickDate, theme, localStar
|
|
|
241
271
|
fontFamily: theme?.fontFamily,
|
|
242
272
|
color: theme.secondaryTextColor,
|
|
243
273
|
paddingBottom: 4,
|
|
244
|
-
}, children: dayName }) }, dayName))) }),
|
|
274
|
+
}, children: dayName }) }, dayName))) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
245
275
|
display: 'grid',
|
|
246
276
|
gridTemplateColumns: 'repeat(7, minmax(0, 1fr))',
|
|
247
277
|
borderRadius: 3,
|
|
@@ -256,7 +286,7 @@ function Calendar({ anchorDate, selectedDateRange, onClickDate, theme, localStar
|
|
|
256
286
|
// lastDayOfDisplayedMonth
|
|
257
287
|
// );
|
|
258
288
|
// console.log(localStartDate === date, localStartDate, date);
|
|
259
|
-
return (
|
|
289
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)("button", { style: {
|
|
260
290
|
border: 'none',
|
|
261
291
|
height: '34px',
|
|
262
292
|
display: 'flex',
|
|
@@ -265,22 +295,22 @@ function Calendar({ anchorDate, selectedDateRange, onClickDate, theme, localStar
|
|
|
265
295
|
justifyContent: 'center',
|
|
266
296
|
fontFamily: theme?.fontFamily,
|
|
267
297
|
fontSize: 13,
|
|
268
|
-
background: isEqual(localStartDate, date) || isEqual(localEndDate, date)
|
|
298
|
+
background: (0, date_fns_1.isEqual)(localStartDate, date) || (0, date_fns_1.isEqual)(localEndDate, date)
|
|
269
299
|
? theme.primaryTextColor
|
|
270
300
|
: isBetween(date, localStartDate, localEndDate)
|
|
271
301
|
? '#F4F4F5'
|
|
272
302
|
: 'transparent',
|
|
273
|
-
color: isEqual(localStartDate, date) || isEqual(localEndDate, date)
|
|
303
|
+
color: (0, date_fns_1.isEqual)(localStartDate, date) || (0, date_fns_1.isEqual)(localEndDate, date)
|
|
274
304
|
? theme.backgroundColor
|
|
275
305
|
: theme.primaryTextColor,
|
|
276
|
-
borderRadius: isEqual(localStartDate, date) || isEqual(localEndDate, date)
|
|
306
|
+
borderRadius: (0, date_fns_1.isEqual)(localStartDate, date) || (0, date_fns_1.isEqual)(localEndDate, date)
|
|
277
307
|
? 3
|
|
278
308
|
: 0,
|
|
279
309
|
...isBeginningOrEndOfWeek(index),
|
|
280
310
|
}, type: "button", onClick: () => {
|
|
281
311
|
onClickDate(date);
|
|
282
|
-
}, children:
|
|
283
|
-
}) }),
|
|
312
|
+
}, children: (0, jsx_runtime_1.jsx)("time", { dateTime: (0, date_fns_1.format)(date, 'yyyy-MM-dd', { locale: locale_1.enUS }), children: (0, date_fns_1.format)(date, 'd', { locale: locale_1.enUS }) }) }) }, date.toString()));
|
|
313
|
+
}) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 8 } })] }));
|
|
284
314
|
}
|
|
285
315
|
function isBeginningOrEndOfWeek(num) {
|
|
286
316
|
// Check if the number is 0
|
|
@@ -297,48 +327,48 @@ function isBeginningOrEndOfWeek(num) {
|
|
|
297
327
|
}
|
|
298
328
|
const formatDateText = (dateRange, localStartDate, localEndDate) => {
|
|
299
329
|
if (dateRange.length && dateRange[0] && dateRange[1]) {
|
|
300
|
-
return (format(dateRange[0], 'MMM dd, yyyy') +
|
|
330
|
+
return ((0, date_fns_1.format)(dateRange[0], 'MMM dd, yyyy') +
|
|
301
331
|
' - ' +
|
|
302
|
-
format(dateRange[1], 'MMM dd, yyyy'));
|
|
332
|
+
(0, date_fns_1.format)(dateRange[1], 'MMM dd, yyyy'));
|
|
303
333
|
}
|
|
304
334
|
if (localStartDate && localEndDate) {
|
|
305
|
-
return (format(localStartDate, 'MMM dd, yyyy') +
|
|
335
|
+
return ((0, date_fns_1.format)(localStartDate, 'MMM dd, yyyy') +
|
|
306
336
|
' - ' +
|
|
307
|
-
format(localEndDate, 'MMM dd, yyyy'));
|
|
337
|
+
(0, date_fns_1.format)(localEndDate, 'MMM dd, yyyy'));
|
|
308
338
|
}
|
|
309
339
|
return '';
|
|
310
340
|
};
|
|
311
341
|
function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
312
|
-
const [theme] = useContext(ThemeContext);
|
|
313
|
-
const [showModal, setShowModal] = useState(false);
|
|
314
|
-
const modalRef = useRef(null);
|
|
315
|
-
const parentRef = useRef(null);
|
|
316
|
-
const handleOnChange = useCallback((event) => {
|
|
342
|
+
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
343
|
+
const [showModal, setShowModal] = (0, react_1.useState)(false);
|
|
344
|
+
const modalRef = (0, react_1.useRef)(null);
|
|
345
|
+
const parentRef = (0, react_1.useRef)(null);
|
|
346
|
+
const handleOnChange = (0, react_1.useCallback)((event) => {
|
|
317
347
|
onChangeDateRange(event.target.value);
|
|
318
348
|
}, [onChangeDateRange]);
|
|
319
|
-
const [anchorDate, setAnchorDate] = useState(null);
|
|
320
|
-
const [localStartDate, setLocalStartDate] = useState(null);
|
|
321
|
-
const [localEndDate, setLocalEndDate] = useState(null);
|
|
349
|
+
const [anchorDate, setAnchorDate] = (0, react_1.useState)(null);
|
|
350
|
+
const [localStartDate, setLocalStartDate] = (0, react_1.useState)(null);
|
|
351
|
+
const [localEndDate, setLocalEndDate] = (0, react_1.useState)(null);
|
|
322
352
|
// const firstDayOfFirstMonth = startOfMonth(value[0]);
|
|
323
353
|
// const lastDayOfLastMonth = endOfMonth(value[1]);
|
|
324
354
|
// const weekdays = getWeekdays(enUS).map(dayName =>
|
|
325
355
|
// capitalize(dayName, locale)
|
|
326
356
|
// );
|
|
327
|
-
const prevMonthAnchor = subDays(startOfMonth(anchorDate), 1);
|
|
357
|
+
const prevMonthAnchor = (0, date_fns_1.subDays)((0, date_fns_1.startOfMonth)(anchorDate), 1);
|
|
328
358
|
const onClickDate = (date) => {
|
|
329
|
-
if (localStartDate && isBefore(date, localStartDate)) {
|
|
359
|
+
if (localStartDate && (0, date_fns_1.isBefore)(date, localStartDate)) {
|
|
330
360
|
setLocalStartDate(date);
|
|
331
361
|
return;
|
|
332
362
|
}
|
|
333
|
-
if (localEndDate && isAfter(date, localEndDate)) {
|
|
363
|
+
if (localEndDate && (0, date_fns_1.isAfter)(date, localEndDate)) {
|
|
334
364
|
setLocalEndDate(date);
|
|
335
365
|
return;
|
|
336
366
|
}
|
|
337
|
-
if (localEndDate && isBefore(date, localEndDate)) {
|
|
367
|
+
if (localEndDate && (0, date_fns_1.isBefore)(date, localEndDate)) {
|
|
338
368
|
setLocalEndDate(date);
|
|
339
369
|
return;
|
|
340
370
|
}
|
|
341
|
-
if (isEqual(localStartDate, date) || isEqual(localEndDate, date)) {
|
|
371
|
+
if ((0, date_fns_1.isEqual)(localStartDate, date) || (0, date_fns_1.isEqual)(localEndDate, date)) {
|
|
342
372
|
setLocalStartDate(null);
|
|
343
373
|
setLocalEndDate(null);
|
|
344
374
|
}
|
|
@@ -351,19 +381,19 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
351
381
|
return;
|
|
352
382
|
}
|
|
353
383
|
};
|
|
354
|
-
useEffect(() => {
|
|
384
|
+
(0, react_1.useEffect)(() => {
|
|
355
385
|
if (localEndDate &&
|
|
356
386
|
localStartDate &&
|
|
357
|
-
isBefore(localStartDate, localEndDate)) {
|
|
387
|
+
(0, date_fns_1.isBefore)(localStartDate, localEndDate)) {
|
|
358
388
|
onChangeDateRange([localStartDate, localEndDate]);
|
|
359
389
|
}
|
|
360
390
|
}, [localEndDate, localStartDate]);
|
|
361
|
-
useEffect(() => {
|
|
391
|
+
(0, react_1.useEffect)(() => {
|
|
362
392
|
if (dateRange.length && !anchorDate) {
|
|
363
393
|
setAnchorDate(dateRange[1]);
|
|
364
394
|
}
|
|
365
395
|
}, [dateRange, anchorDate]);
|
|
366
|
-
useOnClickOutside(modalRef, (e) => {
|
|
396
|
+
(0, hooks_1.useOnClickOutside)(modalRef, (e) => {
|
|
367
397
|
// Exclude click on trigger button (e.g. Dropdown Button) from outside click handler
|
|
368
398
|
const isTriggerElem = parentRef
|
|
369
399
|
? parentRef.current?.contains(e.target)
|
|
@@ -372,7 +402,7 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
372
402
|
setShowModal(false);
|
|
373
403
|
}
|
|
374
404
|
});
|
|
375
|
-
return (
|
|
405
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: parentRef, style: { position: 'relative', height: 38 }, children: [(0, jsx_runtime_1.jsx)("button", {
|
|
376
406
|
// onChange={handleOnChange}
|
|
377
407
|
// value={value}
|
|
378
408
|
onClick: () => setShowModal((showModal) => !showModal), id: 'reportbuilderdropdown', defaultValue: "Select", style: {
|
|
@@ -401,7 +431,7 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
401
431
|
minHeight: 38,
|
|
402
432
|
marginBottom: 0,
|
|
403
433
|
paddingLeft: 14 + 15 + 3,
|
|
404
|
-
}, children: formatDateText(dateRange, localStartDate, localEndDate) }),
|
|
434
|
+
}, children: formatDateText(dateRange, localStartDate, localEndDate) }), (0, jsx_runtime_1.jsx)(assets_1.CalendarNormalIcon, { style: {
|
|
405
435
|
height: '15px',
|
|
406
436
|
width: '15px',
|
|
407
437
|
flex: 'none',
|
|
@@ -409,7 +439,7 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
409
439
|
left: 12,
|
|
410
440
|
top: 11,
|
|
411
441
|
color: theme?.primaryTextColor,
|
|
412
|
-
} }), showModal && (
|
|
442
|
+
} }), showModal && ((0, jsx_runtime_1.jsxs)("div", { ref: modalRef, style: {
|
|
413
443
|
position: 'absolute',
|
|
414
444
|
zIndex: 1,
|
|
415
445
|
overflowY: 'auto',
|
|
@@ -439,7 +469,7 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
439
469
|
paddingLeft: 8,
|
|
440
470
|
paddingRight: 8,
|
|
441
471
|
paddingBottom: 1,
|
|
442
|
-
}, children: [
|
|
472
|
+
}, children: [(0, jsx_runtime_1.jsx)("button", { style: {
|
|
443
473
|
height: 32,
|
|
444
474
|
width: 32,
|
|
445
475
|
position: 'absolute',
|
|
@@ -459,11 +489,11 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
459
489
|
alignItems: 'center',
|
|
460
490
|
justifyContent: 'center',
|
|
461
491
|
background: 'transparent',
|
|
462
|
-
}, onClick: () => setAnchorDate((date) => subDays(startOfMonth(date), 1)), children:
|
|
492
|
+
}, onClick: () => setAnchorDate((date) => (0, date_fns_1.subDays)((0, date_fns_1.startOfMonth)(date), 1)), children: (0, jsx_runtime_1.jsx)(assets_1.ArrowLeftHeadIcon, { style: {
|
|
463
493
|
height: '20px',
|
|
464
494
|
width: '20px',
|
|
465
495
|
color: theme?.secondaryTextColor,
|
|
466
|
-
}, "aria-hidden": "true" }) }),
|
|
496
|
+
}, "aria-hidden": "true" }) }), (0, jsx_runtime_1.jsx)("button", { style: {
|
|
467
497
|
height: 32,
|
|
468
498
|
width: 32,
|
|
469
499
|
borderColor: theme?.borderColor || '#E5E7EB',
|
|
@@ -483,32 +513,33 @@ function CalendarDropdown({ onChangeDateRange, dateRange }) {
|
|
|
483
513
|
alignItems: 'center',
|
|
484
514
|
justifyContent: 'center',
|
|
485
515
|
background: 'transparent',
|
|
486
|
-
}, onClick: () => setAnchorDate((date) => addDays(endOfMonth(date), 1)), children:
|
|
516
|
+
}, onClick: () => setAnchorDate((date) => (0, date_fns_1.addDays)((0, date_fns_1.endOfMonth)(date), 1)), children: (0, jsx_runtime_1.jsx)(assets_1.ArrowRightHeadIcon, { style: {
|
|
487
517
|
height: '20px',
|
|
488
518
|
width: '20px',
|
|
489
519
|
color: theme?.secondaryTextColor,
|
|
490
|
-
}, "aria-hidden": "true" }) }), anchorDate && (
|
|
520
|
+
}, "aria-hidden": "true" }) }), anchorDate && ((0, jsx_runtime_1.jsx)(Calendar, { anchorDate: prevMonthAnchor, dateRange: dateRange, theme: theme, onClickDate: onClickDate, localStartDate: localStartDate, localEndDate: localEndDate })), anchorDate && ((0, jsx_runtime_1.jsx)(Calendar, { anchorDate: anchorDate, dateRange: dateRange, theme: theme, onClickDate: onClickDate, localStartDate: localStartDate, localEndDate: localEndDate }))] }))] }));
|
|
491
521
|
}
|
|
492
|
-
|
|
493
|
-
const [theme] = useContext(ThemeContext);
|
|
494
|
-
return (
|
|
522
|
+
const QuillDateRangePicker = ({ label, dateRange, onChangeDateRange, presetOptions, preset, onChangePreset, }) => {
|
|
523
|
+
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
524
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [label !== '' && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
495
525
|
marginBottom: 6,
|
|
496
526
|
fontWeight: theme.labelFontWeight || '600',
|
|
497
527
|
color: theme.secondaryTextColor,
|
|
498
528
|
fontFamily: theme.fontFamily,
|
|
499
529
|
fontSize: 14,
|
|
500
|
-
}, children: label })),
|
|
530
|
+
}, children: label })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
501
531
|
display: 'flex',
|
|
502
532
|
flexDirection: 'row',
|
|
503
533
|
alignItems: 'center',
|
|
504
534
|
gap: 12,
|
|
505
|
-
}, children: [
|
|
535
|
+
}, children: [(0, jsx_runtime_1.jsx)(MemoizedCalendarDropdown, { dateRange: dateRange, onChangeDateRange: onChangeDateRange, theme: theme }), (0, jsx_runtime_1.jsx)(MemoizedDropdown, { options: presetOptions.map((option) => ({
|
|
506
536
|
label: option.text,
|
|
507
537
|
value: option.value,
|
|
508
538
|
})), onChange: onChangePreset, value: preset })] })] }));
|
|
509
539
|
};
|
|
510
|
-
|
|
511
|
-
const
|
|
540
|
+
exports.QuillDateRangePicker = QuillDateRangePicker;
|
|
541
|
+
const MemoizedCalendarDropdown = react_1.default.memo(CalendarDropdown);
|
|
542
|
+
const MemoizedDropdown = react_1.default.memo(QuillDropdownComponent);
|
|
512
543
|
const areEqual = (prevProps, nextProps) => {
|
|
513
544
|
// This function returns true if passing nextProps to render would return
|
|
514
545
|
// the same result as passing prevProps to render, otherwise it returns false
|
|
@@ -517,40 +548,40 @@ const areEqual = (prevProps, nextProps) => {
|
|
|
517
548
|
prevProps.dateRange[0] === nextProps.dateRange[0] &&
|
|
518
549
|
prevProps.dateRange[1] === nextProps.dateRange[1]);
|
|
519
550
|
};
|
|
520
|
-
const MemoizedDateRangePicker =
|
|
521
|
-
|
|
522
|
-
const { isLoading: isDataLoading, data,
|
|
523
|
-
const [dashboardSections, setDashboardSections] = useState(null);
|
|
524
|
-
const { dashboard } = useContext(DashboardContext);
|
|
525
|
-
const [client] = useContext(ClientContext);
|
|
526
|
-
const [isLoading, setIsLoading] = useState(isDataLoading);
|
|
527
|
-
const [theme] = useContext(ThemeContext);
|
|
528
|
-
const { dashboardFilters, dashboardFiltersDispatch } = useContext(DashboardFiltersContext);
|
|
529
|
-
const { setDateFilter } = useContext(DateFilterContext);
|
|
530
|
-
useEffect(() => {
|
|
551
|
+
const MemoizedDateRangePicker = react_1.default.memo(exports.QuillDateRangePicker, areEqual);
|
|
552
|
+
function Dashboard({ name, containerStyle, chartContainerStyle, metricContainerStyle, maxColumnWidth, rowHeight, onClickDashboardItem, hideFilters, FilterDropdownComponent, DateRangePickerComponent, FilterButtonComponent, FilterModalComponent, onChangeLoading, DashboardItemComponent, }) {
|
|
553
|
+
const { isLoading: isDataLoading, data, reload } = (0, useDashboard_1.useDashboard)(name);
|
|
554
|
+
const [dashboardSections, setDashboardSections] = (0, react_1.useState)(null);
|
|
555
|
+
const { dashboard } = (0, react_1.useContext)(Context_1.DashboardContext);
|
|
556
|
+
const [client] = (0, react_1.useContext)(Context_1.ClientContext);
|
|
557
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(isDataLoading);
|
|
558
|
+
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
559
|
+
const { dashboardFilters, dashboardFiltersDispatch } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
|
|
560
|
+
const { setDateFilter } = (0, react_1.useContext)(Context_1.DateFilterContext);
|
|
561
|
+
(0, react_1.useEffect)(() => {
|
|
531
562
|
setIsLoading(isDataLoading);
|
|
532
563
|
}, [isDataLoading]);
|
|
533
|
-
useEffect(() => {
|
|
564
|
+
(0, react_1.useEffect)(() => {
|
|
565
|
+
if (!data)
|
|
566
|
+
return;
|
|
534
567
|
onDashboardDataChange(data);
|
|
535
568
|
}, [data]);
|
|
536
|
-
useEffect(() => {
|
|
569
|
+
(0, react_1.useEffect)(() => {
|
|
537
570
|
reload();
|
|
538
571
|
}, [name, client]);
|
|
539
572
|
const onDashboardDataChange = (resp) => {
|
|
540
|
-
if (!resp)
|
|
541
|
-
return;
|
|
542
573
|
setDashboardSections(resp.sections);
|
|
543
574
|
const bigFilterObj = {};
|
|
544
575
|
if (resp.dateFilter && Object.keys(resp.dateFilter).length) {
|
|
545
576
|
const key = 'LAST_6_MONTHS';
|
|
546
577
|
const code = '6m';
|
|
547
578
|
const filter = {
|
|
548
|
-
startDate: PRIMARY_RANGE[key]?.start,
|
|
549
|
-
endDate: PRIMARY_RANGE[key]?.end,
|
|
579
|
+
startDate: dateRangePickerUtils_1.PRIMARY_RANGE[key]?.start,
|
|
580
|
+
endDate: dateRangePickerUtils_1.PRIMARY_RANGE[key]?.end,
|
|
550
581
|
filterType: 'date_range',
|
|
551
582
|
selectedValue: [
|
|
552
|
-
PRIMARY_RANGE[key]?.start,
|
|
553
|
-
PRIMARY_RANGE[key]?.end,
|
|
583
|
+
dateRangePickerUtils_1.PRIMARY_RANGE[key]?.start,
|
|
584
|
+
dateRangePickerUtils_1.PRIMARY_RANGE[key]?.end,
|
|
554
585
|
code,
|
|
555
586
|
],
|
|
556
587
|
options: options,
|
|
@@ -561,8 +592,8 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
561
592
|
filter.comparison = true;
|
|
562
593
|
const range = { start: filter.startDate, end: filter.endDate };
|
|
563
594
|
filter.comparisonRange = {
|
|
564
|
-
startDate: COMPARISON_RANGE['PREV_PERIOD'](range)?.start,
|
|
565
|
-
endDate: COMPARISON_RANGE['PREV_PERIOD'](range)?.end,
|
|
595
|
+
startDate: dateRangePickerUtils_1.COMPARISON_RANGE['PREV_PERIOD'](range)?.start,
|
|
596
|
+
endDate: dateRangePickerUtils_1.COMPARISON_RANGE['PREV_PERIOD'](range)?.end,
|
|
566
597
|
value: 'PREV_PERIOD',
|
|
567
598
|
};
|
|
568
599
|
}
|
|
@@ -706,8 +737,8 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
706
737
|
label: 'Date',
|
|
707
738
|
comparison: true,
|
|
708
739
|
comparisonRange: {
|
|
709
|
-
startDate: COMPARISON_RANGE[key](primaryRange)?.start,
|
|
710
|
-
endDate: COMPARISON_RANGE[key](primaryRange)?.end,
|
|
740
|
+
startDate: dateRangePickerUtils_1.COMPARISON_RANGE[key](primaryRange)?.start,
|
|
741
|
+
endDate: dateRangePickerUtils_1.COMPARISON_RANGE[key](primaryRange)?.end,
|
|
711
742
|
value: key,
|
|
712
743
|
},
|
|
713
744
|
},
|
|
@@ -731,7 +762,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
731
762
|
}
|
|
732
763
|
}
|
|
733
764
|
};
|
|
734
|
-
useEffect(() => {
|
|
765
|
+
(0, react_1.useEffect)(() => {
|
|
735
766
|
if (dashboardSections && dashboard) {
|
|
736
767
|
const totalNumberOfItems = Object.values(dashboardSections).reduce((count, arr) => count + arr.length, 0);
|
|
737
768
|
const itemsLoaded = Object.keys(dashboard).length;
|
|
@@ -740,7 +771,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
740
771
|
}
|
|
741
772
|
}
|
|
742
773
|
}, [dashboard, dashboardSections, isLoading]);
|
|
743
|
-
useEffect(() => {
|
|
774
|
+
(0, react_1.useEffect)(() => {
|
|
744
775
|
if (onChangeLoading) {
|
|
745
776
|
onChangeLoading(isLoading);
|
|
746
777
|
}
|
|
@@ -748,12 +779,12 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
748
779
|
if (!dashboardSections) {
|
|
749
780
|
return null;
|
|
750
781
|
}
|
|
751
|
-
return (
|
|
782
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: containerStyle, children: [!hideFilters ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
752
783
|
display: 'flex',
|
|
753
784
|
boxSizing: 'content-box',
|
|
754
785
|
flexDirection: 'row',
|
|
755
786
|
alignItems: 'center',
|
|
756
|
-
}, children:
|
|
787
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
757
788
|
width: '100%',
|
|
758
789
|
marginBottom: 25,
|
|
759
790
|
display: 'flex',
|
|
@@ -762,7 +793,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
762
793
|
gap: 12,
|
|
763
794
|
}, children: Object.values(dashboardFilters)
|
|
764
795
|
.sort((filter) => (filter.filterType === 'date_range' ? -1 : 1))
|
|
765
|
-
.map((filter, index) => (
|
|
796
|
+
.map((filter, index) => ((0, jsx_runtime_1.jsx)(DashboardFilter, { filter: filter, onChangeFilter: updateFilter, theme: theme, filterValue: dashboardFilters, SelectComponent: FilterDropdownComponent
|
|
766
797
|
? FilterDropdownComponent
|
|
767
798
|
: MemoizedDropdown, DateRangePickerComponent: DateRangePickerComponent
|
|
768
799
|
? DateRangePickerComponent
|
|
@@ -771,9 +802,9 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
771
802
|
return a.length - b.length;
|
|
772
803
|
})
|
|
773
804
|
.map((section, sectionIndex) => {
|
|
774
|
-
return (
|
|
805
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
775
806
|
width: '100%',
|
|
776
|
-
}, children: [
|
|
807
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: sectionIndex > 0 ? 25 : 0 } }), section && ((0, jsx_runtime_1.jsx)("h1", { style: {
|
|
777
808
|
fontSize: 22,
|
|
778
809
|
color: theme.primaryTextColor,
|
|
779
810
|
fontFamily: theme.fontFamily,
|
|
@@ -783,7 +814,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
783
814
|
// marginLeft: 25,
|
|
784
815
|
textAlign: 'left',
|
|
785
816
|
marginTop: 12,
|
|
786
|
-
}, children: section }))] }), dashboardSections[section].filter((elem) => elem.chartType === 'metric').length ? (
|
|
817
|
+
}, children: section }))] }), dashboardSections[section].filter((elem) => elem.chartType === 'metric').length ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
787
818
|
boxSizing: 'content-box',
|
|
788
819
|
width: `100%`,
|
|
789
820
|
listStyleType: 'none',
|
|
@@ -805,13 +836,13 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
805
836
|
})
|
|
806
837
|
.map((elem, index) => {
|
|
807
838
|
if (DashboardItemComponent) {
|
|
808
|
-
return (
|
|
839
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
|
|
809
840
|
? () => handleOnClickDashboardItem(elem)
|
|
810
|
-
: undefined, children:
|
|
841
|
+
: undefined, children: (0, jsx_runtime_1.jsx)(DashboardItemComponent, { dashboardItem: elem, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
811
842
|
padding: 0,
|
|
812
843
|
// height: '100%',
|
|
813
844
|
boxSizing: 'content-box',
|
|
814
|
-
}, children:
|
|
845
|
+
}, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
|
|
815
846
|
display: 'flex',
|
|
816
847
|
width: '100%',
|
|
817
848
|
// height: '100%',
|
|
@@ -819,7 +850,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
819
850
|
? theme.chartColors
|
|
820
851
|
: undefined }) }) }) }, elem.name + '' + index));
|
|
821
852
|
}
|
|
822
|
-
return (
|
|
853
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
|
|
823
854
|
? () => handleOnClickDashboardItem(elem)
|
|
824
855
|
: undefined, style: {
|
|
825
856
|
// background: theme.elevatedCardColor,
|
|
@@ -832,22 +863,22 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
832
863
|
cursor: 'pointer',
|
|
833
864
|
width: '100%',
|
|
834
865
|
...metricContainerStyle,
|
|
835
|
-
}, children:
|
|
866
|
+
}, children: (0, jsx_runtime_1.jsx)("div", {
|
|
836
867
|
// className="group-hover:bg-black"
|
|
837
868
|
style: {
|
|
838
869
|
width: '100%',
|
|
839
870
|
boxSizing: 'content-box',
|
|
840
871
|
height: '100%',
|
|
841
|
-
}, children:
|
|
872
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
842
873
|
width: '100%',
|
|
843
874
|
boxSizing: 'content-box',
|
|
844
875
|
height: '100%',
|
|
845
|
-
}, children:
|
|
876
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
846
877
|
display: 'flex',
|
|
847
878
|
flexDirection: 'column',
|
|
848
879
|
justifyContent: 'space-between',
|
|
849
880
|
boxSizing: 'content-box',
|
|
850
|
-
}, children: [
|
|
881
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", {
|
|
851
882
|
// className="group-hover:bg-black"
|
|
852
883
|
style: {
|
|
853
884
|
display: 'flex',
|
|
@@ -858,7 +889,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
858
889
|
// paddingLeft: theme.padding,
|
|
859
890
|
// paddingRight: 25,
|
|
860
891
|
// paddingTop: theme.padding,
|
|
861
|
-
}, children: [
|
|
892
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { title: elem.name, style: {
|
|
862
893
|
fontFamily: theme.fontFamily,
|
|
863
894
|
color: theme.primaryTextColor,
|
|
864
895
|
boxSizing: 'content-box',
|
|
@@ -876,7 +907,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
876
907
|
display: 'block',
|
|
877
908
|
maxWidth: '100%',
|
|
878
909
|
overflow: 'hidden',
|
|
879
|
-
}, children: elem.name }), onClickDashboardItem ? (
|
|
910
|
+
}, children: elem.name }), onClickDashboardItem ? ((0, jsx_runtime_1.jsx)("div", {
|
|
880
911
|
// className="hover:bg-black"
|
|
881
912
|
style: {
|
|
882
913
|
fontFamily: theme.fontFamily,
|
|
@@ -889,7 +920,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
889
920
|
display: 'flex',
|
|
890
921
|
alignItems: 'center',
|
|
891
922
|
justifyContent: 'flex-end',
|
|
892
|
-
}, children: 'view report →' })) : null] }),
|
|
923
|
+
}, children: 'view report →' })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: { padding: 0, paddingTop: 10 }, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
|
|
893
924
|
// display: 'flex',
|
|
894
925
|
// width: '100%',
|
|
895
926
|
// height: 30,
|
|
@@ -898,7 +929,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
898
929
|
}, isDateFilter: true,
|
|
899
930
|
// chartFilters={elem.chartFilters}
|
|
900
931
|
chartId: elem._id }) })] }) }) }) }, elem.name + '' + index));
|
|
901
|
-
}) })) : null, dashboardSections[section].filter((elem) => elem.chartType !== 'table' && elem.chartType !== 'metric').length ? (
|
|
932
|
+
}) })) : null, dashboardSections[section].filter((elem) => elem.chartType !== 'table' && elem.chartType !== 'metric').length ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
902
933
|
listStyleType: 'none',
|
|
903
934
|
display: 'grid',
|
|
904
935
|
gridGap: 25,
|
|
@@ -919,9 +950,9 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
919
950
|
})
|
|
920
951
|
.map((elem, index) => {
|
|
921
952
|
if (DashboardItemComponent) {
|
|
922
|
-
return (
|
|
953
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
|
|
923
954
|
? () => handleOnClickDashboardItem(elem)
|
|
924
|
-
: undefined, style: { height: rowHeight || 400 }, children:
|
|
955
|
+
: undefined, style: { height: rowHeight || 400 }, children: (0, jsx_runtime_1.jsx)(DashboardItemComponent, { dashboardItem: elem, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
|
|
925
956
|
display: 'flex',
|
|
926
957
|
width: '100%',
|
|
927
958
|
// height: '100%',
|
|
@@ -932,7 +963,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
932
963
|
? theme.chartColors
|
|
933
964
|
: undefined }) }) }, elem.name + '' + index));
|
|
934
965
|
}
|
|
935
|
-
return (
|
|
966
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
|
|
936
967
|
? () => handleOnClickDashboardItem(elem)
|
|
937
968
|
: undefined, style: {
|
|
938
969
|
height: '100%',
|
|
@@ -943,26 +974,26 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
943
974
|
borderRadius: 8,
|
|
944
975
|
paddingTop: 20,
|
|
945
976
|
...chartContainerStyle,
|
|
946
|
-
}, children:
|
|
977
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
947
978
|
width: '100%',
|
|
948
979
|
height: '100%',
|
|
949
980
|
boxSizing: 'content-box',
|
|
950
|
-
}, children:
|
|
981
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
951
982
|
width: '100%',
|
|
952
983
|
height: '100%',
|
|
953
984
|
boxSizing: 'content-box',
|
|
954
|
-
}, children:
|
|
985
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
955
986
|
display: 'flex',
|
|
956
987
|
flexDirection: 'column',
|
|
957
988
|
justifyContent: 'space-between',
|
|
958
989
|
height: '100%',
|
|
959
990
|
boxSizing: 'content-box',
|
|
960
|
-
}, children: [
|
|
991
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
961
992
|
display: 'flex',
|
|
962
993
|
flexDirection: 'row',
|
|
963
994
|
justifyContent: 'space-between',
|
|
964
995
|
boxSizing: 'content-box',
|
|
965
|
-
}, children: [
|
|
996
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
966
997
|
fontFamily: theme.fontFamily,
|
|
967
998
|
color: theme.primaryTextColor,
|
|
968
999
|
boxSizing: 'content-box',
|
|
@@ -975,7 +1006,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
975
1006
|
display: 'block',
|
|
976
1007
|
maxWidth: '100%',
|
|
977
1008
|
overflow: 'hidden',
|
|
978
|
-
}, children: elem.name }), onClickDashboardItem ? (
|
|
1009
|
+
}, children: elem.name }), onClickDashboardItem ? ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
979
1010
|
fontFamily: theme.fontFamily,
|
|
980
1011
|
color: theme.primaryTextColor,
|
|
981
1012
|
boxSizing: 'content-box',
|
|
@@ -985,11 +1016,11 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
985
1016
|
display: 'flex',
|
|
986
1017
|
alignItems: 'center',
|
|
987
1018
|
justifyContent: 'flex-end',
|
|
988
|
-
}, children: 'view report →' })) : null] }),
|
|
1019
|
+
}, children: 'view report →' })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
989
1020
|
padding: 0,
|
|
990
1021
|
height: '100%',
|
|
991
1022
|
boxSizing: 'content-box',
|
|
992
|
-
}, children:
|
|
1023
|
+
}, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
|
|
993
1024
|
display: 'flex',
|
|
994
1025
|
width: '100%',
|
|
995
1026
|
// TODO: fix fixed height
|
|
@@ -999,13 +1030,13 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
999
1030
|
}, isDateFilter: true, chartId: elem._id, colors: theme.chartColors?.length
|
|
1000
1031
|
? theme.chartColors
|
|
1001
1032
|
: undefined }) })] }) }) }) }, elem.name + '' + index));
|
|
1002
|
-
}) })) : null, dashboardSections[section].filter((elem) => elem.chartType === 'table').length ? (
|
|
1033
|
+
}) })) : null, dashboardSections[section].filter((elem) => elem.chartType === 'table').length ? ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1003
1034
|
boxSizing: 'content-box',
|
|
1004
1035
|
width: `100%`,
|
|
1005
1036
|
gap: 20,
|
|
1006
1037
|
display: 'flex',
|
|
1007
1038
|
flexDirection: 'column',
|
|
1008
|
-
}, children: [
|
|
1039
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: 0 } }), dashboardSections[section]
|
|
1009
1040
|
.filter((elem) => elem.chartType === 'table')
|
|
1010
1041
|
.sort((a, b) => {
|
|
1011
1042
|
if (a.order === undefined && b.order === undefined)
|
|
@@ -1018,13 +1049,13 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1018
1049
|
})
|
|
1019
1050
|
.map((elem, index) => {
|
|
1020
1051
|
if (DashboardItemComponent) {
|
|
1021
|
-
return (
|
|
1052
|
+
return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
|
|
1022
1053
|
? () => handleOnClickDashboardItem(elem)
|
|
1023
|
-
: undefined, children:
|
|
1054
|
+
: undefined, children: (0, jsx_runtime_1.jsx)(DashboardItemComponent, { dashboardItem: elem, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
1024
1055
|
padding: 0,
|
|
1025
1056
|
height: '100%',
|
|
1026
1057
|
boxSizing: 'content-box',
|
|
1027
|
-
}, children:
|
|
1058
|
+
}, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
|
|
1028
1059
|
display: 'flex',
|
|
1029
1060
|
width: '100%',
|
|
1030
1061
|
height: '100%',
|
|
@@ -1032,7 +1063,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1032
1063
|
? theme.chartColors
|
|
1033
1064
|
: undefined }) }) }) }, elem.name + '' + index));
|
|
1034
1065
|
}
|
|
1035
|
-
return (
|
|
1066
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
|
|
1036
1067
|
? () => handleOnClickDashboardItem(elem)
|
|
1037
1068
|
: undefined, style: {
|
|
1038
1069
|
// background: theme.elevatedCardColor,
|
|
@@ -1047,23 +1078,23 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1047
1078
|
minHeight: 420,
|
|
1048
1079
|
height: 420,
|
|
1049
1080
|
// ...metricContainerStyle,
|
|
1050
|
-
}, children:
|
|
1081
|
+
}, children: (0, jsx_runtime_1.jsx)("div", {
|
|
1051
1082
|
// className="group-hover:bg-black"
|
|
1052
1083
|
style: {
|
|
1053
1084
|
width: '100%',
|
|
1054
1085
|
boxSizing: 'content-box',
|
|
1055
1086
|
height: '100%',
|
|
1056
|
-
}, children:
|
|
1087
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
1057
1088
|
width: '100%',
|
|
1058
1089
|
boxSizing: 'content-box',
|
|
1059
1090
|
height: '100%',
|
|
1060
|
-
}, children:
|
|
1091
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1061
1092
|
display: 'flex',
|
|
1062
1093
|
flexDirection: 'column',
|
|
1063
1094
|
justifyContent: 'space-between',
|
|
1064
1095
|
boxSizing: 'content-box',
|
|
1065
1096
|
height: '100%',
|
|
1066
|
-
}, children: [
|
|
1097
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", {
|
|
1067
1098
|
// className="group-hover:bg-black"
|
|
1068
1099
|
style: {
|
|
1069
1100
|
display: 'flex',
|
|
@@ -1074,7 +1105,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1074
1105
|
// paddingLeft: theme.padding,
|
|
1075
1106
|
paddingRight: 25,
|
|
1076
1107
|
// paddingTop: theme.padding,
|
|
1077
|
-
}, children: [
|
|
1108
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { title: elem.name, style: {
|
|
1078
1109
|
fontFamily: theme.fontFamily,
|
|
1079
1110
|
color: theme.primaryTextColor,
|
|
1080
1111
|
boxSizing: 'content-box',
|
|
@@ -1093,7 +1124,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1093
1124
|
display: 'block',
|
|
1094
1125
|
maxWidth: '100%',
|
|
1095
1126
|
overflow: 'hidden',
|
|
1096
|
-
}, children: elem.name }), onClickDashboardItem ? (
|
|
1127
|
+
}, children: elem.name }), onClickDashboardItem ? ((0, jsx_runtime_1.jsx)("div", {
|
|
1097
1128
|
// className="hover:bg-black"
|
|
1098
1129
|
style: {
|
|
1099
1130
|
fontFamily: theme.fontFamily,
|
|
@@ -1106,10 +1137,10 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1106
1137
|
display: 'flex',
|
|
1107
1138
|
alignItems: 'center',
|
|
1108
1139
|
justifyContent: 'flex-end',
|
|
1109
|
-
}, children: 'view report →' })) : null] }),
|
|
1140
|
+
}, children: 'view report →' })) : null] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1110
1141
|
padding: 0,
|
|
1111
1142
|
height: '400px',
|
|
1112
|
-
}, children: [
|
|
1143
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
|
|
1113
1144
|
// display: 'flex',
|
|
1114
1145
|
// width: '100%',
|
|
1115
1146
|
// height: 30,
|
|
@@ -1118,10 +1149,11 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle, m
|
|
|
1118
1149
|
// paddingLeft: 25,
|
|
1119
1150
|
}, isDateFilter: true,
|
|
1120
1151
|
// chartFilters={elem.chartFilters}
|
|
1121
|
-
chartId: elem._id })] })] }) }) }) }, elem.name + '' + index),
|
|
1122
|
-
})] })) : null,
|
|
1152
|
+
chartId: elem._id })] })] }) }) }) }, elem.name + '' + index), (0, jsx_runtime_1.jsx)("div", { style: { height: 40 } })] }));
|
|
1153
|
+
})] })) : null, (0, jsx_runtime_1.jsx)("div", { style: { height: 40 } })] }, section + '' + sectionIndex));
|
|
1123
1154
|
})] }));
|
|
1124
1155
|
}
|
|
1156
|
+
exports.default = Dashboard;
|
|
1125
1157
|
// ----------------------------------------------------------------
|
|
1126
1158
|
// REST OF CODE NOT USED
|
|
1127
1159
|
function Filter({ defaultValue, theme, onValueChange, filter }) {
|
|
@@ -1134,23 +1166,23 @@ function Filter({ defaultValue, theme, onValueChange, filter }) {
|
|
|
1134
1166
|
{ value: 'popupbagelsredding', text: 'popupbagelsredding' },
|
|
1135
1167
|
{ value: 'popupbagelsthompson', text: 'popupbagelsthompson' },
|
|
1136
1168
|
];
|
|
1137
|
-
const dropdownRef = useRef(null);
|
|
1138
|
-
const [showDropdown, setShowDropdown] = useState(false);
|
|
1139
|
-
const [selectedValue, setSelectedValue] = useInternalState(defaultValue, undefined);
|
|
1169
|
+
const dropdownRef = (0, react_1.useRef)(null);
|
|
1170
|
+
const [showDropdown, setShowDropdown] = (0, react_1.useState)(false);
|
|
1171
|
+
const [selectedValue, setSelectedValue] = (0, hooks_1.useInternalState)(defaultValue, undefined);
|
|
1140
1172
|
const selectedDropdownValue = selectedValue ? selectedValue[2] ?? null : null;
|
|
1141
1173
|
const handleDropdownOptionClick = (dropdownValue) => {
|
|
1142
1174
|
setSelectedValue([undefined, undefined, dropdownValue]);
|
|
1143
1175
|
onValueChange?.([undefined, undefined, dropdownValue]);
|
|
1144
1176
|
setShowDropdown(false);
|
|
1145
1177
|
};
|
|
1146
|
-
const [hoveredDropdownValue, handleDropdownKeyDown] = useSelectOnKeyDown(handleDropdownOptionClick, dropdownOptions.map((option) => option.value), showDropdown, setShowDropdown, selectedDropdownValue);
|
|
1147
|
-
return (
|
|
1178
|
+
const [hoveredDropdownValue, handleDropdownKeyDown] = (0, hooks_1.useSelectOnKeyDown)(handleDropdownOptionClick, dropdownOptions.map((option) => option.value), showDropdown, setShowDropdown, selectedDropdownValue);
|
|
1179
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
1148
1180
|
marginBottom: 6,
|
|
1149
1181
|
fontWeight: '600',
|
|
1150
1182
|
color: theme.secondaryTextColor,
|
|
1151
1183
|
fontSize: 14,
|
|
1152
1184
|
fontFamily: theme.fontFamily,
|
|
1153
|
-
}, children: filter.label }),
|
|
1185
|
+
}, children: filter.label }), (0, jsx_runtime_1.jsx)(FilterDropdown, { showDropdown: showDropdown, setShowDropdown: setShowDropdown, handleDropdownKeyDown: handleDropdownKeyDown, dropdownRef: dropdownRef, theme: theme, selectedDropdownValue: selectedDropdownValue, dropdownOptions: filter.options, field: filter.field, label: filter.labelField }), (0, jsx_runtime_1.jsx)(FilterModal, { showDropdown: showDropdown, setShowDropdown: setShowDropdown, dropdownRef: dropdownRef, theme: theme, hoveredDropdownValue: hoveredDropdownValue, selectedDropdownValue: selectedDropdownValue, dropdownOptions: filter.options, handleDropdownOptionClick: handleDropdownOptionClick, field: filter.field, label: filter.labelField })] }));
|
|
1154
1186
|
}
|
|
1155
1187
|
function removeQuotes(str) {
|
|
1156
1188
|
if (str.startsWith('"') && str.endsWith('"')) {
|
|
@@ -1164,7 +1196,7 @@ function FilterDropdown({ setShowDropdown, dropdownRef, showDropdown, handleDrop
|
|
|
1164
1196
|
const dropdownText = selectedDropdownValue
|
|
1165
1197
|
? String(dropdownOptions.find((option) => option[removeQuotes(field)] === selectedDropdownValue)[removeQuotes(label)])
|
|
1166
1198
|
: dropdownPlaceholder;
|
|
1167
|
-
return (
|
|
1199
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1168
1200
|
display: 'flex',
|
|
1169
1201
|
alignItems: 'center',
|
|
1170
1202
|
justifyContent: 'space-between',
|
|
@@ -1172,7 +1204,7 @@ function FilterDropdown({ setShowDropdown, dropdownRef, showDropdown, handleDrop
|
|
|
1172
1204
|
background: theme?.backgroundColor,
|
|
1173
1205
|
fontFamily: theme?.fontFamily,
|
|
1174
1206
|
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1175
|
-
}, children:
|
|
1207
|
+
}, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", style: {
|
|
1176
1208
|
// fontFamily: theme?.fontFamily,
|
|
1177
1209
|
borderColor: theme?.borderColor || '#E5E7EB',
|
|
1178
1210
|
borderStyle: 'solid',
|
|
@@ -1194,7 +1226,7 @@ function FilterDropdown({ setShowDropdown, dropdownRef, showDropdown, handleDrop
|
|
|
1194
1226
|
background: theme?.backgroundColor,
|
|
1195
1227
|
fontSize: theme?.fontSizeSmall || '0.875rem',
|
|
1196
1228
|
// fontWeight: theme?.fontWeightMedium || '800',
|
|
1197
|
-
}, ref: dropdownRef, onClick: () => setShowDropdown(!showDropdown), onKeyDown: handleDropdownKeyDown, children: [
|
|
1229
|
+
}, ref: dropdownRef, onClick: () => setShowDropdown(!showDropdown), onKeyDown: handleDropdownKeyDown, children: [(0, jsx_runtime_1.jsx)("p", { style: {
|
|
1198
1230
|
margin: 0,
|
|
1199
1231
|
fontFamily: theme?.fontFamily,
|
|
1200
1232
|
color: theme?.primaryTextColor || '#364153',
|
|
@@ -1203,7 +1235,7 @@ function FilterDropdown({ setShowDropdown, dropdownRef, showDropdown, handleDrop
|
|
|
1203
1235
|
whiteSpace: 'nowrap',
|
|
1204
1236
|
fontWeight: theme?.fontWeightMedium || '500',
|
|
1205
1237
|
fontSize: theme?.fontSizeSmall || '0.875rem',
|
|
1206
|
-
}, children: dropdownText }),
|
|
1238
|
+
}, children: dropdownText }), (0, jsx_runtime_1.jsx)(assets_1.ArrowDownHeadIcon, { style: {
|
|
1207
1239
|
height: '1.25rem',
|
|
1208
1240
|
width: '1.25rem',
|
|
1209
1241
|
flex: 'none',
|
|
@@ -1212,8 +1244,9 @@ function FilterDropdown({ setShowDropdown, dropdownRef, showDropdown, handleDrop
|
|
|
1212
1244
|
}, "aria-hidden": "true" })] }) }));
|
|
1213
1245
|
}
|
|
1214
1246
|
function FilterModal({ setShowDropdown, dropdownRef, showDropdown, theme, selectedDropdownValue, hoveredDropdownValue, dropdownOptions, handleDropdownOptionClick, field, label, }) {
|
|
1215
|
-
return (
|
|
1247
|
+
return ((0, jsx_runtime_1.jsx)(Modal_1.default, { showModal: showDropdown, setShowModal: setShowDropdown, parentRef: dropdownRef, theme: theme, children: (0, jsx_runtime_1.jsx)(contexts_1.SelectedValueContext.Provider, { value: {
|
|
1216
1248
|
selectedValue: selectedDropdownValue,
|
|
1217
1249
|
handleValueChange: handleDropdownOptionClick,
|
|
1218
|
-
}, children:
|
|
1250
|
+
}, children: (0, jsx_runtime_1.jsx)(contexts_1.HoveredValueContext.Provider, { value: { hoveredValue: hoveredDropdownValue }, children: dropdownOptions.map((row, index) => ((0, jsx_runtime_1.jsx)(Dropdown_1.DropdownItem, { value: row[removeQuotes(field)], text: row[removeQuotes(label)], theme: theme, lastItem: dropdownOptions.length - 1 === index }, row[removeQuotes(field)]))) }) }) }));
|
|
1219
1251
|
}
|
|
1252
|
+
//# sourceMappingURL=Dashboard.js.map
|