@quillsql/react 2.11.17 → 2.11.19

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 (105) hide show
  1. package/dist/cjs/Chart.d.ts +0 -8
  2. package/dist/cjs/Chart.d.ts.map +1 -1
  3. package/dist/cjs/ChartBuilder.d.ts +11 -1
  4. package/dist/cjs/ChartBuilder.d.ts.map +1 -1
  5. package/dist/cjs/ChartBuilder.js +6 -5
  6. package/dist/cjs/ChartEditor.d.ts +11 -3
  7. package/dist/cjs/ChartEditor.d.ts.map +1 -1
  8. package/dist/cjs/ChartEditor.js +3 -3
  9. package/dist/cjs/Dashboard.d.ts.map +1 -1
  10. package/dist/cjs/Dashboard.js +7 -9
  11. package/dist/cjs/ReportBuilder.d.ts +7 -1
  12. package/dist/cjs/ReportBuilder.d.ts.map +1 -1
  13. package/dist/cjs/ReportBuilder.js +112 -37
  14. package/dist/cjs/SQLEditor.d.ts +7 -5
  15. package/dist/cjs/SQLEditor.d.ts.map +1 -1
  16. package/dist/cjs/SQLEditor.js +3 -2
  17. package/dist/cjs/Table.d.ts +2 -2
  18. package/dist/cjs/Table.d.ts.map +1 -1
  19. package/dist/cjs/components/Dashboard/DashboardFilter.js +2 -2
  20. package/dist/cjs/components/QuillCard.d.ts +2 -7
  21. package/dist/cjs/components/QuillCard.d.ts.map +1 -1
  22. package/dist/cjs/components/QuillCard.js +15 -9
  23. package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
  24. package/dist/cjs/components/ReportBuilder/AddColumnPopover.js +2 -0
  25. package/dist/cjs/components/ReportBuilder/AddLimitPopover.js +1 -1
  26. package/dist/cjs/components/ReportBuilder/convert.d.ts +1 -0
  27. package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
  28. package/dist/cjs/components/ReportBuilder/convert.js +20 -1
  29. package/dist/cjs/components/ReportBuilder/operators.d.ts +15 -10
  30. package/dist/cjs/components/ReportBuilder/operators.d.ts.map +1 -1
  31. package/dist/cjs/components/ReportBuilder/operators.js +23 -10
  32. package/dist/cjs/components/ReportBuilder/ui.d.ts +1 -2
  33. package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
  34. package/dist/cjs/components/ReportBuilder/ui.js +4 -4
  35. package/dist/cjs/components/ReportBuilder/util.d.ts +8 -3
  36. package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
  37. package/dist/cjs/components/ReportBuilder/util.js +110 -64
  38. package/dist/cjs/components/UiComponents.d.ts +0 -6
  39. package/dist/cjs/components/UiComponents.d.ts.map +1 -1
  40. package/dist/cjs/components/UiComponents.js +2 -44
  41. package/dist/cjs/internals/ReportBuilder/PivotList.d.ts +5 -2
  42. package/dist/cjs/internals/ReportBuilder/PivotList.d.ts.map +1 -1
  43. package/dist/cjs/internals/ReportBuilder/PivotList.js +11 -11
  44. package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +2 -1
  45. package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
  46. package/dist/cjs/internals/ReportBuilder/PivotModal.js +4 -3
  47. package/dist/cjs/utils/parserBigQuery.d.ts +6 -0
  48. package/dist/cjs/utils/parserBigQuery.d.ts.map +1 -0
  49. package/dist/cjs/utils/parserBigQuery.js +60 -0
  50. package/dist/cjs/utils/parserPostgres.d.ts +3 -0
  51. package/dist/cjs/utils/parserPostgres.d.ts.map +1 -0
  52. package/dist/cjs/utils/parserPostgres.js +42 -0
  53. package/dist/esm/Chart.d.ts +0 -8
  54. package/dist/esm/Chart.d.ts.map +1 -1
  55. package/dist/esm/ChartBuilder.d.ts +11 -1
  56. package/dist/esm/ChartBuilder.d.ts.map +1 -1
  57. package/dist/esm/ChartBuilder.js +6 -5
  58. package/dist/esm/ChartEditor.d.ts +11 -3
  59. package/dist/esm/ChartEditor.d.ts.map +1 -1
  60. package/dist/esm/ChartEditor.js +3 -3
  61. package/dist/esm/Dashboard.d.ts.map +1 -1
  62. package/dist/esm/Dashboard.js +8 -10
  63. package/dist/esm/ReportBuilder.d.ts +7 -1
  64. package/dist/esm/ReportBuilder.d.ts.map +1 -1
  65. package/dist/esm/ReportBuilder.js +113 -38
  66. package/dist/esm/SQLEditor.d.ts +7 -5
  67. package/dist/esm/SQLEditor.d.ts.map +1 -1
  68. package/dist/esm/SQLEditor.js +3 -2
  69. package/dist/esm/Table.d.ts +2 -2
  70. package/dist/esm/Table.d.ts.map +1 -1
  71. package/dist/esm/components/Dashboard/DashboardFilter.js +2 -2
  72. package/dist/esm/components/QuillCard.d.ts +2 -7
  73. package/dist/esm/components/QuillCard.d.ts.map +1 -1
  74. package/dist/esm/components/QuillCard.js +15 -9
  75. package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
  76. package/dist/esm/components/ReportBuilder/AddColumnPopover.js +2 -0
  77. package/dist/esm/components/ReportBuilder/AddLimitPopover.js +1 -1
  78. package/dist/esm/components/ReportBuilder/convert.d.ts +1 -0
  79. package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
  80. package/dist/esm/components/ReportBuilder/convert.js +18 -0
  81. package/dist/esm/components/ReportBuilder/operators.d.ts +15 -10
  82. package/dist/esm/components/ReportBuilder/operators.d.ts.map +1 -1
  83. package/dist/esm/components/ReportBuilder/operators.js +23 -10
  84. package/dist/esm/components/ReportBuilder/ui.d.ts +1 -2
  85. package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
  86. package/dist/esm/components/ReportBuilder/ui.js +4 -4
  87. package/dist/esm/components/ReportBuilder/util.d.ts +8 -3
  88. package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
  89. package/dist/esm/components/ReportBuilder/util.js +101 -60
  90. package/dist/esm/components/UiComponents.d.ts +0 -6
  91. package/dist/esm/components/UiComponents.d.ts.map +1 -1
  92. package/dist/esm/components/UiComponents.js +3 -44
  93. package/dist/esm/internals/ReportBuilder/PivotList.d.ts +5 -2
  94. package/dist/esm/internals/ReportBuilder/PivotList.d.ts.map +1 -1
  95. package/dist/esm/internals/ReportBuilder/PivotList.js +11 -11
  96. package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +2 -1
  97. package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
  98. package/dist/esm/internals/ReportBuilder/PivotModal.js +4 -3
  99. package/dist/esm/utils/parserBigQuery.d.ts +6 -0
  100. package/dist/esm/utils/parserBigQuery.d.ts.map +1 -0
  101. package/dist/esm/utils/parserBigQuery.js +52 -0
  102. package/dist/esm/utils/parserPostgres.d.ts +3 -0
  103. package/dist/esm/utils/parserPostgres.d.ts.map +1 -0
  104. package/dist/esm/utils/parserPostgres.js +37 -0
  105. package/package.json +1 -1
