@quillsql/react 2.10.4 → 2.10.6

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.
Files changed (120) hide show
  1. package/dist/cjs/Chart.d.ts +2 -2
  2. package/dist/cjs/Chart.d.ts.map +1 -1
  3. package/dist/cjs/Chart.js +22 -30
  4. package/dist/cjs/ChartBuilder.d.ts.map +1 -1
  5. package/dist/cjs/ChartBuilder.js +18 -9
  6. package/dist/cjs/ChartEditor.js +1 -1
  7. package/dist/cjs/Context.d.ts +22 -39
  8. package/dist/cjs/Context.d.ts.map +1 -1
  9. package/dist/cjs/Context.js +11 -9
  10. package/dist/cjs/Dashboard.d.ts +116 -26
  11. package/dist/cjs/Dashboard.d.ts.map +1 -1
  12. package/dist/cjs/Dashboard.js +92 -402
  13. package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts +18 -1
  14. package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
  15. package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +9 -9
  16. package/dist/cjs/SQLEditor.d.ts.map +1 -1
  17. package/dist/cjs/SQLEditor.js +2 -4
  18. package/dist/cjs/Table.d.ts.map +1 -1
  19. package/dist/cjs/Table.js +12 -2
  20. package/dist/cjs/components/Chart/BarChart.d.ts +2 -2
  21. package/dist/cjs/components/Chart/BarChart.js +2 -2
  22. package/dist/cjs/components/Chart/ChartError.d.ts +3 -0
  23. package/dist/cjs/components/Chart/ChartError.d.ts.map +1 -0
  24. package/dist/cjs/components/Chart/ChartError.js +29 -0
  25. package/dist/cjs/components/Chart/ChartSkeleton.d.ts +3 -0
  26. package/dist/cjs/components/Chart/ChartSkeleton.d.ts.map +1 -0
  27. package/dist/cjs/components/Chart/ChartSkeleton.js +20 -0
  28. package/dist/cjs/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
  29. package/dist/cjs/components/Chart/ChartTooltipFrame.js +1 -0
  30. package/dist/cjs/components/Chart/LineChart.d.ts +2 -2
  31. package/dist/cjs/components/Chart/LineChart.js +2 -2
  32. package/dist/cjs/components/Dashboard/DashboardGroup.d.ts +3 -0
  33. package/dist/cjs/components/Dashboard/DashboardGroup.d.ts.map +1 -0
  34. package/dist/cjs/components/Dashboard/DashboardGroup.js +16 -0
  35. package/dist/cjs/components/Dashboard/DashboardItem.d.ts +3 -0
  36. package/dist/cjs/components/Dashboard/DashboardItem.d.ts.map +1 -0
  37. package/dist/cjs/components/Dashboard/DashboardItem.js +64 -0
  38. package/dist/cjs/components/Dashboard/DashboardSection.d.ts +3 -0
  39. package/dist/cjs/components/Dashboard/DashboardSection.d.ts.map +1 -0
  40. package/dist/cjs/components/Dashboard/DashboardSection.js +7 -0
  41. package/dist/cjs/hooks/useQuill.d.ts.map +1 -1
  42. package/dist/cjs/hooks/useQuill.js +15 -9
  43. package/dist/cjs/index.d.ts +1 -1
  44. package/dist/cjs/index.d.ts.map +1 -1
  45. package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +1 -1
  46. package/dist/cjs/internals/ReportBuilder/PivotModal.js +1 -1
  47. package/dist/cjs/utils/axisFormatter.d.ts.map +1 -1
  48. package/dist/cjs/utils/axisFormatter.js +7 -18
  49. package/dist/cjs/utils/dashboard.d.ts +12 -0
  50. package/dist/cjs/utils/dashboard.d.ts.map +1 -0
  51. package/dist/cjs/utils/dashboard.js +150 -0
  52. package/dist/cjs/utils/styles.d.ts +17 -0
  53. package/dist/cjs/utils/styles.d.ts.map +1 -0
  54. package/dist/cjs/utils/styles.js +20 -0
  55. package/dist/cjs/utils/valueFormatter.d.ts +1 -1
  56. package/dist/cjs/utils/valueFormatter.d.ts.map +1 -1
  57. package/dist/cjs/utils/valueFormatter.js +7 -18
  58. package/dist/cjs/utils/valueFormatterCSV.d.ts.map +1 -1
  59. package/dist/cjs/utils/valueFormatterCSV.js +7 -15
  60. package/dist/esm/Chart.d.ts +2 -2
  61. package/dist/esm/Chart.d.ts.map +1 -1
  62. package/dist/esm/Chart.js +23 -31
  63. package/dist/esm/ChartBuilder.d.ts.map +1 -1
  64. package/dist/esm/ChartBuilder.js +18 -9
  65. package/dist/esm/ChartEditor.js +1 -1
  66. package/dist/esm/Context.d.ts +22 -39
  67. package/dist/esm/Context.d.ts.map +1 -1
  68. package/dist/esm/Context.js +11 -9
  69. package/dist/esm/Dashboard.d.ts +116 -26
  70. package/dist/esm/Dashboard.d.ts.map +1 -1
  71. package/dist/esm/Dashboard.js +89 -376
  72. package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts +18 -1
  73. package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
  74. package/dist/esm/DateRangePicker/dateRangePickerUtils.js +9 -9
  75. package/dist/esm/SQLEditor.d.ts.map +1 -1
  76. package/dist/esm/SQLEditor.js +2 -4
  77. package/dist/esm/Table.d.ts.map +1 -1
  78. package/dist/esm/Table.js +12 -2
  79. package/dist/esm/components/Chart/BarChart.d.ts +2 -2
  80. package/dist/esm/components/Chart/BarChart.js +2 -2
  81. package/dist/esm/components/Chart/ChartError.d.ts +3 -0
  82. package/dist/esm/components/Chart/ChartError.d.ts.map +1 -0
  83. package/dist/esm/components/Chart/ChartError.js +26 -0
  84. package/dist/esm/components/Chart/ChartSkeleton.d.ts +3 -0
  85. package/dist/esm/components/Chart/ChartSkeleton.d.ts.map +1 -0
  86. package/dist/esm/components/Chart/ChartSkeleton.js +17 -0
  87. package/dist/esm/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
  88. package/dist/esm/components/Chart/ChartTooltipFrame.js +1 -0
  89. package/dist/esm/components/Chart/LineChart.d.ts +2 -2
  90. package/dist/esm/components/Chart/LineChart.js +2 -2
  91. package/dist/esm/components/Dashboard/DashboardGroup.d.ts +3 -0
  92. package/dist/esm/components/Dashboard/DashboardGroup.d.ts.map +1 -0
  93. package/dist/esm/components/Dashboard/DashboardGroup.js +13 -0
  94. package/dist/esm/components/Dashboard/DashboardItem.d.ts +3 -0
  95. package/dist/esm/components/Dashboard/DashboardItem.d.ts.map +1 -0
  96. package/dist/esm/components/Dashboard/DashboardItem.js +61 -0
  97. package/dist/esm/components/Dashboard/DashboardSection.d.ts +3 -0
  98. package/dist/esm/components/Dashboard/DashboardSection.d.ts.map +1 -0
  99. package/dist/esm/components/Dashboard/DashboardSection.js +4 -0
  100. package/dist/esm/hooks/useQuill.d.ts.map +1 -1
  101. package/dist/esm/hooks/useQuill.js +16 -10
  102. package/dist/esm/index.d.ts +1 -1
  103. package/dist/esm/index.d.ts.map +1 -1
  104. package/dist/esm/index.js +1 -1
  105. package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +1 -1
  106. package/dist/esm/internals/ReportBuilder/PivotModal.js +1 -1
  107. package/dist/esm/utils/axisFormatter.d.ts.map +1 -1
  108. package/dist/esm/utils/axisFormatter.js +7 -18
  109. package/dist/esm/utils/dashboard.d.ts +12 -0
  110. package/dist/esm/utils/dashboard.d.ts.map +1 -0
  111. package/dist/esm/utils/dashboard.js +146 -0
  112. package/dist/esm/utils/styles.d.ts +17 -0
  113. package/dist/esm/utils/styles.d.ts.map +1 -0
  114. package/dist/esm/utils/styles.js +16 -0
  115. package/dist/esm/utils/valueFormatter.d.ts +1 -1
  116. package/dist/esm/utils/valueFormatter.d.ts.map +1 -1
  117. package/dist/esm/utils/valueFormatter.js +7 -18
  118. package/dist/esm/utils/valueFormatterCSV.d.ts.map +1 -1
  119. package/dist/esm/utils/valueFormatterCSV.js +7 -15
  120. package/package.json +2 -5
