@quillsql/react 2.10.17 → 2.10.18
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/cjs/ChartEditor.d.ts.map +1 -1
- package/dist/cjs/Dashboard.d.ts +24 -16
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +86 -478
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts +3 -0
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -0
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.js +260 -0
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts +20 -1
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +93 -4
- package/dist/cjs/QuillProvider.d.ts +1 -0
- package/dist/cjs/QuillProvider.d.ts.map +1 -1
- package/dist/cjs/QuillProvider.js +1 -0
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +1 -2
- package/dist/cjs/components/QuillSelect.d.ts +3 -0
- package/dist/cjs/components/QuillSelect.d.ts.map +1 -0
- package/dist/cjs/components/QuillSelect.js +109 -0
- package/dist/cjs/components/UiComponents.d.ts +1 -0
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -3
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +9 -0
- package/dist/cjs/utils/aggregate.js +2 -2
- package/dist/esm/ChartEditor.d.ts.map +1 -1
- package/dist/esm/Dashboard.d.ts +24 -16
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +84 -475
- package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts +3 -0
- package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -0
- package/dist/esm/DateRangePicker/QuillDateRangePicker.js +256 -0
- package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts +20 -1
- package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/esm/DateRangePicker/dateRangePickerUtils.js +91 -3
- package/dist/esm/QuillProvider.d.ts +1 -0
- package/dist/esm/QuillProvider.d.ts.map +1 -1
- package/dist/esm/QuillProvider.js +1 -0
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +0 -1
- package/dist/esm/components/QuillSelect.d.ts +3 -0
- package/dist/esm/components/QuillSelect.d.ts.map +1 -0
- package/dist/esm/components/QuillSelect.js +105 -0
- package/dist/esm/components/UiComponents.d.ts +1 -0
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +10 -1
- package/dist/esm/utils/aggregate.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/AddToDashboardModal.d.ts +0 -82
- package/dist/cjs/AddToDashboardModal.d.ts.map +0 -1
- package/dist/cjs/AddToDashboardModal.js +0 -1469
- package/dist/esm/AddToDashboardModal.d.ts +0 -82
- package/dist/esm/AddToDashboardModal.d.ts.map +0 -1
- package/dist/esm/AddToDashboardModal.js +0 -1435
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DateRangePickerComponentProps } from '../Dashboard';
|
|
2
|
+
export declare function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onChangePreset, preset, label, }: DateRangePickerComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=QuillDateRangePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuillDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/QuillDateRangePicker.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAK7D,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,MAAM,EACN,KAAK,GACN,EAAE,6BAA6B,2CA+H/B"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuillDateRangePicker = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const Context_1 = require("../Context");
|
|
8
|
+
const hooks_1 = require("../hooks");
|
|
9
|
+
const QuillSelect_1 = require("../components/QuillSelect");
|
|
10
|
+
function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onChangePreset, preset, label, }) {
|
|
11
|
+
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
12
|
+
const [anchorStartDate, setAnchorStartDate] = (0, react_1.useState)(getAnchorStartDate(dateRange.startDate, dateRange.endDate));
|
|
13
|
+
const [anchorEndDate, setAnchorEndDate] = (0, react_1.useState)(getAnchorEndDate(dateRange.startDate, dateRange.endDate));
|
|
14
|
+
const [localStartDate, setLocalStartDate] = (0, react_1.useState)(dateRange.startDate);
|
|
15
|
+
const [localEndDate, setLocalEndDate] = (0, react_1.useState)(dateRange.endDate);
|
|
16
|
+
const [localPreset, setLocalPreset] = (0, react_1.useState)({
|
|
17
|
+
label: preset || '',
|
|
18
|
+
});
|
|
19
|
+
const [showModal, setShowModal] = (0, react_1.useState)(false);
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
setLocalEndDate(dateRange.endDate);
|
|
22
|
+
setLocalStartDate(dateRange.startDate);
|
|
23
|
+
}, [dateRange.startDate, dateRange.endDate]);
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
gap: 12,
|
|
28
|
+
alignItems: 'flex-end',
|
|
29
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: 270 }, children: [label && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
color: theme.primaryTextColor,
|
|
32
|
+
fontFamily: theme.fontFamily,
|
|
33
|
+
paddingBottom: 5,
|
|
34
|
+
fontWeight: 600,
|
|
35
|
+
}, children: label })), (0, jsx_runtime_1.jsxs)("button", { style: {
|
|
36
|
+
width: '100%',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
borderColor: theme.borderColor,
|
|
40
|
+
fontFamily: theme.fontFamily,
|
|
41
|
+
color: theme.primaryTextColor,
|
|
42
|
+
padding: '8px 12px',
|
|
43
|
+
fontSize: 14,
|
|
44
|
+
margin: 0,
|
|
45
|
+
boxSizing: 'border-box',
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderStyle: 'solid',
|
|
48
|
+
borderRadius: 6,
|
|
49
|
+
paddingTop: 11,
|
|
50
|
+
paddingBottom: 11,
|
|
51
|
+
height: 40,
|
|
52
|
+
minHeight: 40,
|
|
53
|
+
maxHeight: 40,
|
|
54
|
+
gap: 10,
|
|
55
|
+
}, onClick: () => setShowModal((showModal) => !showModal), className: "quill-date-range-picker-button", children: [(0, jsx_runtime_1.jsx)("style", { children: ` .quill-date-range-picker-button { background: ${theme.backgroundColor}; } .quill-date-range-picker-button:hover { background: ${theme.hoverBackgroundColor}; }` }), (0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", height: "15.5px", width: "15.5px", style: { marginTop: -1.5 }, children: [(0, jsx_runtime_1.jsx)("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", ry: "2" }), (0, jsx_runtime_1.jsx)("line", { x1: "16", x2: "16", y1: "2", y2: "6" }), (0, jsx_runtime_1.jsx)("line", { x1: "8", x2: "8", y1: "2", y2: "6" }), (0, jsx_runtime_1.jsx)("line", { x1: "3", x2: "21", y1: "10", y2: "10" })] }), localStartDate && (0, date_fns_1.format)(localStartDate, 'MMM dd, yyyy'), localStartDate ? ' - ' : 'Pick a date', localEndDate && (0, date_fns_1.format)(localEndDate, 'MMM dd, yyyy')] }), showModal && ((0, jsx_runtime_1.jsx)(CalendarRow, { theme: theme, anchorStartDate: anchorStartDate, anchorEndDate: anchorEndDate, setAnchorStartDate: setAnchorStartDate, setAnchorEndDate: setAnchorEndDate, setLocalStartDate: setLocalStartDate, setLocalEndDate: setLocalEndDate, localEndDate: localEndDate, localStartDate: localStartDate, updateDateFilter: onChangeDateRange, setLocalPreset: setLocalPreset, setShowModal: setShowModal }))] }), (0, jsx_runtime_1.jsx)(QuillSelect_1.QuillSelectComponent, { options: presetOptions.map((option) => ({
|
|
56
|
+
label: option.label,
|
|
57
|
+
value: option.label,
|
|
58
|
+
})), value: localPreset?.label || '', onChange: (e) => {
|
|
59
|
+
onChangePreset(e);
|
|
60
|
+
setLocalPreset({ label: e });
|
|
61
|
+
}, theme: theme })] }));
|
|
62
|
+
}
|
|
63
|
+
exports.QuillDateRangePicker = QuillDateRangePicker;
|
|
64
|
+
function CalendarRow({ theme, anchorStartDate, anchorEndDate, setAnchorStartDate, setAnchorEndDate, localStartDate, localEndDate, setLocalStartDate, setLocalEndDate, updateDateFilter, setLocalPreset, setShowModal, }) {
|
|
65
|
+
const modalRef = (0, react_1.useRef)(null);
|
|
66
|
+
(0, hooks_1.useOnClickOutside)(modalRef, (e) => {
|
|
67
|
+
setShowModal(false);
|
|
68
|
+
});
|
|
69
|
+
const firstMonthDisplayedDates = (0, date_fns_1.eachDayOfInterval)({
|
|
70
|
+
start: (0, date_fns_1.startOfWeek)(anchorStartDate),
|
|
71
|
+
end: (0, date_fns_1.endOfWeek)((0, date_fns_1.endOfMonth)(anchorStartDate)),
|
|
72
|
+
});
|
|
73
|
+
const secondMonthDisplayedDates = (0, date_fns_1.eachDayOfInterval)({
|
|
74
|
+
start: (0, date_fns_1.startOfWeek)((0, date_fns_1.startOfMonth)(anchorEndDate)),
|
|
75
|
+
end: (0, date_fns_1.endOfWeek)(anchorEndDate),
|
|
76
|
+
});
|
|
77
|
+
const incrementAnchorDates = () => {
|
|
78
|
+
setAnchorStartDate((0, date_fns_1.startOfMonth)((0, date_fns_1.addMonths)(anchorStartDate, 1)));
|
|
79
|
+
setAnchorEndDate((0, date_fns_1.endOfMonth)((0, date_fns_1.addMonths)(anchorEndDate, 1)));
|
|
80
|
+
};
|
|
81
|
+
const decrementAnchorDates = () => {
|
|
82
|
+
setAnchorStartDate((0, date_fns_1.startOfMonth)((0, date_fns_1.subMonths)(anchorStartDate, 1)));
|
|
83
|
+
setAnchorEndDate((0, date_fns_1.endOfMonth)((0, date_fns_1.subMonths)(anchorEndDate, 1)));
|
|
84
|
+
};
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: modalRef, style: { position: 'absolute', zIndex: 100, marginTop: 12 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
86
|
+
display: 'flex',
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
border: `1px solid ${theme.borderColor}`,
|
|
89
|
+
borderRadius: 6,
|
|
90
|
+
boxShadow: '0px 2px 6px #e7e7e7',
|
|
91
|
+
backgroundColor: theme.backgroundColor,
|
|
92
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
93
|
+
display: 'flex',
|
|
94
|
+
flexDirection: 'column',
|
|
95
|
+
padding: 12,
|
|
96
|
+
// border: "1px solid #e7e7e7",
|
|
97
|
+
// borderRadius: 6,
|
|
98
|
+
// boxShadow: "0px 2px 6px #e7e7e7",
|
|
99
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
flexDirection: 'row',
|
|
102
|
+
position: 'relative',
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
height: 40,
|
|
106
|
+
marginBottom: 10,
|
|
107
|
+
}, children: [(0, jsx_runtime_1.jsxs)("button", { onClick: decrementAnchorDates, style: {
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
left: 0,
|
|
110
|
+
height: 32,
|
|
111
|
+
width: 32,
|
|
112
|
+
borderWidth: theme.borderWidth,
|
|
113
|
+
borderColor: theme.borderColor,
|
|
114
|
+
fontFamily: theme.fontFamily,
|
|
115
|
+
borderStyle: 'solid',
|
|
116
|
+
borderRadius: 6,
|
|
117
|
+
display: 'flex',
|
|
118
|
+
flexDirection: 'row',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
justifyContent: 'center',
|
|
121
|
+
}, className: "quill-calendar-button", children: [(0, jsx_runtime_1.jsx)("style", { children: `.quill-calendar-button { background-color: ${theme.backgroundColor}; } .quill-calendar-button:hover { background-color: ${theme.hoverBackgroundColor}; }` }), (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: theme.chartLabelColor, height: "24px", width: "24px", children: (0, jsx_runtime_1.jsx)("path", { d: "M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z" }) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
122
|
+
fontFamily: theme.fontFamily,
|
|
123
|
+
fontSize: 14,
|
|
124
|
+
color: theme.primaryTextColor,
|
|
125
|
+
fontWeight: 600,
|
|
126
|
+
}, children: (0, date_fns_1.format)(anchorStartDate, 'MMM yyyy') })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
127
|
+
display: 'grid',
|
|
128
|
+
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
129
|
+
rowGap: 8,
|
|
130
|
+
}, children: firstMonthDisplayedDates.map((date) => ((0, jsx_runtime_1.jsx)(DayPicker, { theme: theme, date: date, localStartDate: localStartDate, localEndDate: localEndDate, setLocalStartDate: setLocalStartDate, setLocalEndDate: setLocalEndDate, setLocalPreset: setLocalPreset, updateDateFilter: updateDateFilter }, 'first-' + date.toISOString()))) })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column',
|
|
133
|
+
padding: 12,
|
|
134
|
+
// border: "1px solid #e7e7e7",
|
|
135
|
+
// borderRadius: 6,
|
|
136
|
+
// boxShadow: "0px 2px 6px #e7e7e7",
|
|
137
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
138
|
+
display: 'flex',
|
|
139
|
+
flexDirection: 'row',
|
|
140
|
+
position: 'relative',
|
|
141
|
+
justifyContent: 'center',
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
height: 40,
|
|
144
|
+
marginBottom: 10,
|
|
145
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
146
|
+
fontFamily: theme.fontFamily,
|
|
147
|
+
fontSize: 14,
|
|
148
|
+
color: theme.primaryTextColor,
|
|
149
|
+
fontWeight: 600,
|
|
150
|
+
}, children: (0, date_fns_1.format)(anchorEndDate, 'MMM yyyy') }), (0, jsx_runtime_1.jsxs)("button", { onClick: incrementAnchorDates, style: {
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
right: 0,
|
|
153
|
+
height: 32,
|
|
154
|
+
width: 32,
|
|
155
|
+
borderWidth: theme.borderWidth,
|
|
156
|
+
borderColor: theme.borderColor,
|
|
157
|
+
borderStyle: 'solid',
|
|
158
|
+
borderRadius: 6,
|
|
159
|
+
display: 'flex',
|
|
160
|
+
flexDirection: 'row',
|
|
161
|
+
alignItems: 'center',
|
|
162
|
+
justifyContent: 'center',
|
|
163
|
+
}, className: "quill-calendar-button", children: [(0, jsx_runtime_1.jsx)("style", { children: `.quill-calendar-button { background-color: ${theme.backgroundColor}; } .quill-calendar-button:hover { background-color: ${theme.hoverBackgroundColor}; }` }), (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: theme.chartLabelColor, height: "24px", width: "24px", children: (0, jsx_runtime_1.jsx)("path", { d: "M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z" }) })] })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
164
|
+
display: 'grid',
|
|
165
|
+
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
166
|
+
rowGap: 8,
|
|
167
|
+
}, children: secondMonthDisplayedDates.map((date) => ((0, jsx_runtime_1.jsx)(DayPicker, { theme: theme, date: date, localStartDate: localStartDate, localEndDate: localEndDate, setLocalStartDate: setLocalStartDate, setLocalEndDate: setLocalEndDate, setLocalPreset: setLocalPreset, updateDateFilter: updateDateFilter }, 'second-' + date.toISOString()))) })] })] }) }));
|
|
168
|
+
}
|
|
169
|
+
function DayPicker({ date, localStartDate, setLocalStartDate, localEndDate, setLocalEndDate, updateDateFilter, setLocalPreset, theme, }) {
|
|
170
|
+
// USE ZERO FOR UNDEFINED DATES
|
|
171
|
+
const isStartDate = (0, date_fns_1.differenceInDays)((0, date_fns_1.startOfDay)(date), (0, date_fns_1.startOfDay)(localStartDate || 0)) === 0;
|
|
172
|
+
const isEndDate = (0, date_fns_1.differenceInDays)((0, date_fns_1.startOfDay)(date), (0, date_fns_1.startOfDay)(localEndDate || 0)) === 0;
|
|
173
|
+
const isBetweenStartAndEnd = (0, date_fns_1.isBefore)(date, localEndDate || 0) && (0, date_fns_1.isAfter)(date, localStartDate || 0);
|
|
174
|
+
const isBeginningOfWeek = (0, date_fns_1.differenceInDays)((0, date_fns_1.startOfWeek)(date), date) === 0;
|
|
175
|
+
const isEndOfWeek = (0, date_fns_1.differenceInDays)((0, date_fns_1.endOfWeek)(date), date) === 0;
|
|
176
|
+
return ((0, jsx_runtime_1.jsx)("button", { style: {
|
|
177
|
+
height: 36,
|
|
178
|
+
width: 36,
|
|
179
|
+
display: 'flex',
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
justifyContent: 'center',
|
|
182
|
+
fontFamily: theme.fontFamily,
|
|
183
|
+
fontSize: 14,
|
|
184
|
+
border: 'none',
|
|
185
|
+
color: isStartDate || isEndDate ? 'white' : theme.secondaryTextColor,
|
|
186
|
+
borderTopLeftRadius: isStartDate || isEndDate || isBeginningOfWeek ? 6 : 0,
|
|
187
|
+
borderBottomLeftRadius: isStartDate || isEndDate || isBeginningOfWeek ? 6 : 0,
|
|
188
|
+
borderTopRightRadius: isStartDate || isEndDate || isEndOfWeek ? 6 : 0,
|
|
189
|
+
borderBottomRightRadius: isStartDate || isEndDate || isEndOfWeek ? 6 : 0,
|
|
190
|
+
backgroundColor: isStartDate || isEndDate
|
|
191
|
+
? theme.primaryTextColor
|
|
192
|
+
: isBetweenStartAndEnd
|
|
193
|
+
? theme.hoverBackgroundColor
|
|
194
|
+
: theme.backgroundColor,
|
|
195
|
+
}, onClick: () => {
|
|
196
|
+
if (!localStartDate) {
|
|
197
|
+
setLocalStartDate(date);
|
|
198
|
+
}
|
|
199
|
+
if (localStartDate && !localEndDate) {
|
|
200
|
+
setLocalEndDate(date);
|
|
201
|
+
updateDateFilter({
|
|
202
|
+
startDate: localStartDate,
|
|
203
|
+
endDate: date,
|
|
204
|
+
});
|
|
205
|
+
setLocalPreset({ label: '' });
|
|
206
|
+
}
|
|
207
|
+
if (localStartDate && localEndDate && (0, date_fns_1.isAfter)(date, localStartDate)) {
|
|
208
|
+
setLocalEndDate(date);
|
|
209
|
+
updateDateFilter({
|
|
210
|
+
startDate: localStartDate,
|
|
211
|
+
endDate: date,
|
|
212
|
+
});
|
|
213
|
+
setLocalPreset({ label: '' });
|
|
214
|
+
}
|
|
215
|
+
if (localStartDate && localEndDate && (0, date_fns_1.isBefore)(date, localStartDate)) {
|
|
216
|
+
setLocalStartDate(date);
|
|
217
|
+
updateDateFilter({
|
|
218
|
+
startDate: date,
|
|
219
|
+
endDate: localEndDate,
|
|
220
|
+
});
|
|
221
|
+
setLocalPreset({ label: '' });
|
|
222
|
+
}
|
|
223
|
+
if (localStartDate &&
|
|
224
|
+
localEndDate &&
|
|
225
|
+
(0, date_fns_1.differenceInDays)((0, date_fns_1.startOfDay)(date), (0, date_fns_1.startOfDay)(localStartDate)) === 0) {
|
|
226
|
+
setLocalStartDate(undefined);
|
|
227
|
+
setLocalEndDate(undefined);
|
|
228
|
+
}
|
|
229
|
+
}, children: (0, date_fns_1.format)(date, 'd') }));
|
|
230
|
+
}
|
|
231
|
+
function getAnchorStartDate(startDate, endDate) {
|
|
232
|
+
if (!startDate && !endDate) {
|
|
233
|
+
return (0, date_fns_1.startOfMonth)((0, date_fns_1.subMonths)(new Date(), 1));
|
|
234
|
+
}
|
|
235
|
+
if (startDate && !endDate) {
|
|
236
|
+
return (0, date_fns_1.startOfMonth)(startDate);
|
|
237
|
+
}
|
|
238
|
+
if (!startDate && endDate) {
|
|
239
|
+
return (0, date_fns_1.startOfMonth)((0, date_fns_1.subMonths)(endDate, 1));
|
|
240
|
+
}
|
|
241
|
+
if (startDate && endDate) {
|
|
242
|
+
return (0, date_fns_1.startOfMonth)(startDate);
|
|
243
|
+
}
|
|
244
|
+
return new Date();
|
|
245
|
+
}
|
|
246
|
+
function getAnchorEndDate(startDate, endDate) {
|
|
247
|
+
if (!startDate && !endDate) {
|
|
248
|
+
return (0, date_fns_1.endOfMonth)(new Date());
|
|
249
|
+
}
|
|
250
|
+
if (startDate && !endDate) {
|
|
251
|
+
return (0, date_fns_1.endOfMonth)((0, date_fns_1.addMonths)(startDate, 1));
|
|
252
|
+
}
|
|
253
|
+
if (!startDate && endDate) {
|
|
254
|
+
return (0, date_fns_1.endOfMonth)(endDate);
|
|
255
|
+
}
|
|
256
|
+
if (startDate && endDate) {
|
|
257
|
+
return (0, date_fns_1.endOfMonth)((0, date_fns_1.addMonths)(startDate, 1));
|
|
258
|
+
}
|
|
259
|
+
return new Date();
|
|
260
|
+
}
|
|
@@ -17,7 +17,10 @@ type QuillDateRange = {
|
|
|
17
17
|
* key ending on today.
|
|
18
18
|
*/
|
|
19
19
|
export declare const PRIMARY_RANGE: {
|
|
20
|
-
[key: string]: QuillDateRange |
|
|
20
|
+
[key: string]: QuillDateRange | {
|
|
21
|
+
start: undefined;
|
|
22
|
+
end: undefined;
|
|
23
|
+
};
|
|
21
24
|
};
|
|
22
25
|
/**
|
|
23
26
|
* Maps between the keys of primary range and the short code.
|
|
@@ -25,6 +28,10 @@ export declare const PRIMARY_RANGE: {
|
|
|
25
28
|
export declare const PRIMARY_CODES: {
|
|
26
29
|
[key: keyof typeof PRIMARY_RANGE]: string;
|
|
27
30
|
};
|
|
31
|
+
export declare const COMPARISON_OPTIONS: {
|
|
32
|
+
value: string;
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
28
35
|
/**
|
|
29
36
|
* A helpful map between comparison range keys and a function that takes the
|
|
30
37
|
* start date of the primary range (which is also the end date for our
|
|
@@ -50,9 +57,21 @@ export declare const COMPARISON_RANGE: {
|
|
|
50
57
|
readonly NO_COMPARISON: (_: any) => null;
|
|
51
58
|
};
|
|
52
59
|
export type ComparisonRangeKey = keyof typeof COMPARISON_RANGE;
|
|
60
|
+
export declare const defaultOptionsV2: any[];
|
|
53
61
|
export declare const defaultOptions: DateRangePickerOption[];
|
|
54
62
|
export declare const reportBuilderOptions: DateRangePickerOption[];
|
|
55
63
|
export declare const getRangeFromPreset: (preset: string) => (string | Date | null)[];
|
|
64
|
+
export declare const getRangeFromPresetOptions: (preset: string, presetOptions: {
|
|
65
|
+
label: string;
|
|
66
|
+
startDate: Date;
|
|
67
|
+
endDate: Date;
|
|
68
|
+
}[]) => {
|
|
69
|
+
start: Date;
|
|
70
|
+
end: Date;
|
|
71
|
+
} | {
|
|
72
|
+
start: null;
|
|
73
|
+
end: null;
|
|
74
|
+
};
|
|
56
75
|
export declare const getDateStyles: (theme: any, date: Date, finalStartDate: Date | null, finalEndDate: Date | null, hoveredDate: Date | undefined, isDateDisabled: boolean) => any;
|
|
57
76
|
export declare const displaySelected: (selectedStartDay: Date | null, selectedEndDay: Date | null) => string | undefined;
|
|
58
77
|
export declare const formatSelectedDates: (startDate: Date | null, endDate: Date | null, locale?: Locale) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangePickerUtils.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/dateRangePickerUtils.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,WAAW,WAAY,MAAM,aAKzC,CAAC;AAEF,eAAO,MAAM,UAAU,MAAO,MAAM,UAAU,MAAM,WAEnD,CAAC;AAEF,eAAO,MAAM,2BAA2B,kBACvB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,gBAU1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,kBACrB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,SAU1C,CAAC;AAEF,eAAO,MAAM,cAAc,cACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACzB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBAWzC,CAAC;AAEF,eAAO,MAAM,YAAY,YACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACvB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBASzC,CAAC;AAEF;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI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aAAa,GAAG,MAAM,CAAA;CAStE,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,EAqBA,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;2CACG,cAAc;;;;sCAInB,cAAc;;;;uCAIb,cAAc;;;;uCAId,cAAc;;;;gCAIrB,GAAG;CACd,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAE/D,eAAO,MAAM,gBAAgB,EAAE,GAAG,EAiDjC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,qBAAqB,EAyCjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,qBAAqB,EA+BvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,MAAM,6BAOhD,CAAC;AAEF,eAAO,MAAM,yBAAyB,WAC5B,MAAM,iBACC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,EAAE;;;;;;CAQnE,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,GAAG,QACJ,IAAI,kBACM,IAAI,GAAG,IAAI,gBACb,IAAI,GAAG,IAAI,eACZ,IAAI,GAAG,SAAS,kBACb,OAAO,QAgCxB,CAAC;AAkGF,eAAO,MAAM,eAAe,qBACR,IAAI,GAAG,IAAI,kBACb,IAAI,GAAG,IAAI,uBA0C5B,CAAC;AAyHF,eAAO,MAAM,mBAAmB,cACnB,IAAI,GAAG,IAAI,WACb,IAAI,GAAG,IAAI,WACX,MAAM,WAyChB,CAAC;;AAEF,yEAAyE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatSelectedDates = exports.displaySelected = exports.getDateStyles = exports.getRangeFromPreset = exports.reportBuilderOptions = exports.defaultOptions = exports.COMPARISON_RANGE = exports.PRIMARY_CODES = exports.PRIMARY_RANGE = exports.parseEndDate = exports.parseStartDate = exports.getEndDateByDropdownValue = exports.getStartDateByDropdownValue = exports.capitalize = exports.getWeekdays = void 0;
|
|
3
|
+
exports.formatSelectedDates = exports.displaySelected = exports.getDateStyles = exports.getRangeFromPresetOptions = exports.getRangeFromPreset = exports.reportBuilderOptions = exports.defaultOptions = exports.defaultOptionsV2 = exports.COMPARISON_RANGE = exports.COMPARISON_OPTIONS = exports.PRIMARY_CODES = exports.PRIMARY_RANGE = exports.parseEndDate = exports.parseStartDate = exports.getEndDateByDropdownValue = exports.getStartDateByDropdownValue = exports.capitalize = exports.getWeekdays = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
const BarList_1 = require("../BarList");
|
|
6
6
|
const getWeekdays = (locale) => {
|
|
@@ -60,8 +60,11 @@ exports.PRIMARY_RANGE = {
|
|
|
60
60
|
LAST_7_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 7 }), end: (0, date_fns_1.endOfToday)() },
|
|
61
61
|
LAST_30_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }), end: (0, date_fns_1.endOfToday)() },
|
|
62
62
|
LAST_90_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }), end: (0, date_fns_1.endOfToday)() },
|
|
63
|
-
LAST_6_MONTHS: {
|
|
64
|
-
|
|
63
|
+
LAST_6_MONTHS: {
|
|
64
|
+
start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { months: 6 }),
|
|
65
|
+
end: (0, date_fns_1.endOfToday)(),
|
|
66
|
+
},
|
|
67
|
+
ALL_TIME: { start: undefined, end: undefined },
|
|
65
68
|
};
|
|
66
69
|
/**
|
|
67
70
|
* Maps between the keys of primary range and the short code.
|
|
@@ -76,6 +79,28 @@ exports.PRIMARY_CODES = {
|
|
|
76
79
|
LAST_6_MONTHS: '6m',
|
|
77
80
|
ALL_TIME: 'at',
|
|
78
81
|
};
|
|
82
|
+
exports.COMPARISON_OPTIONS = [
|
|
83
|
+
{
|
|
84
|
+
value: 'PREV_PERIOD',
|
|
85
|
+
text: 'Previous Period',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: 'PREV_7_DAYS',
|
|
89
|
+
text: 'Previous 7 days',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
value: 'PREV_30_DAYS',
|
|
93
|
+
text: 'Previous 30 days',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
value: 'PREV_90_DAYS',
|
|
97
|
+
text: 'Previous 90 days',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
value: 'NO_COMPARISON',
|
|
101
|
+
text: 'No comparison',
|
|
102
|
+
},
|
|
103
|
+
];
|
|
79
104
|
/**
|
|
80
105
|
* A helpful map between comparison range keys and a function that takes the
|
|
81
106
|
* start date of the primary range (which is also the end date for our
|
|
@@ -100,6 +125,56 @@ exports.COMPARISON_RANGE = {
|
|
|
100
125
|
}),
|
|
101
126
|
NO_COMPARISON: (_) => null,
|
|
102
127
|
};
|
|
128
|
+
exports.defaultOptionsV2 = [
|
|
129
|
+
{
|
|
130
|
+
value: 'THIS_WEEK',
|
|
131
|
+
label: 'This week',
|
|
132
|
+
startDate: exports.PRIMARY_RANGE['THIS_WEEK']?.start,
|
|
133
|
+
endDate: exports.PRIMARY_RANGE['THIS_WEEK']?.end,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
value: 'THIS_MONTH',
|
|
137
|
+
label: 'This month',
|
|
138
|
+
startDate: exports.PRIMARY_RANGE['THIS_MONTH']?.start,
|
|
139
|
+
endDate: exports.PRIMARY_RANGE['THIS_MONTH']?.end,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: 'THIS_YEAR',
|
|
143
|
+
label: 'This year',
|
|
144
|
+
startDate: exports.PRIMARY_RANGE['THIS_YEAR']?.start,
|
|
145
|
+
endDate: exports.PRIMARY_RANGE['THIS_YEAR']?.end,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
value: 'LAST_7_DAYS',
|
|
149
|
+
label: 'Last 7 days',
|
|
150
|
+
startDate: exports.PRIMARY_RANGE['LAST_7_DAYS']?.start,
|
|
151
|
+
endDate: exports.PRIMARY_RANGE['LAST_7_DAYS']?.end,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
value: 'LAST_30_DAYS',
|
|
155
|
+
label: 'Last 30 days',
|
|
156
|
+
startDate: exports.PRIMARY_RANGE['LAST_30_DAYS']?.start,
|
|
157
|
+
endDate: exports.PRIMARY_RANGE['LAST_30_DAYS']?.end,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
value: 'LAST_90_DAYS',
|
|
161
|
+
label: 'Last 90 days',
|
|
162
|
+
startDate: exports.PRIMARY_RANGE['LAST_90_DAYS']?.start,
|
|
163
|
+
endDate: exports.PRIMARY_RANGE['LAST_90_DAYS']?.end,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
value: 'LAST_6_MONTHS',
|
|
167
|
+
label: 'Last 6 months',
|
|
168
|
+
startDate: exports.PRIMARY_RANGE['LAST_6_MONTHS']?.start,
|
|
169
|
+
endDate: exports.PRIMARY_RANGE['LAST_6_MONTHS']?.end,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
value: 'ALL_TIME',
|
|
173
|
+
label: 'All time',
|
|
174
|
+
startDate: exports.PRIMARY_RANGE['ALL_TIME']?.start,
|
|
175
|
+
endDate: exports.PRIMARY_RANGE['ALL_TIME']?.end,
|
|
176
|
+
},
|
|
177
|
+
];
|
|
103
178
|
exports.defaultOptions = [
|
|
104
179
|
{
|
|
105
180
|
value: 'wk',
|
|
@@ -176,9 +251,23 @@ exports.reportBuilderOptions = [
|
|
|
176
251
|
];
|
|
177
252
|
const getRangeFromPreset = (preset) => {
|
|
178
253
|
const foundPreset = exports.defaultOptions.find((elem) => elem.value === preset);
|
|
179
|
-
return [
|
|
254
|
+
return [
|
|
255
|
+
foundPreset?.startDate || null,
|
|
256
|
+
(0, date_fns_1.endOfToday)(),
|
|
257
|
+
foundPreset?.value || '',
|
|
258
|
+
];
|
|
180
259
|
};
|
|
181
260
|
exports.getRangeFromPreset = getRangeFromPreset;
|
|
261
|
+
const getRangeFromPresetOptions = (preset, presetOptions) => {
|
|
262
|
+
const foundPreset = presetOptions.find((elem) => elem.label === preset);
|
|
263
|
+
if (foundPreset) {
|
|
264
|
+
return { start: foundPreset?.startDate, end: foundPreset?.endDate };
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
return { start: null, end: null };
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
exports.getRangeFromPresetOptions = getRangeFromPresetOptions;
|
|
182
271
|
const getDateStyles = (theme, date, finalStartDate, finalEndDate, hoveredDate, isDateDisabled) => {
|
|
183
272
|
return {
|
|
184
273
|
...getDayTextClassNames(theme, date, finalStartDate, finalEndDate, hoveredDate, isDateDisabled),
|
|
@@ -51,6 +51,7 @@ export declare const defaultQuillTheme: {
|
|
|
51
51
|
labelFontWeight: number;
|
|
52
52
|
fontSize: number;
|
|
53
53
|
loadingStateBackgroundColor: string;
|
|
54
|
+
hoverBackgroundColor: string;
|
|
54
55
|
};
|
|
55
56
|
declare const QuillProvider: ({ organizationId, publicKey, queryEndpoint, queryHeaders, environment, children, theme, withCredentials, }: QuillProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
57
|
export default QuillProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuillProvider.d.ts","sourceRoot":"","sources":["../../src/QuillProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAGrD,UAAU,sBAAsB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,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 +26,7 @@ exports.defaultQuillTheme = {
|
|
|
26
26
|
labelFontWeight: 500,
|
|
27
27
|
fontSize: 14,
|
|
28
28
|
loadingStateBackgroundColor: '#F9F9FA',
|
|
29
|
+
hoverBackgroundColor: '#F4F4F5',
|
|
29
30
|
};
|
|
30
31
|
const QuillProvider = ({ organizationId, publicKey, queryEndpoint, queryHeaders, environment, children, theme = exports.defaultQuillTheme, withCredentials = false, }) => {
|
|
31
32
|
return ((0, jsx_runtime_1.jsx)(Context_1.ContextProvider, { initialTheme: theme, publicKey: publicKey, environment: environment, customerId: organizationId, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportBuilder.d.ts","sourceRoot":"","sources":["../../src/ReportBuilder.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM,OAAO,CAAC;AAMf,OAAO,EACL,KAAK,EAIN,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"ReportBuilder.d.ts","sourceRoot":"","sources":["../../src/ReportBuilder.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM,OAAO,CAAC;AAMf,OAAO,EACL,KAAK,EAIN,MAAM,sCAAsC,CAAC;AAW9C,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EAEnB,WAAW,EACX,UAAU,EACV,SAAS,EACT,iBAAiB,EAUjB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAEnC,UAAU,kBAAkB;IAC1B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IA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C;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,SAA6B,EAC7B,cAAc,EACd,MAAuB,EACvB,MAAuB,EACvB,eAAyC,EACzC,MAAuB,EACvB,KAAqB,EACrB,YAAmC,EACnC,IAAmB,EACnB,KAAqB,EACrB,OAAyB,EACzB,sBAA8B,EAC9B,oBAA4B,EAC5B,wBAAgC,EAChC,QAAQ,EACR,SAAS,EACT,UAAU,EACV,sBAAsB,EACtB,mBAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,mBAAmB,GACpB,EAAE,kBAAkB,kDA6MpB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,KAAA,sBAgD1C"}
|
|
@@ -13,7 +13,6 @@ const SQLEditor_1 = require("./SQLEditor");
|
|
|
13
13
|
const date_fns_1 = require("date-fns");
|
|
14
14
|
const PivotModal_1 = require("./internals/ReportBuilder/PivotModal");
|
|
15
15
|
const dataFetcher_1 = require("./utils/dataFetcher");
|
|
16
|
-
const Dashboard_1 = require("./Dashboard");
|
|
17
16
|
const dateRangePickerUtils_1 = require("./DateRangePicker/dateRangePickerUtils");
|
|
18
17
|
const Table_1 = __importDefault(require("./Table"));
|
|
19
18
|
const ChartBuilder_1 = __importDefault(require("./ChartBuilder"));
|
|
@@ -923,7 +922,7 @@ const AddFilterModal2 = ({ filters, selectedColumn, numberStart, numberEnd, setD
|
|
|
923
922
|
flexDirection: 'row',
|
|
924
923
|
justifyContent: 'space-between',
|
|
925
924
|
marginTop: 20,
|
|
926
|
-
}, children: (0, jsx_runtime_1.jsx)(
|
|
925
|
+
}, children: (0, jsx_runtime_1.jsx)(QuillDateRangePicker, { dateRange: dateRange ? [dateRange[0], dateRange[1]] : [null, null], label: '', onChangeDateRange: dateRange => {
|
|
927
926
|
setDateRange([dateRange[0], dateRange[1], null]);
|
|
928
927
|
}, preset: dateRange && dateRange.length === 3 && dateRange[2] !== null
|
|
929
928
|
? dateRange[2]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuillSelect.d.ts","sourceRoot":"","sources":["../../../src/components/QuillSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE,oBAAoB,2CAoKtB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuillSelectComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const hooks_1 = require("../hooks");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
function QuillSelectComponent({ options, value, onChange, theme, label, }) {
|
|
8
|
+
const [showModal, setShowModal] = (0, react_1.useState)(false);
|
|
9
|
+
const modalRef = (0, react_1.useRef)(null);
|
|
10
|
+
(0, hooks_1.useOnClickOutside)(modalRef, (e) => {
|
|
11
|
+
setShowModal(false);
|
|
12
|
+
});
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: 200 }, children: [label && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
14
|
+
fontSize: 14,
|
|
15
|
+
color: theme.primaryTextColor,
|
|
16
|
+
fontFamily: theme.fontFamily,
|
|
17
|
+
paddingBottom: 5,
|
|
18
|
+
fontWeight: 600,
|
|
19
|
+
}, children: label })), (0, jsx_runtime_1.jsxs)("button", { style: {
|
|
20
|
+
fontFamily: theme.fontFamily,
|
|
21
|
+
color: theme.primaryTextColor,
|
|
22
|
+
width: '100%',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
fontWeight: 'inherit',
|
|
27
|
+
lineHeight: 'inherit',
|
|
28
|
+
padding: '8px 12px',
|
|
29
|
+
fontSize: 14,
|
|
30
|
+
margin: 0,
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
borderStyle: 'solid',
|
|
34
|
+
borderColor: theme.borderColor,
|
|
35
|
+
borderRadius: 6,
|
|
36
|
+
paddingTop: 9,
|
|
37
|
+
paddingBottom: 9,
|
|
38
|
+
height: 40,
|
|
39
|
+
minHeight: 40,
|
|
40
|
+
maxHeight: 40,
|
|
41
|
+
}, className: "quill-select-button", onClick: () => setShowModal((showModal) => !showModal), children: [(0, jsx_runtime_1.jsx)("style", { children: ` .quill-select-button { background: ${theme.backgroundColor}; } .quill-select-button:hover { background: ${theme.hoverBackgroundColor}; }` }), options.find((elem) => elem.value === value)?.label || 'Select', (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", "data-slot": "icon", height: 20, width: 20, children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z", clipRule: "evenodd" }) })] }), showModal && ((0, jsx_runtime_1.jsxs)("div", { ref: modalRef, style: {
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
width: '100%',
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
boxSizing: 'border-box',
|
|
47
|
+
borderWidth: 1,
|
|
48
|
+
borderStyle: 'solid',
|
|
49
|
+
borderColor: theme.borderColor,
|
|
50
|
+
borderRadius: 6,
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
background: 'white',
|
|
53
|
+
marginTop: 12,
|
|
54
|
+
zIndex: 100,
|
|
55
|
+
paddingTop: 6,
|
|
56
|
+
paddingBottom: 6,
|
|
57
|
+
paddingLeft: 6,
|
|
58
|
+
paddingRight: 6,
|
|
59
|
+
boxShadow: '0px 1px 12px 0px rgba(56, 65, 81, 0.1)',
|
|
60
|
+
fontFamily: theme.fontFamily,
|
|
61
|
+
}, children: [(0, jsx_runtime_1.jsxs)("button", { style: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'space-between',
|
|
65
|
+
padding: '8px 8px',
|
|
66
|
+
margin: 0,
|
|
67
|
+
boxSizing: 'border-box',
|
|
68
|
+
borderWidth: 0,
|
|
69
|
+
fontSize: 14,
|
|
70
|
+
borderStyle: 'solid',
|
|
71
|
+
borderColor: theme.borderColor,
|
|
72
|
+
borderRadius: 4,
|
|
73
|
+
fontFamily: theme.fontFamily,
|
|
74
|
+
}, className: "quill-option", onClick: () => {
|
|
75
|
+
onChange('');
|
|
76
|
+
setShowModal(false);
|
|
77
|
+
}, children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
78
|
+
.quill-option {
|
|
79
|
+
background: white;
|
|
80
|
+
}
|
|
81
|
+
.quill-option:hover {
|
|
82
|
+
background: #F4F4F5;
|
|
83
|
+
}
|
|
84
|
+
` }), 'Select'] }), options.map((option) => ((0, jsx_runtime_1.jsxs)("button", { style: {
|
|
85
|
+
display: 'flex',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
justifyContent: 'space-between',
|
|
88
|
+
padding: '8px 8px',
|
|
89
|
+
margin: 0,
|
|
90
|
+
boxSizing: 'border-box',
|
|
91
|
+
borderWidth: 0,
|
|
92
|
+
fontSize: 14,
|
|
93
|
+
borderStyle: 'solid',
|
|
94
|
+
borderColor: theme.borderColor,
|
|
95
|
+
borderRadius: 4,
|
|
96
|
+
fontFamily: theme.fontFamily,
|
|
97
|
+
}, className: "quill-option", onClick: () => {
|
|
98
|
+
onChange(option.value);
|
|
99
|
+
setShowModal(false);
|
|
100
|
+
}, children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
101
|
+
.quill-option {
|
|
102
|
+
background: white;
|
|
103
|
+
}
|
|
104
|
+
.quill-option:hover {
|
|
105
|
+
background: #F4F4F5;
|
|
106
|
+
}
|
|
107
|
+
` }), option.label] }, option.value)))] }))] }));
|
|
108
|
+
}
|
|
109
|
+
exports.QuillSelectComponent = QuillSelectComponent;
|