@quillsql/react 2.8.8 → 2.8.9
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 +146 -181
- package/dist/BarList.js +36 -44
- package/dist/Chart.d.ts +0 -5
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +94 -276
- package/dist/ChartBuilder.d.ts +1 -0
- package/dist/ChartBuilder.d.ts.map +1 -1
- package/dist/ChartBuilder.js +96 -93
- package/dist/ChartEditor.d.ts +2 -1
- package/dist/ChartEditor.d.ts.map +1 -1
- package/dist/ChartEditor.js +14 -21
- package/dist/Context.js +52 -57
- package/dist/Dashboard.d.ts.map +1 -1
- package/dist/Dashboard.js +181 -213
- package/dist/DateRangePicker/Calendar.js +41 -46
- package/dist/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/DateRangePicker/DateRangePicker.js +33 -62
- package/dist/DateRangePicker/DateRangePickerButton.js +14 -17
- package/dist/DateRangePicker/dateRangePickerUtils.js +76 -90
- package/dist/DateRangePicker/index.js +1 -9
- package/dist/PieChart.js +35 -70
- package/dist/QuillProvider.js +4 -7
- package/dist/ReportBuilder.js +120 -129
- package/dist/SQLEditor.d.ts +5 -1
- package/dist/SQLEditor.d.ts.map +1 -1
- package/dist/SQLEditor.js +82 -89
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +64 -66
- package/dist/TableChart.js +17 -45
- package/dist/assets/ArrowDownHeadIcon.js +3 -6
- package/dist/assets/ArrowDownIcon.js +3 -6
- package/dist/assets/ArrowDownRightIcon.js +3 -6
- package/dist/assets/ArrowLeftHeadIcon.js +3 -6
- package/dist/assets/ArrowRightHeadIcon.js +3 -6
- package/dist/assets/ArrowRightIcon.js +3 -6
- package/dist/assets/ArrowUpHeadIcon.js +3 -6
- package/dist/assets/ArrowUpIcon.js +3 -6
- package/dist/assets/ArrowUpRightIcon.js +3 -6
- package/dist/assets/CalendarIcon.js +3 -6
- package/dist/assets/CalendarNormalIcon.js +3 -6
- package/dist/assets/DoubleArrowLeftHeadIcon.js +3 -6
- package/dist/assets/DoubleArrowRightHeadIcon.js +3 -6
- package/dist/assets/ExclamationFilledIcon.js +3 -6
- package/dist/assets/FilterIcon.js +3 -6
- package/dist/assets/LoadingSpinner.js +3 -6
- package/dist/assets/RefreshIcon.js +3 -6
- package/dist/assets/SearchIcon.js +3 -6
- package/dist/assets/UpLeftArrowsIcon.js +3 -6
- package/dist/assets/XCircleIcon.js +3 -6
- package/dist/assets/XIcon.js +3 -6
- package/dist/assets/index.js +21 -49
- package/dist/components/Banner/index.d.ts +3 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +24 -0
- package/dist/components/BigModal/BigModal.js +13 -39
- package/dist/components/Dropdown/Dropdown.js +24 -53
- package/dist/components/Dropdown/DropdownItem.js +9 -35
- package/dist/components/Dropdown/index.js +2 -11
- package/dist/components/Modal/Modal.js +13 -39
- package/dist/components/Modal/index.js +1 -9
- package/dist/components/QuillCard.js +8 -13
- package/dist/components/ReportBuilder/ColumnSelector.d.ts +19 -0
- package/dist/components/ReportBuilder/ColumnSelector.d.ts.map +1 -0
- package/dist/components/ReportBuilder/ColumnSelector.js +87 -0
- package/dist/components/SqlTextEditor.d.ts.map +1 -1
- package/dist/components/SqlTextEditor.js +30 -13
- package/dist/components/UiComponents.d.ts.map +1 -1
- package/dist/components/UiComponents.js +40 -53
- package/dist/components/selectUtils.js +6 -17
- package/dist/contexts/BaseColorContext.js +3 -6
- package/dist/contexts/HoveredValueContext.js +3 -6
- package/dist/contexts/RootStylesContext.js +3 -6
- package/dist/contexts/SelectedValueContext.js +3 -6
- package/dist/contexts/index.js +4 -15
- package/dist/hooks/index.js +4 -15
- package/dist/hooks/useDashboard.js +10 -15
- package/dist/hooks/useInternalState.js +3 -6
- package/dist/hooks/useOnClickOutside.js +3 -6
- package/dist/hooks/useOnWindowResize.js +4 -7
- package/dist/hooks/useQuill.js +11 -16
- package/dist/hooks/useSelectOnKeyDown.js +4 -7
- package/dist/index.js +13 -33
- package/dist/internals/ReportBuilder/PivotList.js +14 -20
- package/dist/internals/ReportBuilder/PivotModal.d.ts +2 -2
- package/dist/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/internals/ReportBuilder/PivotModal.js +116 -119
- package/dist/internals/ReportBuilder/PivotModal.spec.js +70 -73
- package/dist/lib/font.js +2 -6
- package/dist/lib/index.js +3 -20
- package/dist/lib/inputTypes.js +1 -3
- package/dist/lib/utils.js +8 -19
- package/dist/test-data/tables.d.ts +2 -0
- package/dist/test-data/tables.d.ts.map +1 -0
- package/dist/test-data/tables.js +621 -0
- package/dist/utils/aggregate.js +28 -35
- package/dist/utils/axisFormatter.d.ts +20 -0
- package/dist/utils/axisFormatter.d.ts.map +1 -0
- package/dist/utils/axisFormatter.js +185 -0
- package/dist/utils/colorToHex.js +1 -5
- package/dist/utils/dataFetcher.js +2 -8
- package/dist/utils/downloadCSV.js +1 -6
- package/dist/utils/schema.d.ts +22 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +134 -0
- package/dist/utils/textFormatting.d.ts +4 -0
- package/dist/utils/textFormatting.d.ts.map +1 -0
- package/dist/utils/textFormatting.js +38 -0
- package/dist/utils/valueFormatter.d.ts +17 -0
- package/dist/utils/valueFormatter.d.ts.map +1 -0
- package/dist/utils/valueFormatter.js +166 -0
- package/dist/utils/valueFormatterCSV.d.ts +17 -0
- package/dist/utils/valueFormatterCSV.d.ts.map +1 -0
- package/dist/utils/valueFormatterCSV.js +90 -0
- package/package.json +1 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Field = {
|
|
2
|
+
_id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
field: string;
|
|
5
|
+
format: 'percent';
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
value: string | number | boolean | undefined | null;
|
|
9
|
+
field: string | undefined | null;
|
|
10
|
+
fields: Field[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Pretty-prints the given values to their nice-looking string form.
|
|
14
|
+
*/
|
|
15
|
+
export declare const valueFormatter: ({ value, field, fields, }: Props) => string | number | boolean;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=valueFormatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../src/utils/valueFormatter.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,8BAIxB,KAAK,KAAG,MAAM,GAAG,MAAM,GAAG,OA+B5B,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { endOfWeek, format, getWeek, isValid, startOfWeek } from 'date-fns';
|
|
2
|
+
import { utcToZonedTime } from 'date-fns-tz';
|
|
3
|
+
/**
|
|
4
|
+
* Pretty-prints the given values to their nice-looking string form.
|
|
5
|
+
*/
|
|
6
|
+
export const valueFormatter = ({ value, field, fields, }) => {
|
|
7
|
+
if (field === undefined || field === null)
|
|
8
|
+
return '';
|
|
9
|
+
if (value === undefined || value === null)
|
|
10
|
+
return '';
|
|
11
|
+
const fieldInfo = fields.find((f) => f.field === field);
|
|
12
|
+
if (!fieldInfo)
|
|
13
|
+
return '';
|
|
14
|
+
const HANDLERS = {
|
|
15
|
+
percent: formatPercent,
|
|
16
|
+
dollar_amount: formatDollarAmount,
|
|
17
|
+
dollar_cents: formatDollarCents,
|
|
18
|
+
whole_number: formatWholeNumber,
|
|
19
|
+
one_decimal_place: formatOneDecimalPlace,
|
|
20
|
+
two_decimal_places: formatTwoDecimalPlaces,
|
|
21
|
+
string: formatString,
|
|
22
|
+
yyyy: format_YYYY,
|
|
23
|
+
MMM_yyyy: format_MMM_yyyy,
|
|
24
|
+
MMM_dd_yyyy: format_MMM_dd_yyyy,
|
|
25
|
+
hh_ap_pm: format_hh_ap_pm,
|
|
26
|
+
'MMM_dd-MMM_dd': format_MMM_dd_MMM_dd,
|
|
27
|
+
'MMM_dd_hh:mm_ap_pm': format_MMM_dd_hh_mm_ap_pm,
|
|
28
|
+
'wo, yyyy': format_wo_yyyy,
|
|
29
|
+
};
|
|
30
|
+
// try to handle this value using the associated formatType handler
|
|
31
|
+
const formatType = fieldInfo.format;
|
|
32
|
+
if (Object.keys(HANDLERS).includes(formatType)) {
|
|
33
|
+
return HANDLERS[formatType](value);
|
|
34
|
+
}
|
|
35
|
+
return value.toString(); // by default make this value a string
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* HELPER FUNCTION DEFINITIONS
|
|
39
|
+
**/
|
|
40
|
+
/**
|
|
41
|
+
* Formats the value as a string using the built-in converstion.
|
|
42
|
+
*/
|
|
43
|
+
const formatString = (value) => value.toString();
|
|
44
|
+
/**
|
|
45
|
+
* Formats the value as a (rounded) currency amount in dollars.
|
|
46
|
+
*
|
|
47
|
+
* eg. @example format(1234.567) => "$1,235"
|
|
48
|
+
*/
|
|
49
|
+
const formatDollarAmount = (value) => {
|
|
50
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
51
|
+
style: 'currency',
|
|
52
|
+
currency: 'USD',
|
|
53
|
+
maximumFractionDigits: 0,
|
|
54
|
+
});
|
|
55
|
+
return formatter.format(Number(value ?? 0));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Formats the value as a (rounded) currency amount in dollars and cents.
|
|
59
|
+
*
|
|
60
|
+
* @example format(1234.567) => "$1,234.57"
|
|
61
|
+
*/
|
|
62
|
+
const formatDollarCents = (value) => {
|
|
63
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
64
|
+
style: 'currency',
|
|
65
|
+
currency: 'USD',
|
|
66
|
+
minimumFractionDigits: 2,
|
|
67
|
+
maximumFractionDigits: 2,
|
|
68
|
+
});
|
|
69
|
+
return formatter.format(Number(value ?? 0));
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Formats the value as a (rounded) integer.
|
|
73
|
+
*
|
|
74
|
+
* @example format(1234.567) => "1,235"
|
|
75
|
+
*/
|
|
76
|
+
const formatWholeNumber = (value) => {
|
|
77
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
78
|
+
maximumFractionDigits: 0,
|
|
79
|
+
});
|
|
80
|
+
return formatter.format(Number(value));
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Formats the value as a number rounded to exactly one decimal place.
|
|
84
|
+
*
|
|
85
|
+
* @example format(1234.567) => "1,234.6"
|
|
86
|
+
*/
|
|
87
|
+
const formatOneDecimalPlace = (value) => {
|
|
88
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
89
|
+
minimumFractionDigits: 1,
|
|
90
|
+
maximumFractionDigits: 1,
|
|
91
|
+
});
|
|
92
|
+
return formatter.format(Number(value));
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Formats the value as a number rounded to exactly two decimal places.
|
|
96
|
+
*
|
|
97
|
+
* @example format(1234.567) => "1,234.57"
|
|
98
|
+
*/
|
|
99
|
+
const formatTwoDecimalPlaces = (value) => {
|
|
100
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
101
|
+
minimumFractionDigits: 2,
|
|
102
|
+
maximumFractionDigits: 2,
|
|
103
|
+
});
|
|
104
|
+
return formatter.format(Number(value));
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Formats the value as a percentage.
|
|
108
|
+
*
|
|
109
|
+
* @example format(0.1234) => "12.34%"
|
|
110
|
+
* @example format(0.99) => "99.00%"
|
|
111
|
+
*
|
|
112
|
+
* NOTE: This function expects that the value is already a percentage value, and
|
|
113
|
+
* does not try to guess whether the percentage is represented as a whole number
|
|
114
|
+
* or a decimal.
|
|
115
|
+
*
|
|
116
|
+
* @example format(1234.567) => "123,456.70%"
|
|
117
|
+
* @example format(99) => "9,900.00%"
|
|
118
|
+
*/
|
|
119
|
+
const formatPercent = (value) => {
|
|
120
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
121
|
+
style: 'percent',
|
|
122
|
+
minimumFractionDigits: 2,
|
|
123
|
+
maximumFractionDigits: 2,
|
|
124
|
+
});
|
|
125
|
+
return formatter.format(Number(value));
|
|
126
|
+
};
|
|
127
|
+
// Converts the value to a UTC date with the given format string. If the
|
|
128
|
+
// resulting date is invalid, it returns "Invalid date".
|
|
129
|
+
const _getUTCDateHelper = (value, fmt) => {
|
|
130
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
131
|
+
if (!isValid(utcDate))
|
|
132
|
+
return 'Invalid date';
|
|
133
|
+
return format(utcDate, fmt);
|
|
134
|
+
};
|
|
135
|
+
const format_YYYY = (value) => _getUTCDateHelper(value, 'yyyy');
|
|
136
|
+
const format_MMM_yyyy = (value) => _getUTCDateHelper(value, 'MMM yyyy');
|
|
137
|
+
const format_hh_ap_pm = (value) => _getUTCDateHelper(value, 'hh:mm aa');
|
|
138
|
+
const format_MMM_dd_yyyy = (value) => _getUTCDateHelper(value, 'dd MMM yyyy');
|
|
139
|
+
const format_MMM_dd_MMM_dd = (value) => {
|
|
140
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
141
|
+
if (!isValid(utcDate))
|
|
142
|
+
return 'Invalid date';
|
|
143
|
+
const monday = startOfWeek(utcDate, { weekStartsOn: 1 });
|
|
144
|
+
const sunday = endOfWeek(utcDate, { weekStartsOn: 1 });
|
|
145
|
+
// Check if start and end are in the same month
|
|
146
|
+
if (format(monday, 'MMM') === format(sunday, 'MMM')) {
|
|
147
|
+
return `${format(monday, 'MMM dd')} - ${format(sunday, 'dd')}`;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return `${format(monday, 'MMM dd')} - ${format(sunday, 'MMM dd')}`;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const format_MMM_dd_hh_mm_ap_pm = (value) => {
|
|
154
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
155
|
+
if (!isValid(utcDate))
|
|
156
|
+
return 'Invalid date';
|
|
157
|
+
const formatStr = utcDate.getMinutes() === 0 ? 'MMM do h a' : 'MMM do h:mm a';
|
|
158
|
+
const res = format(utcDate, formatStr);
|
|
159
|
+
return res.slice(0, -2) + res.slice(-2).toLowerCase();
|
|
160
|
+
};
|
|
161
|
+
const format_wo_yyyy = (value) => {
|
|
162
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
163
|
+
if (!isValid(utcDate))
|
|
164
|
+
return 'Invalid date';
|
|
165
|
+
return `${getWeek(utcDate)},${utcDate.getFullYear()}`;
|
|
166
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Field = {
|
|
2
|
+
_id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
field: string;
|
|
5
|
+
format: 'percent';
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
value: string | number | boolean | undefined | null;
|
|
9
|
+
field: string | undefined | null;
|
|
10
|
+
fields: Field[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Formats a value to CSV-format.
|
|
14
|
+
*/
|
|
15
|
+
export declare const valueFormatterCSV: ({ value, field, fields, }: Props) => string | number | boolean;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=valueFormatterCSV.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueFormatterCSV.d.ts","sourceRoot":"","sources":["../../src/utils/valueFormatterCSV.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,8BAI3B,KAAK,KAAG,MAAM,GAAG,MAAM,GAAG,OA+B5B,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { endOfWeek, format, getWeek, isValid, startOfWeek } from 'date-fns';
|
|
2
|
+
import { utcToZonedTime } from 'date-fns-tz';
|
|
3
|
+
/**
|
|
4
|
+
* Formats a value to CSV-format.
|
|
5
|
+
*/
|
|
6
|
+
export const valueFormatterCSV = ({ value, field, fields, }) => {
|
|
7
|
+
if (field === undefined || field === null)
|
|
8
|
+
return '';
|
|
9
|
+
if (value === undefined || value === null)
|
|
10
|
+
return '';
|
|
11
|
+
const fieldInfo = fields.find((f) => f.field === field);
|
|
12
|
+
if (!fieldInfo)
|
|
13
|
+
return '';
|
|
14
|
+
const HANDLERS = {
|
|
15
|
+
percent: formatPercent,
|
|
16
|
+
dollar_amount: formatDollarAmount,
|
|
17
|
+
dollar_cents: formatDollarCents,
|
|
18
|
+
whole_number: formatWholeNumber,
|
|
19
|
+
one_decimal_place: formatOneDecimalPlace,
|
|
20
|
+
two_decimal_places: formatTwoDecimalPlaces,
|
|
21
|
+
string: formatString,
|
|
22
|
+
yyyy: format_YYYY,
|
|
23
|
+
MMM_yyyy: format_MMM_yyyy,
|
|
24
|
+
MMM_dd_yyyy: format_MMM_dd_yyyy,
|
|
25
|
+
hh_ap_pm: format_hh_ap_pm,
|
|
26
|
+
'MMM_dd-MMM_dd': format_MMM_dd_MMM_dd,
|
|
27
|
+
'MMM_dd_hh:mm_ap_pm': format_MMM_dd_hh_mm_ap_pm,
|
|
28
|
+
'wo, yyyy': format_wo_yyyy,
|
|
29
|
+
};
|
|
30
|
+
// try to handle this value using the associated formatType handler
|
|
31
|
+
const formatType = fieldInfo.format;
|
|
32
|
+
if (Object.keys(HANDLERS).includes(formatType)) {
|
|
33
|
+
return HANDLERS[formatType](value);
|
|
34
|
+
}
|
|
35
|
+
return value.toString(); // by default make this value a string
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* HELPER FUNCTION DEFINITIONS
|
|
39
|
+
*/
|
|
40
|
+
const formatString = (value) => value.toString();
|
|
41
|
+
const formatDollarAmount = (value) => Number(value ?? 0);
|
|
42
|
+
const formatDollarCents = (value) => Number(value ?? 0);
|
|
43
|
+
const formatWholeNumber = (value) => Math.round(Number(value));
|
|
44
|
+
const formatOneDecimalPlace = (value) => Number(value).toFixed(1);
|
|
45
|
+
const formatTwoDecimalPlaces = (value) => Number(value).toFixed(2);
|
|
46
|
+
const formatPercent = (value) => {
|
|
47
|
+
const absoluteValue = isNaN(Number(value)) ? 0 : Math.abs(Number(value));
|
|
48
|
+
if (absoluteValue < 1.0) {
|
|
49
|
+
return Number(value);
|
|
50
|
+
}
|
|
51
|
+
return Number(value) / 100.0;
|
|
52
|
+
};
|
|
53
|
+
const _getUTCDateHelper = (value, fmt) => {
|
|
54
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
55
|
+
if (!isValid(utcDate))
|
|
56
|
+
return 'Invalid date';
|
|
57
|
+
return format(utcDate, fmt);
|
|
58
|
+
};
|
|
59
|
+
const format_YYYY = (value) => _getUTCDateHelper(value, 'yyyy');
|
|
60
|
+
const format_MMM_yyyy = (value) => _getUTCDateHelper(value, 'MMM yyyy');
|
|
61
|
+
const format_hh_ap_pm = (value) => _getUTCDateHelper(value, 'hh:mm aa');
|
|
62
|
+
const format_MMM_dd_yyyy = (value) => _getUTCDateHelper(value, 'dd MMM yyyy');
|
|
63
|
+
const format_MMM_dd_MMM_dd = (value) => {
|
|
64
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
65
|
+
if (!isValid(utcDate))
|
|
66
|
+
return 'Invalid date';
|
|
67
|
+
const monday = startOfWeek(utcDate, { weekStartsOn: 1 });
|
|
68
|
+
const sunday = endOfWeek(utcDate, { weekStartsOn: 1 });
|
|
69
|
+
// Check if start and end are in the same month
|
|
70
|
+
if (format(monday, 'MMM') === format(sunday, 'MMM')) {
|
|
71
|
+
return `${format(monday, 'MMM dd')} - ${format(sunday, 'dd')}`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return `${format(monday, 'MMM dd')} - ${format(sunday, 'MMM dd')}`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const format_MMM_dd_hh_mm_ap_pm = (value) => {
|
|
78
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
79
|
+
if (!isValid(utcDate))
|
|
80
|
+
return 'Invalid date';
|
|
81
|
+
const formatStr = utcDate.getMinutes() === 0 ? 'MMM do h a' : 'MMM do h:mm a';
|
|
82
|
+
const res = format(utcDate, formatStr);
|
|
83
|
+
return res.slice(0, -2) + res.slice(-2).toLowerCase();
|
|
84
|
+
};
|
|
85
|
+
const format_wo_yyyy = (value) => {
|
|
86
|
+
const utcDate = utcToZonedTime(new Date(value), 'UTC');
|
|
87
|
+
if (!isValid(utcDate))
|
|
88
|
+
return 'Invalid date';
|
|
89
|
+
return `${getWeek(utcDate)},${utcDate.getFullYear()}`;
|
|
90
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/react",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.9",
|
|
4
4
|
"description": "Quill React components for building dashboards and reporting.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"typescript": "^5.3.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"react": "^18.0.0",
|
|
33
32
|
"react-dom": "^18.0.0"
|
|
34
33
|
},
|
|
35
34
|
"access": "public"
|