@@ -1,7 +1,9 @@
1
1
  // A collection of reusable, pure, utility functions for the Report Builder.
2
- import { getQuarter } from 'date-fns';
2
+ import { getQuarter, format, addMinutes, } from 'date-fns';
3
3
  import { DATE_DESCRIPTION_MAP } from './bigDateMap';
4
4
  import { snakeCaseToTitleCase } from '../../utils/textProcessing';
5
+ import { isAfterBigQuery, isBeforeBigQuery, isEqualsBigQuery, isInTheLastIntervalBigQuery, isTheCurrentIntervalBigQuery, } from '../../utils/parserBigQuery';
6
+ import { isInTheLastIntervalPostgres, isTheCurrentIntervalPostgres, } from '../../utils/parserPostgres';
5
7
  /**
6
8
  * A node that is "in" or "not in" where none of the variants are selected.
7
9
  */
@@ -134,7 +136,7 @@ const BIG_QUERY_DAY_TO_INTERVAL_MAP = {
134
136
  };
135
137
  export function getInTheLastIntervalSentence(node, databaseType) {
136
138
  if (databaseType === 'BigQuery') {
137
- const dateColumn = snakeCaseToTitleCase(node.left.column);
139
+ const dateColumn = snakeCaseToTitleCase(node.left.column || node.left.args.value[0].columns || '');
138
140
  const amount = node.right.args.value[1].expr.value;
139
141
  let unit = node.right.args.value[1].unit.toLowerCase();
140
142
  if (unit.includes('*')) {
@@ -152,6 +154,48 @@ export function getInThePreviousIntervalSentence(node, databaseType) {
152
154
  }
153
155
  return null;
154
156
  }
157
+ export function getIsEqualsSentence(node, databaseType) {
158
+ if (databaseType === 'BigQuery') {
159
+ const dateColumn = snakeCaseToTitleCase(node.left.args.value[1].column);
160
+ const type = node.right.args.value[1].column.toLowerCase();
161
+ const value = node.right.args.value[0].value;
162
+ // using date-fns can I parse the date to short month year
163
+ const date = new Date(value);
164
+ if (type === 'year') {
165
+ return `${dateColumn} is in ${format(addMinutes(date, date.getTimezoneOffset()), 'yyyy')}`;
166
+ }
167
+ else if (type === 'month') {
168
+ return `${dateColumn} is in ${format(addMinutes(date, date.getTimezoneOffset()), 'MMM yyyy')}`;
169
+ }
170
+ else if (type === 'quarter') {
171
+ return `${dateColumn} is in ${format(addMinutes(date, date.getTimezoneOffset()), 'QQQ yyyy')}`;
172
+ }
173
+ return `${dateColumn} is in the ${type} of ${value}`;
174
+ }
175
+ return null;
176
+ }
177
+ export function getIsAfterSentence(node, databaseType) {
178
+ if (databaseType === 'BigQuery') {
179
+ const dateColumn = snakeCaseToTitleCase(node.left?.column || node.left?.args?.value[0]?.columns || '');
180
+ const value = node.right?.value || node.right?.args?.value[0]?.value || '';
181
+ if (!dateColumn || !value) {
182
+ return null;
183
+ }
184
+ return `${dateColumn} is after ${value}`;
185
+ }
186
+ return null;
187
+ }
188
+ export function getIsBeforeSentence(node, databaseType) {
189
+ if (databaseType === 'BigQuery') {
190
+ const dateColumn = snakeCaseToTitleCase(node.left?.column || node.left?.args?.value[0]?.columns || '');
191
+ const value = node.right?.value || node.right?.args?.value[0]?.value || '';
192
+ if (!dateColumn || !value) {
193
+ return null;
194
+ }
195
+ return `${dateColumn} is before ${value}`;
196
+ }
197
+ return null;
198
+ }
155
199
  // "created_at" >= date_trunc ('year', CURRENT_DATE) - INTERVAL '1 year'
156
200
  // or
157
201
  // "created_at" >= CURRENT_DATE - INTERVAL '1 year'
@@ -160,38 +204,17 @@ export const isInTheLastInterval = (node, databaseType) => {
160
204
  if (databaseType && databaseType.toLowerCase() === 'bigquery') {
161
205
  return isInTheLastIntervalBigQuery(node);
162
206
  }
163
- const isOutsideOfDateTrunc = ['>=', '>'].includes(node.operator) &&
164
- node.left.type === 'column_ref' &&
165
- node.right.type === 'binary_expr' &&
166
- node.right.operator === '-' &&
167
- node.right.left.type === 'function' &&
168
- node.right.left.name.toLowerCase() === 'date_trunc' &&
169
- node.right.left.args.value[0].type === 'single_quote_string' &&
170
- node.right.left.args.value[1].type === 'function' &&
171
- ['current_date', 'now'].includes(node.right.left.args.value[1].name.toLowerCase()) &&
172
- node.right.right.type.toLowerCase() === 'interval' &&
173
- node.right.right.expr.type === 'single_quote_string';
174
- const noDateTrunc = ['>=', '>'].includes(node.operator) &&
175
- node.left.type === 'column_ref' &&
176
- node.right.type === 'binary_expr' &&
177
- node.right.operator === '-' &&
178
- node.right.left.type === 'function' &&
179
- ['current_date', 'now'].includes(node.right.left.name.toLowerCase()) &&
180
- node.right.right.type.toLowerCase() === 'interval' &&
181
- node.right.right.expr.type === 'single_quote_string';
182
- return isOutsideOfDateTrunc || noDateTrunc;
207
+ return isInTheLastIntervalPostgres(node);
183
208
  };
184
- // created_at >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH)
185
- // in the last month aka one interval from today
186
- export const isInTheLastIntervalBigQuery = (node) => {
187
- const isOutsideOfDateTrunc = ['>=', '>'].includes(node.operator) &&
188
- node.left.type === 'column_ref' &&
189
- node.right.type === 'function' &&
190
- node.right.name.toLowerCase() === 'timestamp_sub' &&
191
- node.right.args.value[0].type === 'function' &&
192
- node.right.args.value[1].type === 'interval' &&
193
- ['current_timestamp'].includes(node.right.args.value[0].name.toLowerCase());
194
- return isOutsideOfDateTrunc;
209
+ export const isAfter = (node, databaseType) => {
210
+ if (databaseType && databaseType.toLowerCase() === 'bigquery') {
211
+ return isAfterBigQuery(node);
212
+ }
213
+ };
214
+ export const isBefore = (node, databaseType) => {
215
+ if (databaseType && databaseType.toLowerCase() === 'bigquery') {
216
+ return isBeforeBigQuery(node);
217
+ }
195
218
  };
196
219
  // "created_at" >= date_trunc ('year', CURRENT_DATE - INTERVAL '1 year')
197
220
  // this year
@@ -199,19 +222,15 @@ export const isTheCurrentInterval = (node, databaseType) => {
199
222
  if (databaseType && databaseType.toLowerCase() === 'bigquery') {
200
223
  return isTheCurrentIntervalBigQuery(node);
201
224
  }
202
- const isInsideOfDateTrunc = ['AND'].includes(node.operator) &&
203
- (node.left.operator === '=' || node.left.type === 'double_quote_string') &&
204
- node.right.operator === '=' &&
205
- node.right.name &&
206
- node.right.name.toLowerCase() === 'date_trunc' &&
207
- node.args.value[0].type === 'single_quote_string' &&
208
- node.args.value[1].type === 'binary_expr' &&
209
- node.args.value[1].operator === '-' &&
210
- node.args.value[1].left.type === 'function' &&
211
- ['now', 'current_date'].includes(node.args.value[1].left.name.toLowerCase()) &&
212
- node.args.value[1].right.type === 'interval' &&
213
- node.args.value[1].right.expr.type === 'single_quote_string';
214
- return isInsideOfDateTrunc;
225
+ return isTheCurrentIntervalPostgres(node);
226
+ };
227
+ // "created_at" >= date_trunc ('year', CURRENT_DATE - INTERVAL '1 year')
228
+ // this year
229
+ export const isEquals = (node, databaseType) => {
230
+ if (databaseType && databaseType.toLowerCase() === 'bigquery') {
231
+ return isEqualsBigQuery(node);
232
+ }
233
+ return false;
215
234
  };
216
235
  export const isThePreviousInterval = (node, databaseType) => {
217
236
  const isInsideOfDateTrunc = ['='].includes(node.operator) &&
@@ -220,21 +239,11 @@ export const isThePreviousInterval = (node, databaseType) => {
220
239
  node.left.type === 'function' &&
221
240
  node.right.name &&
222
241
  node.right.name.toLowerCase() === 'timestamp_trunc' &&
223
- node.right.args.value[0].name.toLowerCase() === 'timestamp_sub' &&
242
+ node.right.args.value[0]?.name?.toLowerCase() === 'timestamp_sub' &&
224
243
  node.right.args.value[0].args.value[0].name.toLowerCase() ===
225
244
  'current_timestamp';
226
245
  return isInsideOfDateTrunc;
227
246
  };
228
- export const isTheCurrentIntervalBigQuery = (node) => {
229
- const isInsideOfDateTrunc = ['='].includes(node.operator) &&
230
- node.left.type === 'function' &&
231
- node.left.name &&
232
- node.left.name.toLowerCase() === 'timestamp_trunc' &&
233
- node.right.type === 'function' &&
234
- node.right.name.toLowerCase() === 'timestamp_trunc' &&
235
- node.right.args.value[0].name.toLowerCase() === 'current_timestamp';
236
- return isInsideOfDateTrunc;
237
- };
238
247
  /**
239
248
  * Returns whether this node is the root of a binary expression
240
249
  * where the left child is a string but really should be
@@ -355,7 +364,7 @@ export function extractSuffixToString(node) {
355
364
  }
356
365
  }
357
366
  export function tryConvertDateEquality(node, databaseType) {
358
- if (isDateTruncEquals(node)) {
367
+ if (isDateTruncEquals(node, databaseType)) {
359
368
  const columnNode = node.left.args.value[1];
360
369
  const columnName = columnNode.column ?? columnNode.value;
361
370
  const cleanColumnName = snakeCaseToTitleCase(columnName.replaceAll('_at', ''));
@@ -375,7 +384,7 @@ export function tryConvertDateEquality(node, databaseType) {
375
384
  * Returns whether this node is an equality of a date column with a
376
385
  * date trunc.
377
386
  */
378
- export const isDateTruncEquals = (node) => {
387
+ export const isDateTruncEquals = (node, databaseType) => {
379
388
  return (node.type === 'binary_expr' &&
380
389
  node.operator === '=' &&
381
390
  isDateTrunc(node.left) &&
@@ -630,12 +639,21 @@ function getNodeTable(node) {
630
639
  function removeNonSelectedTableFilters(node, table, columns) {
631
640
  if (node.left.type !== 'binary_expr') {
632
641
  const referencedTable = getNodeTable(node.left);
633
- const referencedColumn = node.left.column || node.left.value;
642
+ const referencedColumn = node.left.column ||
643
+ node.left.value ||
644
+ node.left.args?.value[0]?.column ||
645
+ node.left.args?.value[0]?.value;
634
646
  if ((referencedTable && referencedTable !== table) ||
635
647
  !columns.includes(referencedColumn)) {
636
648
  return null;
637
649
  }
638
650
  else {
651
+ if (node.left.value) {
652
+ node.left.column = node.left.value;
653
+ }
654
+ else if (node.left.args?.value[0].value) {
655
+ node.left.args.value[0].column = node.left.args.value[0].value;
656
+ }
639
657
  return node;
640
658
  }
641
659
  }
@@ -686,3 +704,26 @@ export function isIdColumn(columnName) {
686
704
  columnName.toLowerCase().endsWith('_id') ||
687
705
  columnName.endsWith('Id')));
688
706
  }
707
+ // This function determines if a node is a custom node type.
708
+ // This will parse out date filters and some numeric filters that are unique (between).
709
+ export function getCustomSentence(node, databaseType) {
710
+ if (isTheCurrentInterval(node, databaseType)) {
711
+ return getInTheCurrentIntervalSentence(node, databaseType);
712
+ }
713
+ else if (isInTheLastInterval(node, databaseType)) {
714
+ return getInTheLastIntervalSentence(node, databaseType);
715
+ }
716
+ else if (isAfter(node, databaseType)) {
717
+ return getIsAfterSentence(node, databaseType);
718
+ }
719
+ else if (isBefore(node, databaseType)) {
720
+ return getIsBeforeSentence(node, databaseType);
721
+ }
722
+ else if (isThePreviousInterval(node, databaseType)) {
723
+ return getInThePreviousIntervalSentence(node, databaseType);
724
+ }
725
+ else if (isEquals(node, databaseType)) {
726
+ return getIsEqualsSentence(node, databaseType);
727
+ }
728
+ return null;
729
+ }
@@ -133,11 +133,5 @@ export interface TableComponentProps {
133
133
  isLoading?: boolean;
134
134
  }
135
135
  export declare const QuillTableComponent: ({ rows, columns, isLoading, }: TableComponentProps) => import("react/jsx-runtime").JSX.Element;
136
- export declare const QuillDropdownComponent: ({ onChange, value, label, options, }: {
137
- onChange: (event: ChangeEvent<HTMLSelectElement>) => void;
138
- value: string;
139
- options: Option[];
140
- label?: string | undefined;
141
- }) => import("react/jsx-runtime").JSX.Element;
142
136
  export declare const QuillEmptyDashboardComponent: () => import("react/jsx-runtime").JSX.Element;
143
137
  //# sourceMappingURL=UiComponents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components/UiComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,WAAW,EAEX,SAAS,EAMV,MAAM,OAAO,CAAC;AAMf,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,MA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AAgB,CAAC"}
1
+ {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components/UiComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,WAAW,EAEX,SAAS,EAMV,MAAM,OAAO,CAAC;AAMf,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAA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AAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,mBAAmB,kCAI7B,mBAAmB,4CASrB,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAAgB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // @ts-nocheck
3
- import { useCallback, useContext, useEffect, useRef, } from 'react';
4
- import { ArrowDownHeadIcon, XIcon } from '../assets';
3
+ import { useContext, useEffect, useRef, } from 'react';
4
+ import { XIcon } from '../assets';
5
5
  import { ThemeContext } from '../Context';
6
6
  import QuillTable from './QuillTable';
7
7
  /**
@@ -300,47 +300,6 @@ export const QuillTableComponent = ({ rows, columns, isLoading = false, }) => {
300
300
  if (isLoading) {
301
301
  return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', margin: 'auto' }, children: _jsx(LoadingSpinner, {}) }));
302
302
  }
303
- return _jsx(QuillTable, { rows: rows, columns: columns, rowsPerPage: 10 });
304
- };
305
- export const QuillDropdownComponent = ({ onChange, value, label, options, }) => {
306
- const [theme] = useContext(ThemeContext);
307
- const handleOnChange = useCallback((event) => onChange(event), [onChange]);
308
- return (_jsxs("div", { children: [label && (_jsx("div", { style: {
309
- marginBottom: 6,
310
- fontWeight: theme.labelFontWeight || '600',
311
- color: theme.secondaryTextColor,
312
- fontFamily: theme.fontFamily,
313
- fontSize: 14,
314
- }, children: label })), _jsxs("div", { style: { position: 'relative', height: 38 }, children: [_jsxs("select", { id: "reportbuilderdropdown", onChange: handleOnChange, value: value ?? '', style: {
315
- width: '100%',
316
- WebkitAppearance: 'none',
317
- minWidth: 230,
318
- outline: 'none',
319
- textAlign: 'left',
320
- whiteSpace: 'nowrap',
321
- overflow: 'hidden',
322
- textOverflow: 'ellipsis',
323
- borderRadius: 6,
324
- paddingLeft: 12,
325
- paddingRight: 12,
326
- height: 38,
327
- borderWidth: theme.borderWidth,
328
- borderColor: theme.borderColor,
329
- background: theme.backgroundColor,
330
- color: theme.primaryTextColor,
331
- boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
332
- fontFamily: theme.fontFamily,
333
- fontSize: 14,
334
- fontWeight: 500,
335
- boxSizing: 'border-box',
336
- }, children: [_jsx("option", { value: "", children: "Select" }), options.map((option, index) => (_jsx("option", { value: option.value, children: option.label }, option.label + index)))] }), _jsx(ArrowDownHeadIcon, { style: {
337
- height: '20px',
338
- width: '20px',
339
- flex: 'none',
340
- position: 'absolute',
341
- right: 8,
342
- top: 9,
343
- color: theme?.secondaryTextColor,
344
- }, "aria-hidden": "true" })] })] }));
303
+ return _jsx(QuillTable, { rows: rows, columns: columns, rowsPerPage: 20 });
345
304
  };
346
305
  export const QuillEmptyDashboardComponent = () => _jsx("div", {});
@@ -1,4 +1,5 @@
1
- export declare const PivotCard: ({ pivotTable, theme, index, onSelectPivot, selectedPivotIndex, onEditPivot, ButtonComponent, showEdit, clickable, onClose, minHeight, LabelComponent, TextComponent, HeaderComponent, }: {
1
+ import { QuillCard } from '../../components/QuillCard';
2
+ export declare const PivotCard: ({ pivotTable, theme, index, onSelectPivot, selectedPivotIndex, onEditPivot, ButtonComponent, showEdit, clickable, onClose, minHeight, CardComponent, LabelComponent, TextComponent, HeaderComponent, }: {
2
3
  pivotTable: any;
3
4
  theme: any;
4
5
  index: any;
@@ -10,11 +11,12 @@ export declare const PivotCard: ({ pivotTable, theme, index, onSelectPivot, sele
10
11
  clickable?: boolean | undefined;
11
12
  onClose?: (() => void) | undefined;
12
13
  minHeight?: number | undefined;
14
+ CardComponent?: typeof QuillCard | undefined;
13
15
  LabelComponent: any;
14
16
  TextComponent: any;
15
17
  HeaderComponent: any;
16
18
  }) => import("react/jsx-runtime").JSX.Element;
17
- export declare const PivotList: ({ recommendedPivotTables, createdPivotTables, onSelectRecommendedPivot, onSelectCreatedPivot, theme, selectedPivotIndex, selectedPivotType, ButtonComponent, showCreatePivot, onEditRecommendedPivot, onEditCreatedPivot, showPivotEditButton, LabelComponent, TextComponent, HeaderComponent, }: {
19
+ export declare const PivotList: ({ recommendedPivotTables, createdPivotTables, onSelectRecommendedPivot, onSelectCreatedPivot, theme, selectedPivotIndex, selectedPivotType, ButtonComponent, showCreatePivot, onEditRecommendedPivot, onEditCreatedPivot, showPivotEditButton, CardComponent, LabelComponent, TextComponent, HeaderComponent, }: {
18
20
  recommendedPivotTables: any;
19
21
  createdPivotTables: any;
20
22
  onSelectRecommendedPivot: any;
@@ -27,6 +29,7 @@ export declare const PivotList: ({ recommendedPivotTables, createdPivotTables, o
27
29
  onEditRecommendedPivot: any;
28
30
  onEditCreatedPivot: any;
29
31
  showPivotEditButton?: boolean | undefined;
32
+ CardComponent?: typeof QuillCard | undefined;
30
33
  LabelComponent: any;
31
34
  TextComponent: any;
32
35
  HeaderComponent: any;
@@ -1 +1 @@
1
- {"version":3,"file":"PivotList.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotList.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;6CAoNrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;6CAmFrB,CAAC"}
1
+ {"version":3,"file":"PivotList.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotList.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;6CAiNrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;6CAqFrB,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { QuillCard } from '../../components/QuillCard';
2
+ // @ts-nocheck
3
3
  import { quillFormat } from '../../utils/valueFormatter';
4
4
  import { snakeCaseToTitleCase } from '../../utils/textProcessing';
5
- export const PivotCard = ({ pivotTable, theme, index, onSelectPivot, selectedPivotIndex, onEditPivot, ButtonComponent, showEdit = false, clickable = true, onClose = () => { }, minHeight = 0, LabelComponent, TextComponent, HeaderComponent, }) => {
5
+ import { QuillCard } from '../../components/QuillCard';
6
+ export const PivotCard = ({ pivotTable, theme, index, onSelectPivot, selectedPivotIndex, onEditPivot, ButtonComponent, showEdit = false, clickable = true, onClose = () => { }, minHeight = 0, CardComponent = QuillCard, LabelComponent, TextComponent, HeaderComponent, }) => {
6
7
  const maxRowsInPivotPeak = 5;
7
- return (_jsx(QuillCard, { theme: theme, onClick: () => onSelectPivot(pivotTable.pivot, index), isSelected: index === selectedPivotIndex, clickable: clickable, onClose: onClose, minHeight: minHeight, children: _jsxs("div", { style: {
8
+ return (_jsx(CardComponent, { onClick: () => onSelectPivot(pivotTable.pivot, index), onDelete: onClose, children: _jsxs("div", { style: {
8
9
  fontSize: 14,
9
10
  display: 'flex',
10
11
  flexDirection: 'column',
@@ -72,17 +73,16 @@ export const PivotCard = ({ pivotTable, theme, index, onSelectPivot, selectedPiv
72
73
  onEditPivot(pivotTable.pivot, index);
73
74
  }, label: 'Edit' }) }))] })] }) }));
74
75
  };
75
- export const PivotList = ({ recommendedPivotTables, createdPivotTables, onSelectRecommendedPivot, onSelectCreatedPivot, theme, selectedPivotIndex, selectedPivotType, ButtonComponent, showCreatePivot = false, onEditRecommendedPivot, onEditCreatedPivot, showPivotEditButton = false, LabelComponent, TextComponent, HeaderComponent, }) => {
76
+ export const PivotList = ({ recommendedPivotTables, createdPivotTables, onSelectRecommendedPivot, onSelectCreatedPivot, theme, selectedPivotIndex, selectedPivotType, ButtonComponent, showCreatePivot = false, onEditRecommendedPivot, onEditCreatedPivot, showPivotEditButton = false, CardComponent = QuillCard, LabelComponent, TextComponent, HeaderComponent, }) => {
76
77
  return (_jsx("div", { children: _jsxs("div", { style: {
77
78
  display: 'grid',
78
79
  gridTemplateColumns: 'repeat(2, 1fr)',
79
80
  gap: 16,
80
81
  gridAutoRows: '220px',
81
- }, children: [recommendedPivotTables.map((pivotTable, index) => (_jsx(PivotCard, { pivotTable: pivotTable, theme: theme, index: index, onSelectPivot: onSelectRecommendedPivot, selectedPivotIndex: selectedPivotType === 'recommended' ? selectedPivotIndex : -1, onEditPivot: onEditRecommendedPivot, ButtonComponent: ButtonComponent, showPivotEditButton: showPivotEditButton, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }, index))), createdPivotTables.map((pivotTable, index) => (_jsx(PivotCard, { pivotTable: pivotTable, theme: theme, index: index, onSelectPivot: onSelectCreatedPivot, selectedPivotIndex: selectedPivotType === 'created' ? selectedPivotIndex : -1, onEditPivot: onEditCreatedPivot, ButtonComponent: ButtonComponent, showPivotEditButton: showPivotEditButton, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }, index))), showCreatePivot && (_jsx(QuillCard, { theme: theme, onClick: () => onEditCreatedPivot({}, null), style: {
82
- display: 'flex',
83
- justifyContent: 'center',
84
- alignItems: 'center',
85
- border: `1px dashed ${theme.borderColor || '#e7e7e7'}`,
86
- boxShadow: 'none',
87
- }, children: "Create pivot +" }))] }) }));
82
+ }, children: [recommendedPivotTables.map((pivotTable, index) => (_jsx(PivotCard, { pivotTable: pivotTable, theme: theme, index: index, onSelectPivot: onSelectRecommendedPivot, selectedPivotIndex: selectedPivotType === 'recommended' ? selectedPivotIndex : -1, onEditPivot: onEditRecommendedPivot, ButtonComponent: ButtonComponent, showPivotEditButton: showPivotEditButton, minHeight: 180, CardComponent: CardComponent, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }, index))), createdPivotTables.map((pivotTable, index) => (_jsx(PivotCard, { pivotTable: pivotTable, theme: theme, index: index, onSelectPivot: onSelectCreatedPivot, selectedPivotIndex: selectedPivotType === 'created' ? selectedPivotIndex : -1, onEditPivot: onEditCreatedPivot, ButtonComponent: ButtonComponent, showPivotEditButton: showPivotEditButton, minHeight: 180, CardComponent: CardComponent, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }, index))), showCreatePivot && (_jsx(CardComponent, { onClick: () => onEditCreatedPivot({}, null), children: _jsx("div", { style: {
83
+ display: 'flex',
84
+ justifyContent: 'center',
85
+ alignItems: 'center',
86
+ width: '100%',
87
+ }, children: "Create pivot +" }) }))] }) }));
88
88
  };
@@ -24,6 +24,7 @@ export interface PivotModalProps {
24
24
  selectedTable: any;
25
25
  SelectComponent: any;
26
26
  ButtonComponent: any;
27
+ CardComponent: any;
27
28
  SecondaryButtonComponent: (props: ButtonComponentProps) => JSX.Element;
28
29
  PopoverComponent: (props: {
29
30
  isOpen: boolean;
@@ -66,7 +67,7 @@ export interface PivotModalProps {
66
67
  parentRef: any;
67
68
  recommendPivotCount?: number;
68
69
  }
69
- export declare const PivotModal: ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, SecondaryButtonComponent, PopoverComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText, showPivotEditButton, showEditOnPivotClick, selectPivotOnEdit, showTrigger, rightAlign, parentRef, recommendPivotCount, }: PivotModalProps) => import("react/jsx-runtime").JSX.Element;
70
+ export declare const PivotModal: ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, SecondaryButtonComponent, PopoverComponent, CardComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText, showPivotEditButton, showEditOnPivotClick, selectPivotOnEdit, showTrigger, rightAlign, parentRef, recommendPivotCount, }: PivotModalProps) => import("react/jsx-runtime").JSX.Element;
70
71
  export declare function generatePivotTableYAxis(pivot: any, cols: any, format: any): any;
71
72
  export declare function isDateField(fieldType: any): boolean;
72
73
  export declare function generatePivotTable(pivot: Pivot, data: any, dateRange: any, isComparison: boolean, rowLimit?: number, compRange?: any): {
@@ -1 +1 @@
1
- {"version":3,"file":"PivotModal.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotModal.tsx"],"names":[],"mappings":"AACA,OAAc,EAOZ,SAAS,EACV,MAAM,OAAO,CAAC;AAwBf,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAkBD,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,GAAG,CAAC;IACnB,gBAAgB,EAAE,GAAG,CAAC;IACtB,gBAAgB,EAAE,GAAG,CAAC;IACtB,mBAAmB,EAAE,GAAG,CAAC;IACzB,eAAe,EAAE,GAAG,CAAC;IACrB,kBAAkB,EAAE,GAAG,CAAC;IACxB,gBAAgB,EAAE,GAAG,CAAC;IACtB,mBAAmB,EAAE,GAAG,CAAC;IACzB,UAAU,EAAE,GAAG,CAAC;IAChB,aAAa,EAAE,GAAG,CAAC;IACnB,aAAa,EAAE,GAAG,CAAC;IACnB,eAAe,EAAE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AG,CAAC;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,aAAa,EAAE,GAAG,CAAC;IACnB,gBAAgB,EAAE,GAAG,CAAC;IACtB,iBAAiB,EAAE,GAAG,CAAC;IACvB,oBAAoB,EAAE,GAAG,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,qsBA4CpB,eAAe,4CAwqBjB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA,OAyB1D;AAkHD,wBAAgB,WAAW,CAAC,SAAS,KAAA,WAYpC;AAgCD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,GAAG,EACT,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,OAAO,EACrB,QAAQ,SAAK,EACb,SAAS,GAAE,GAAU;;;;;;EAubtB"}
@@ -10,6 +10,7 @@ import { numberFormatOptions, dateFormatOptions } from '../../ChartBuilder';
10
10
  import { snakeCaseToTitleCase } from '../../utils/textProcessing';
11
11
  import { isIdColumn } from '../../components/ReportBuilder/util';
12
12
  import { isNumericColumnType } from '../../components/ReportBuilder/ast';
13
+ import { QuillCard } from '../../components/QuillCard';
13
14
  const QuillHover = () => {
14
15
  return (_jsx("style", { children: `
15
16
  .quill-hover {
@@ -23,7 +24,7 @@ const QuillHover = () => {
23
24
  }
24
25
  ` }));
25
26
  };
26
- export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, SecondaryButtonComponent, PopoverComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText = 'Pivot', showPivotEditButton = false, showEditOnPivotClick = true, selectPivotOnEdit = false, showTrigger = true, rightAlign = false, parentRef, recommendPivotCount = 6, }) => {
27
+ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, SecondaryButtonComponent, PopoverComponent, CardComponent = QuillCard, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText = 'Pivot', showPivotEditButton = false, showEditOnPivotClick = true, selectPivotOnEdit = false, showTrigger = true, rightAlign = false, parentRef, recommendPivotCount = 6, }) => {
27
28
  const [isLoading, setIsLoading] = useState(false);
28
29
  const [pivotUpdateIndex, setPivotUpdateIndex] = useState(null);
29
30
  const [selectedPivotType, setSelectedPivotType] = useState('recommended');
@@ -365,7 +366,7 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
365
366
  columns: selectedPivotTable?.columns,
366
367
  }, theme: theme, index: 0, onSelectPivot: () => { }, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent: ButtonComponent, showEdit: false, onClose: () => {
367
368
  removePivot();
368
- }, clickable: true, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }) }) })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsxs("div", { style: {
369
+ }, clickable: true, minHeight: 180, CardComponent: CardComponent, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }) }) })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsxs("div", { style: {
369
370
  display: 'flex',
370
371
  flexDirection: 'row',
371
372
  width: '100%',
@@ -393,7 +394,7 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
393
394
  display: 'flex',
394
395
  margin: '0px auto',
395
396
  justifyContent: 'center',
396
- }, children: [_jsx("div", { style: { height: 100 } }), _jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: theme?.primaryTextColor || '#364153', fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] })] })) : (_jsx("div", { children: _jsx(PivotList, { recommendedPivotTables: recommendedPivotTables, createdPivotTables: createdPivotTables, theme: theme, onSelectRecommendedPivot: onSelectRecommendedPivot, onSelectCreatedPivot: onSelectCreatedPivot, selectedPivotIndex: selectedPivotIndex, selectedPivotType: selectedPivotType, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, onEditRecommendedPivot: onEditRecommendedPivot, onEditCreatedPivot: onEditPivot, showCreatePivot: true, showPivotEditButton: showPivotEditButton, LabelComponent: LabelComponent, TextComponent: TextComponent }) }))] })) })) }) })] }) }));
397
+ }, children: [_jsx("div", { style: { height: 100 } }), _jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: theme?.primaryTextColor || '#364153', fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] })] })) : (_jsx("div", { children: _jsx(PivotList, { recommendedPivotTables: recommendedPivotTables, createdPivotTables: createdPivotTables, theme: theme, onSelectRecommendedPivot: onSelectRecommendedPivot, onSelectCreatedPivot: onSelectCreatedPivot, selectedPivotIndex: selectedPivotIndex, selectedPivotType: selectedPivotType, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, onEditRecommendedPivot: onEditRecommendedPivot, onEditCreatedPivot: onEditPivot, showCreatePivot: true, showPivotEditButton: showPivotEditButton, LabelComponent: LabelComponent, TextComponent: TextComponent, CardComponent: CardComponent }) }))] })) })) }) })] }) }));
397
398
  };
398
399
  export function generatePivotTableYAxis(pivot, cols, format) {
399
400
  // Use the column field for the field and label if there is one
@@ -0,0 +1,6 @@
1
+ export declare const isInTheLastIntervalBigQuery: (node: any) => boolean;
2
+ export declare const isAfterBigQuery: (node: any) => boolean;
3
+ export declare const isBeforeBigQuery: (node: any) => boolean;
4
+ export declare const isTheCurrentIntervalBigQuery: (node: any) => boolean;
5
+ export declare const isEqualsBigQuery: (node: any) => any;
6
+ //# sourceMappingURL=parserBigQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parserBigQuery.d.ts","sourceRoot":"","sources":["../../../src/utils/parserBigQuery.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,SAAU,GAAG,YAYpD,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,GAAG,YAUxC,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,GAAG,YAUzC,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,GAAG,KAAG,OAUxD,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,GAAG,QASzC,CAAC"}
@@ -0,0 +1,52 @@
1
+ // Functions use to parse BigQuery SQL
2
+ export const isInTheLastIntervalBigQuery = (node) => {
3
+ const isOutsideOfDateTrunc = ['>=', '>'].includes(node.operator) &&
4
+ (node.left.type === 'column_ref' ||
5
+ (node.left.type === 'function' &&
6
+ node.left.name.toLowerCase() === 'timestamp')) &&
7
+ node.right.type === 'function' &&
8
+ node.right.name.toLowerCase() === 'timestamp_sub' &&
9
+ node.right.args.value[0].type === 'function' &&
10
+ node.right.args.value[1].type === 'interval' &&
11
+ ['current_timestamp'].includes(node.right.args.value[0].name.toLowerCase());
12
+ return isOutsideOfDateTrunc;
13
+ };
14
+ export const isAfterBigQuery = (node) => {
15
+ const isOutsideOfDateTrunc = ['>=', '>'].includes(node.operator) &&
16
+ (node.left.type === 'column_ref' ||
17
+ (node.left.type === 'function' &&
18
+ node.left.name.toLowerCase() === 'timestamp')) &&
19
+ ((node.right.type === 'function' &&
20
+ node.right.name.toLowerCase() === 'timestamp') ||
21
+ node.right.type === 'timestamp');
22
+ return isOutsideOfDateTrunc;
23
+ };
24
+ export const isBeforeBigQuery = (node) => {
25
+ const isOutsideOfDateTrunc = ['<=', '<'].includes(node.operator) &&
26
+ (node.left.type === 'column_ref' ||
27
+ (node.left.type === 'function' &&
28
+ node.left.name.toLowerCase() === 'timestamp')) &&
29
+ ((node.right.type === 'function' &&
30
+ node.right.name.toLowerCase() === 'timestamp') ||
31
+ node.right.type === 'timestamp');
32
+ return isOutsideOfDateTrunc;
33
+ };
34
+ export const isTheCurrentIntervalBigQuery = (node) => {
35
+ const isInsideOfDateTrunc = ['='].includes(node.operator) &&
36
+ node.left.type === 'function' &&
37
+ node.left.name &&
38
+ node.left.name.toLowerCase() === 'timestamp_trunc' &&
39
+ node.right.type === 'function' &&
40
+ node.right.name.toLowerCase() === 'timestamp_trunc' &&
41
+ node.right.args?.value[0]?.name?.toLowerCase() === 'current_timestamp';
42
+ return isInsideOfDateTrunc;
43
+ };
44
+ export const isEqualsBigQuery = (node) => {
45
+ const isEquals = ['='].includes(node.operator) &&
46
+ node.left.type === 'function' &&
47
+ node.left.name &&
48
+ node.left.name.toLowerCase() === 'timestamp_trunc' &&
49
+ node.right.name.toLowerCase() === 'timestamp_trunc' &&
50
+ node.right.args.value[0].type.toLowerCase() === 'timestamp';
51
+ return isEquals;
52
+ };
@@ -0,0 +1,3 @@
1
+ export declare const isInTheLastIntervalPostgres: (node: any) => boolean;
2
+ export declare const isTheCurrentIntervalPostgres: (node: any) => boolean;
3
+ //# sourceMappingURL=parserPostgres.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parserPostgres.d.ts","sourceRoot":"","sources":["../../../src/utils/parserPostgres.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,SAAU,GAAG,KAAG,OAyBvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,GAAG,KAAG,OAiBxD,CAAC"}
@@ -0,0 +1,37 @@
1
+ export const isInTheLastIntervalPostgres = (node) => {
2
+ const isOutsideOfDateTrunc = ['>=', '>'].includes(node.operator) &&
3
+ node.left.type === 'column_ref' &&
4
+ node.right.type === 'binary_expr' &&
5
+ node.right.operator === '-' &&
6
+ node.right.left.type === 'function' &&
7
+ node.right.left.name.toLowerCase() === 'date_trunc' &&
8
+ node.right.left.args.value[0].type === 'single_quote_string' &&
9
+ node.right.left.args.value[1].type === 'function' &&
10
+ ['current_date', 'now'].includes(node.right.left.args.value[1].name.toLowerCase()) &&
11
+ node.right.right.type.toLowerCase() === 'interval' &&
12
+ node.right.right.expr.type === 'single_quote_string';
13
+ const noDateTrunc = ['>=', '>'].includes(node.operator) &&
14
+ node.left.type === 'column_ref' &&
15
+ node.right.type === 'binary_expr' &&
16
+ node.right.operator === '-' &&
17
+ node.right.left.type === 'function' &&
18
+ ['current_date', 'now'].includes(node.right.left.name.toLowerCase()) &&
19
+ node.right.right.type.toLowerCase() === 'interval' &&
20
+ node.right.right.expr.type === 'single_quote_string';
21
+ return isOutsideOfDateTrunc || noDateTrunc;
22
+ };
23
+ export const isTheCurrentIntervalPostgres = (node) => {
24
+ const isInsideOfDateTrunc = ['AND'].includes(node.operator) &&
25
+ (node.left.operator === '=' || node.left.type === 'double_quote_string') &&
26
+ node.right.operator === '=' &&
27
+ node.right.name &&
28
+ node.right.name.toLowerCase() === 'date_trunc' &&
29
+ node.args.value[0].type === 'single_quote_string' &&
30
+ node.args.value[1].type === 'binary_expr' &&
31
+ node.args.value[1].operator === '-' &&
32
+ node.args.value[1].left.type === 'function' &&
33
+ ['now', 'current_date'].includes(node.args.value[1].left.name.toLowerCase()) &&
34
+ node.args.value[1].right.type === 'interval' &&
35
+ node.args.value[1].right.expr.type === 'single_quote_string';
36
+ return isInsideOfDateTrunc;
37
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.11.17",
3
+ "version": "2.11.19",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/esm/index.js",