@@ -0,0 +1,146 @@
1
+ import { useContext } from 'react';
2
+ import { valueFormatter } from './valueFormatter';
3
+ import { generatePivotTable, generatePivotTableYAxis, } from '../internals/ReportBuilder/PivotModal';
4
+ import { DashboardFiltersContext } from '../Context';
5
+ /**
6
+ * Returns a cleaned version of the dashboard item we store in state. We clean
7
+ * the dashboard item so that we aren't exposing unnecessary details to the
8
+ * client and also so that we can give the developer using our items a stable
9
+ * interface to build amazing dashboards on top of.
10
+ * @param item
11
+ */
12
+ export function cleanDashboardItem(item) {
13
+ if (!item)
14
+ return undefined;
15
+ const pivotTable = getPivotTable(item);
16
+ const { primaryAggregation, comparisonAggregation, aggregationPercentChange, } = getAggragations(pivotTable, item);
17
+ return {
18
+ id: item._id,
19
+ name: item.name,
20
+ dashboardName: item.dashboardName,
21
+ rows: item.rows,
22
+ compareRows: item.compareRows,
23
+ columns: item.columns,
24
+ chartType: item.chartType,
25
+ dateField: item.dateField,
26
+ pivot: item.pivot,
27
+ primaryAggregation,
28
+ comparisonAggregation,
29
+ aggregationPercentChange,
30
+ yAxisFields: extractPivotedYAxis(pivotTable, item),
31
+ xAxisLabel: item.xAxisLabel,
32
+ xAxisField: item.xAxisField,
33
+ xAxisFormat: item.xAxisFormat,
34
+ order: item.order,
35
+ filtersApplied: item.filtersApplied,
36
+ };
37
+ }
38
+ /**
39
+ * Extracts the aggregations from the item, if any.
40
+ */
41
+ function getAggragations(pivotTable, item) {
42
+ const yAxisFields = extractPivotedYAxis(pivotTable, item);
43
+ const rows = extractPivotedData(pivotTable, item);
44
+ // extract the aggragation for the primary range.
45
+ const mainKey = yAxisFields[0]?.field ?? item.pivot?.valueField;
46
+ const primary = mainKey
47
+ ? rows.reduce((sum, row) => sum + parseFloat(row[mainKey]), 0)
48
+ : 0;
49
+ // extract the aggragation for the comparison range, if applicable.
50
+ const compKey = yAxisFields[1]?.field ?? item.pivot?.valueField;
51
+ const comparison = compKey
52
+ ? rows.reduce((sum, row) => sum + parseFloat(row[compKey]), 0)
53
+ : 0;
54
+ return {
55
+ primaryAggregation: formatAggragation(item, primary),
56
+ comparisonAggregation: formatAggragation(item, comparison),
57
+ aggregationPercentChange: formatPercentageWithSign(comparison, primary),
58
+ };
59
+ }
60
+ /**
61
+ * Applies a valueFormatter to the given value based on the format in the item.
62
+ */
63
+ function formatAggragation(item, value) {
64
+ if (!value)
65
+ return undefined;
66
+ return valueFormatter({
67
+ value,
68
+ field: item.pivot?.valueField,
69
+ fields: item.yAxisFields,
70
+ });
71
+ }
72
+ /**
73
+ * Formats the percentage change from a to b with the sign included.
74
+ */
75
+ function formatPercentageWithSign(a, b) {
76
+ const formatter = new Intl.NumberFormat('en-US', {
77
+ style: 'percent',
78
+ signDisplay: 'exceptZero',
79
+ minimumFractionDigits: 2,
80
+ maximumFractionDigits: 2,
81
+ });
82
+ return formatter.format(Number(b - a));
83
+ }
84
+ /**
85
+ * Extract and transform the data from itemInfo.
86
+ */
87
+ function getPivotTable(itemInfo, config = undefined) {
88
+ if (!itemInfo)
89
+ return [];
90
+ const { dashboardFilters } = useContext(DashboardFiltersContext);
91
+ const dateFilter = Object.values(dashboardFilters ?? {}).find((filter) => filter.filterType == 'date_range');
92
+ const pivot = itemInfo?.pivot || config?.pivot;
93
+ const data = itemInfo ? itemInfo : config;
94
+ return pivot && data?.rows
95
+ ? generatePivotTable(pivot, JSON.parse(JSON.stringify(data.rows)), // deep copy
96
+ dateFilter?.startDate
97
+ ? [dateFilter?.startDate, dateFilter?.endDate, null]
98
+ : [null, null, null], Boolean(dateFilter?.comparisonRange?.startDate), -1, dateFilter?.comparisonRange?.startDate
99
+ ? [
100
+ dateFilter?.comparisonRange.startDate,
101
+ dateFilter?.comparisonRange.endDate,
102
+ null,
103
+ ]
104
+ : [null, null, null])
105
+ : null;
106
+ }
107
+ /**
108
+ * Returns the data list based on whether the table is pivoted and if there is
109
+ * a config value passed into this component.
110
+ */
111
+ function extractPivotedData(pivotTable, item, config = undefined) {
112
+ if (pivotTable)
113
+ return pivotTable.rows;
114
+ if (config) {
115
+ if (config.bucketedRows.length > 0)
116
+ return config.bucketedRows;
117
+ return config.rows;
118
+ }
119
+ return item.rows;
120
+ }
121
+ /**
122
+ * Extracts the yAxis from the pivot table, if one exists.
123
+ */
124
+ function extractPivotedYAxis(pivotTable, itemInfo, config = undefined) {
125
+ if (!pivotTable)
126
+ return [];
127
+ const pivot = itemInfo?.pivot || config?.pivot;
128
+ const yAxisFields = config ? config.yAxisFields : itemInfo?.yAxisFields;
129
+ const pivotTableYAxis = yAxisFields
130
+ ? generatePivotTableYAxis(pivot, pivotTable.columns, yAxisFields?.[0]?.format)
131
+ : null;
132
+ const fields = pivotTableYAxis
133
+ ? pivotTableYAxis
134
+ : config
135
+ ? config.yAxisFields
136
+ : itemInfo.yAxisFields;
137
+ if (fields.length == 1) {
138
+ const sampleField = fields[0];
139
+ fields[fields.length] = {
140
+ ...sampleField,
141
+ field: `comparison_${sampleField.field}`,
142
+ label: `comparison ${sampleField.label}`,
143
+ };
144
+ }
145
+ return fields;
146
+ }
@@ -0,0 +1,17 @@
1
+ import { CSSProperties } from 'react';
2
+ export type StyleInput = string | CSSProperties | undefined;
3
+ export type StyleProps = {
4
+ className: string;
5
+ } | {
6
+ style: CSSProperties;
7
+ } | {};
8
+ /**
9
+ * Converts the given styles to a props object that can be passed directly into
10
+ * a jsx/tsx component. Converts to className if styles is a string, otherwise
11
+ * treats it as CSSProperties.
12
+ *
13
+ * Example:
14
+ * <div {...styleToProps(containerStyle)}>...</div>
15
+ */
16
+ export declare function styleToProps(styles: StyleInput): StyleProps;
17
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG,EAAE,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAO3D"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Converts the given styles to a props object that can be passed directly into
3
+ * a jsx/tsx component. Converts to className if styles is a string, otherwise
4
+ * treats it as CSSProperties.
5
+ *
6
+ * Example:
7
+ * <div {...styleToProps(containerStyle)}>...</div>
8
+ */
9
+ export function styleToProps(styles) {
10
+ if (!styles)
11
+ return {};
12
+ if (typeof styles === 'string') {
13
+ return { className: styles };
14
+ }
15
+ return { style: styles };
16
+ }
@@ -12,6 +12,6 @@ type Props = {
12
12
  /**
13
13
  * Pretty-prints the given values to their nice-looking string form.
14
14
  */
15
- export declare const valueFormatter: ({ value, field, fields, }: Props) => string | number | boolean;
15
+ export declare const valueFormatter: ({ value, field, fields, }: Props) => string;
16
16
  export {};
17
17
  //# sourceMappingURL=valueFormatter.d.ts.map
@@ -1 +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,OAgC5B,CAAC"}
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,MA+BV,CAAC"}
@@ -19,7 +19,6 @@ export const valueFormatter = ({ value, field, fields, }) => {
19
19
  one_decimal_place: formatOneDecimalPlace,
20
20
  two_decimal_places: formatTwoDecimalPlaces,
21
21
  string: formatString,
22
- interval: formatInterval,
23
22
  yyyy: format_YYYY,
24
23
  MMM_yyyy: format_MMM_yyyy,
25
24
  MMM_dd_yyyy: format_MMM_dd_yyyy,
@@ -33,7 +32,7 @@ export const valueFormatter = ({ value, field, fields, }) => {
33
32
  if (Object.keys(HANDLERS).includes(formatType)) {
34
33
  return HANDLERS[formatType](value);
35
34
  }
36
- return value.toString(); // by default make this value a string
35
+ return formatString(value); // by default make this value a string
37
36
  };
38
37
  /**
39
38
  * HELPER FUNCTION DEFINITIONS
@@ -41,22 +40,12 @@ export const valueFormatter = ({ value, field, fields, }) => {
41
40
  /**
42
41
  * Formats the value as a string using the built-in converstion.
43
42
  */
44
- const formatString = (value) => value.toString();
45
- /**
46
- * Formats the value as an interval.
47
- */
48
- const INTERVALS = [
49
- 'years',
50
- 'months',
51
- 'days',
52
- 'hours',
53
- 'minutes',
54
- 'seconds',
55
- ];
56
- const formatInterval = (interval) => INTERVALS.map((component) => interval[component])
57
- .filter((value) => value !== undefined && value !== null)
58
- .map((value, index) => `${value} ${INTERVALS[index]}`)
59
- .join(', ');
43
+ const formatString = (value) => {
44
+ if (typeof value === 'object') {
45
+ return JSON.stringify(value);
46
+ }
47
+ return value.toString();
48
+ };
60
49
  /**
61
50
  * Formats the value as a (rounded) currency amount in dollars.
62
51
  *
@@ -1 +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,OAgC5B,CAAC"}
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"}
@@ -19,7 +19,6 @@ export const valueFormatterCSV = ({ value, field, fields, }) => {
19
19
  one_decimal_place: formatOneDecimalPlace,
20
20
  two_decimal_places: formatTwoDecimalPlaces,
21
21
  string: formatString,
22
- interval: formatInterval,
23
22
  yyyy: format_YYYY,
24
23
  MMM_yyyy: format_MMM_yyyy,
25
24
  MMM_dd_yyyy: format_MMM_dd_yyyy,
@@ -33,12 +32,17 @@ export const valueFormatterCSV = ({ value, field, fields, }) => {
33
32
  if (Object.keys(HANDLERS).includes(formatType)) {
34
33
  return HANDLERS[formatType](value);
35
34
  }
36
- return value.toString(); // by default make this value a string
35
+ return formatString(value); // by default make this value a string
37
36
  };
38
37
  /**
39
38
  * HELPER FUNCTION DEFINITIONS
40
39
  */
41
- const formatString = (value) => value.toString();
40
+ const formatString = (value) => {
41
+ if (typeof value === 'object') {
42
+ return JSON.stringify(value);
43
+ }
44
+ return value.toString();
45
+ };
42
46
  const formatDollarAmount = (value) => Number(value ?? 0);
43
47
  const formatDollarCents = (value) => Number(value ?? 0);
44
48
  const formatWholeNumber = (value) => Math.round(Number(value));
@@ -89,15 +93,3 @@ const format_wo_yyyy = (value) => {
89
93
  return 'Invalid date';
90
94
  return `${getWeek(utcDate)},${utcDate.getFullYear()}`;
91
95
  };
92
- const INTERVALS = [
93
- 'years',
94
- 'months',
95
- 'days',
96
- 'hours',
97
- 'minutes',
98
- 'seconds',
99
- ];
100
- const formatInterval = (interval) => INTERVALS.map((component) => interval[component])
101
- .filter((value) => value !== undefined && value !== null)
102
- .map((value, index) => `${value} ${INTERVALS[index]}`)
103
- .join(', ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.10.4",
3
+ "version": "2.10.6",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/esm/index.js",
@@ -32,11 +32,8 @@
32
32
  "@types/react-dom": "^18.2.18",
33
33
  "eslint": "^8.56.0",
34
34
  "react": "^18.2.0",
35
+ "react-dom": "^18.2.0",
35
36
  "typescript": "^5.3.3"
36
37
  },
37
- "peerDependencies": {
38
- "react-dom": ">=17"
39
- },
40
- "`description": "Quill React components for building dashboards and reporting.",
41
38
  "access": "public"
42
39
  }