@quillsql/react 2.8.5 → 2.8.7

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 (86) hide show
  1. package/dist/AddToDashboardModal.js +146 -180
  2. package/dist/BarList.js +36 -43
  3. package/dist/Chart.js +99 -131
  4. package/dist/ChartBuilder.js +80 -88
  5. package/dist/ChartEditor.js +14 -20
  6. package/dist/Context.js +52 -56
  7. package/dist/Dashboard.d.ts.map +1 -1
  8. package/dist/Dashboard.js +246 -305
  9. package/dist/DateRangePicker/Calendar.js +41 -45
  10. package/dist/DateRangePicker/DateRangePicker.js +32 -60
  11. package/dist/DateRangePicker/DateRangePickerButton.js +14 -16
  12. package/dist/DateRangePicker/dateRangePickerUtils.d.ts +6 -0
  13. package/dist/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
  14. package/dist/DateRangePicker/dateRangePickerUtils.js +89 -89
  15. package/dist/DateRangePicker/index.js +1 -8
  16. package/dist/PieChart.js +35 -69
  17. package/dist/QuillProvider.js +4 -6
  18. package/dist/ReportBuilder.js +120 -128
  19. package/dist/SQLEditor.js +56 -64
  20. package/dist/Table.d.ts +2 -1
  21. package/dist/Table.d.ts.map +1 -1
  22. package/dist/Table.js +71 -69
  23. package/dist/TableChart.js +17 -44
  24. package/dist/assets/ArrowDownHeadIcon.js +3 -5
  25. package/dist/assets/ArrowDownIcon.js +3 -5
  26. package/dist/assets/ArrowDownRightIcon.js +3 -5
  27. package/dist/assets/ArrowLeftHeadIcon.js +3 -5
  28. package/dist/assets/ArrowRightHeadIcon.js +3 -5
  29. package/dist/assets/ArrowRightIcon.js +3 -5
  30. package/dist/assets/ArrowUpHeadIcon.js +3 -5
  31. package/dist/assets/ArrowUpIcon.js +3 -5
  32. package/dist/assets/ArrowUpRightIcon.js +3 -5
  33. package/dist/assets/CalendarIcon.js +3 -5
  34. package/dist/assets/CalendarNormalIcon.js +3 -5
  35. package/dist/assets/DoubleArrowLeftHeadIcon.js +3 -5
  36. package/dist/assets/DoubleArrowRightHeadIcon.js +3 -5
  37. package/dist/assets/ExclamationFilledIcon.js +3 -5
  38. package/dist/assets/FilterIcon.js +3 -5
  39. package/dist/assets/LoadingSpinner.js +3 -5
  40. package/dist/assets/RefreshIcon.js +3 -5
  41. package/dist/assets/SearchIcon.js +3 -5
  42. package/dist/assets/UpLeftArrowsIcon.js +3 -5
  43. package/dist/assets/XCircleIcon.js +3 -5
  44. package/dist/assets/XIcon.js +3 -5
  45. package/dist/assets/index.js +21 -48
  46. package/dist/components/BigModal/BigModal.js +13 -38
  47. package/dist/components/Dropdown/Dropdown.js +24 -52
  48. package/dist/components/Dropdown/DropdownItem.js +9 -34
  49. package/dist/components/Dropdown/index.js +2 -10
  50. package/dist/components/Modal/Modal.js +13 -38
  51. package/dist/components/Modal/index.js +1 -8
  52. package/dist/components/QuillCard.js +8 -12
  53. package/dist/components/SqlTextEditor.d.ts +7 -0
  54. package/dist/components/SqlTextEditor.d.ts.map +1 -0
  55. package/dist/components/SqlTextEditor.js +14 -0
  56. package/dist/components/UiComponents.js +37 -50
  57. package/dist/components/selectUtils.js +6 -16
  58. package/dist/contexts/BaseColorContext.js +3 -5
  59. package/dist/contexts/HoveredValueContext.js +3 -5
  60. package/dist/contexts/RootStylesContext.js +3 -5
  61. package/dist/contexts/SelectedValueContext.js +3 -5
  62. package/dist/contexts/index.js +4 -14
  63. package/dist/hooks/index.js +4 -14
  64. package/dist/hooks/useDashboard.d.ts +7 -0
  65. package/dist/hooks/useDashboard.d.ts.map +1 -0
  66. package/dist/hooks/useDashboard.js +49 -0
  67. package/dist/hooks/useInternalState.js +3 -5
  68. package/dist/hooks/useOnClickOutside.js +3 -5
  69. package/dist/hooks/useOnWindowResize.js +4 -6
  70. package/dist/hooks/useQuill.js +11 -15
  71. package/dist/hooks/useSelectOnKeyDown.js +4 -6
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +13 -28
  75. package/dist/internals/ReportBuilder/PivotList.js +14 -19
  76. package/dist/internals/ReportBuilder/PivotModal.js +84 -91
  77. package/dist/internals/ReportBuilder/PivotModal.spec.js +70 -72
  78. package/dist/lib/font.js +2 -5
  79. package/dist/lib/index.js +3 -19
  80. package/dist/lib/inputTypes.js +1 -2
  81. package/dist/lib/utils.js +8 -18
  82. package/dist/utils/aggregate.js +28 -34
  83. package/dist/utils/colorToHex.js +1 -4
  84. package/dist/utils/dataFetcher.js +2 -7
  85. package/dist/utils/downloadCSV.js +1 -5
  86. package/package.json +2 -1
@@ -1,43 +1,14 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.formatDateBuckets = exports.isArrayOfValidDates = exports.isValidDate = exports.ChartForm = void 0;
30
- const jsx_runtime_1 = require("react/jsx-runtime");
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
31
2
  // @ts-nocheck
32
- const react_1 = __importStar(require("react"));
33
- const date_fns_1 = require("date-fns");
34
- const dataFetcher_1 = require("./utils/dataFetcher");
35
- const Context_1 = require("./Context");
36
- const date_fns_2 = require("date-fns");
37
- const Chart_1 = __importDefault(require("./Chart"));
38
- const ReportBuilder_1 = require("./ReportBuilder");
39
- const aggregate_1 = require("./utils/aggregate");
40
- const assets_1 = require("./assets");
3
+ import React, { useContext, useEffect, useState } from 'react';
4
+ import { sub, startOfToday } from 'date-fns';
5
+ import { getData, getDataFromCloud } from './utils/dataFetcher';
6
+ import { ClientContext, SchemaContext, ThemeContext, DateFilterContext, DashboardContext, DashboardFiltersContext, } from './Context';
7
+ import { differenceInDays, differenceInHours, differenceInMonths, differenceInYears, startOfDay, startOfHour, startOfMonth, startOfYear, } from 'date-fns';
8
+ import Chart from './Chart';
9
+ import { getPostgresBasicType } from './ReportBuilder';
10
+ import { aggregate } from './utils/aggregate';
11
+ import { ArrowDownHeadIcon } from './assets';
41
12
  function convertPostgresColumn(column) {
42
13
  let format;
43
14
  switch (column.dataTypeID) {
@@ -83,7 +54,7 @@ function updateLabels(yAxisFields, values) {
83
54
  });
84
55
  }
85
56
  const DefaultSelectComponent = function DefaultSelect({ onChange, value, options, form, field, theme, }) {
86
- return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative' }, children: [(0, jsx_runtime_1.jsx)("select", { onChange: event => onChange(event.target.value), value: value, id: 'reportbuilderdropdown', style: {
57
+ return (_jsxs("div", { style: { position: 'relative' }, children: [_jsx("select", { onChange: event => onChange(event.target.value), value: value, id: 'reportbuilderdropdown', style: {
87
58
  width: 200,
88
59
  outline: 'none',
89
60
  textAlign: 'left',
@@ -102,7 +73,7 @@ const DefaultSelectComponent = function DefaultSelect({ onChange, value, options
102
73
  color: theme.primaryTextColor,
103
74
  boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
104
75
  fontFamily: theme.fontFamily,
105
- }, children: options.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.value, children: option.label }, option.label + index))) }), (0, jsx_runtime_1.jsx)(assets_1.ArrowDownHeadIcon, { style: {
76
+ }, children: options.map((option, index) => (_jsx("option", { value: option.value, children: option.label }, option.label + index))) }), _jsx(ArrowDownHeadIcon, { style: {
106
77
  height: '20px',
107
78
  width: '20px',
108
79
  flex: 'none',
@@ -112,9 +83,9 @@ const DefaultSelectComponent = function DefaultSelect({ onChange, value, options
112
83
  color: theme?.secondaryTextColor,
113
84
  }, "aria-hidden": "true" })] }));
114
85
  };
115
- const MemoizedDefaultSelectComponent = react_1.default.memo(DefaultSelectComponent);
86
+ const MemoizedDefaultSelectComponent = React.memo(DefaultSelectComponent);
116
87
  const DefaultTextInputComponent = function DefaultText({ onChange, value, id, theme, placeholder, }) {
117
- return ((0, jsx_runtime_1.jsx)("input", { style: {
88
+ return (_jsx("input", { style: {
118
89
  outline: 'none',
119
90
  textAlign: 'left',
120
91
  whiteSpace: 'nowrap',
@@ -138,21 +109,21 @@ const DefaultTextInputComponent = function DefaultText({ onChange, value, id, th
138
109
  fontFamily: theme.fontFamily,
139
110
  }, id: id, onChange: onChange, value: value, placeholder: placeholder }));
140
111
  };
141
- const MemoizedDefaultTextInputComponent = react_1.default.memo(DefaultTextInputComponent);
142
- function AddToDashboardModal({ isOpen, setIsOpen, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, rows, columns, query, report, ModalComponent, formHeaderStyle, formLabelStyle, showTableFormatOptions = false, showDateFieldOptions = false, showAccessControlOptions = false, onAddToDashboardComplete, fields, }) {
143
- const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
144
- const [client] = (0, react_1.useContext)(Context_1.ClientContext);
145
- const [schema, setSchema] = (0, react_1.useContext)(Context_1.SchemaContext);
112
+ const MemoizedDefaultTextInputComponent = React.memo(DefaultTextInputComponent);
113
+ export default function AddToDashboardModal({ isOpen, setIsOpen, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, rows, columns, query, report, ModalComponent, formHeaderStyle, formLabelStyle, showTableFormatOptions = false, showDateFieldOptions = false, showAccessControlOptions = false, onAddToDashboardComplete, fields, }) {
114
+ const [theme] = useContext(ThemeContext);
115
+ const [client] = useContext(ClientContext);
116
+ const [schema, setSchema] = useContext(SchemaContext);
146
117
  // const [organization, setOrganization] = useState([]);
147
- const { dispatch } = (0, react_1.useContext)(Context_1.DashboardContext);
118
+ const { dispatch } = useContext(DashboardContext);
148
119
  // showTableFormatOptions = false;
149
120
  // showDateFieldOptions = false;
150
121
  // showAccessControlOptions = false;3
151
- (0, react_1.useEffect)(() => {
122
+ useEffect(() => {
152
123
  let isSubscribed = true;
153
124
  async function getSchema() {
154
125
  if (!schema || !schema.length) {
155
- const resp = await (0, dataFetcher_1.getDataFromCloud)(client, `schema2/${client.publicKey}/`, null, 'GET');
126
+ const resp = await getDataFromCloud(client, `schema2/${client.publicKey}/`, null, 'GET');
156
127
  if (isSubscribed) {
157
128
  setSchema(resp.tables);
158
129
  }
@@ -347,7 +318,7 @@ function AddToDashboardModal({ isOpen, setIsOpen, SelectComponent, TextInputComp
347
318
  customerId: customerId,
348
319
  }
349
320
  : { clientId: publicKey }).toString();
350
- const resp = await (0, dataFetcher_1.getData)(client, `dashedit2?${searchParams}`, 'same-origin', hostedBody, cloudBody);
321
+ const resp = await getData(client, `dashedit2?${searchParams}`, 'same-origin', hostedBody, cloudBody);
351
322
  if (resp) {
352
323
  dispatch({
353
324
  type: 'UPDATE_DASHBOARD_ITEM',
@@ -369,13 +340,12 @@ function AddToDashboardModal({ isOpen, setIsOpen, SelectComponent, TextInputComp
369
340
  };
370
341
  return (
371
342
  // <BigModal theme={theme} showModal={isOpen} setShowModal={setIsOpen}>
372
- (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ModalComponent ? ((0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, title: 'Add to dashboard', onClose: () => setIsOpen(false), children: (0, jsx_runtime_1.jsx)(ChartForm, { editChart: editChart, theme: theme, schema: schema, data: rows, fields: columns, report: report, query: query, client: client,
343
+ _jsx(_Fragment, { children: ModalComponent ? (_jsx(ModalComponent, { isOpen: isOpen, title: 'Add to dashboard', onClose: () => setIsOpen(false), children: _jsx(ChartForm, { editChart: editChart, theme: theme, schema: schema, data: rows, fields: columns, report: report, query: query, client: client,
373
344
  // organizationName={organization?.name}
374
- SelectComponent: SelectComponent, TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, formHeaderStyle: formHeaderStyle, formLabelStyle: formLabelStyle, showTableFormatOptions: showTableFormatOptions, showDateFieldOptions: showDateFieldOptions, showAccessControlOptions: showAccessControlOptions, newFields: fields }) })) : ((0, jsx_runtime_1.jsx)(QuillModal, { isOpen: isOpen, onClose: () => setIsOpen(false), title: 'Add to dashboard', children: (0, jsx_runtime_1.jsx)(ChartForm, { editChart: editChart, theme: theme, schema: schema, data: rows, fields: columns, report: report, client: client, query: query,
345
+ SelectComponent: SelectComponent, TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, formHeaderStyle: formHeaderStyle, formLabelStyle: formLabelStyle, showTableFormatOptions: showTableFormatOptions, showDateFieldOptions: showDateFieldOptions, showAccessControlOptions: showAccessControlOptions, newFields: fields }) })) : (_jsx(QuillModal, { isOpen: isOpen, onClose: () => setIsOpen(false), title: 'Add to dashboard', children: _jsx(ChartForm, { editChart: editChart, theme: theme, schema: schema, data: rows, fields: columns, report: report, client: client, query: query,
375
346
  // organizationName={organization?.name}
376
347
  SelectComponent: SelectComponent, TextInputComponent: TextInputComponent, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, formHeaderStyle: formHeaderStyle, formLabelStyle: formLabelStyle, showTableFormatOptions: showTableFormatOptions, showDateFieldOptions: showDateFieldOptions, showAccessControlOptions: showAccessControlOptions, newFields: fields }) })) }));
377
348
  }
378
- exports.default = AddToDashboardModal;
379
349
  function QuillModal({ isOpen, onClose, setIsOpen, title, children }) {
380
350
  const scrollPosition = 0;
381
351
  // useEffect(() => {
@@ -397,7 +367,7 @@ function QuillModal({ isOpen, onClose, setIsOpen, title, children }) {
397
367
  if (!isOpen) {
398
368
  return null;
399
369
  }
400
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
370
+ return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
401
371
  position: 'fixed',
402
372
  top: '0',
403
373
  right: '0',
@@ -406,7 +376,7 @@ function QuillModal({ isOpen, onClose, setIsOpen, title, children }) {
406
376
  zIndex: '50',
407
377
  backgroundColor: 'rgba(255, 255, 255, 0.8)',
408
378
  backdropFilter: 'blur(5px)',
409
- }, onClick: onClose }), (0, jsx_runtime_1.jsx)("div", { style: {
379
+ }, onClick: onClose }), _jsx("div", { style: {
410
380
  // position: "absolute",
411
381
  position: 'fixed',
412
382
  left: '50%',
@@ -426,7 +396,7 @@ function QuillModal({ isOpen, onClose, setIsOpen, title, children }) {
426
396
  borderColor: '#e7e7e7',
427
397
  overflow: 'hidden',
428
398
  // zIndex: 1000,
429
- }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
399
+ }, children: _jsxs("div", { style: {
430
400
  // width: "80%",
431
401
  maxHeight: '90vh',
432
402
  overflowY: 'scroll',
@@ -437,7 +407,7 @@ function QuillModal({ isOpen, onClose, setIsOpen, title, children }) {
437
407
  display: 'flex',
438
408
  flexDirection: 'column',
439
409
  alignItems: 'center',
440
- }, children: [(0, jsx_runtime_1.jsx)("h2", { style: {
410
+ }, children: [_jsx("h2", { style: {
441
411
  marginLeft: 35,
442
412
  marginTop: 25,
443
413
  fontSize: 18,
@@ -446,7 +416,7 @@ function QuillModal({ isOpen, onClose, setIsOpen, title, children }) {
446
416
  textAlign: 'left',
447
417
  }, children: title }), children] }) })] }));
448
418
  }
449
- function ChartForm({ data, fields, theme, saveVisualization, report, editChart, schema, query, organizationName, SelectComponent, TextInputComponent, client, ButtonComponent, SecondaryButtonComponent, formHeaderStyle, formLabelStyle, showTableFormatOptions, showDateFieldOptions, showAccessControlOptions, newFields, }) {
419
+ export function ChartForm({ data, fields, theme, saveVisualization, report, editChart, schema, query, organizationName, SelectComponent, TextInputComponent, client, ButtonComponent, SecondaryButtonComponent, formHeaderStyle, formLabelStyle, showTableFormatOptions, showDateFieldOptions, showAccessControlOptions, newFields, }) {
450
420
  if (report) {
451
421
  newFields = report.fields;
452
422
  }
@@ -461,16 +431,16 @@ function ChartForm({ data, fields, theme, saveVisualization, report, editChart,
461
431
  }));
462
432
  const xAxisOptions = data?.length
463
433
  ? Object.keys(data[0])
464
- .filter(option => (0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option)) === 'date' ||
465
- (0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option)) === 'string')
434
+ .filter(option => getPostgresBasicType(newFields.find(field => field.name === option)) === 'date' ||
435
+ getPostgresBasicType(newFields.find(field => field.name === option)) === 'string')
466
436
  .map(field => ({
467
437
  value: field,
468
438
  label: field,
469
439
  }))
470
440
  : fields
471
441
  .filter(option => {
472
- return ((0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option.field)) === 'date' ||
473
- (0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option.field)) === 'string');
442
+ return (getPostgresBasicType(newFields.find(field => field.name === option.field)) === 'date' ||
443
+ getPostgresBasicType(newFields.find(field => field.name === option.field)) === 'string');
474
444
  })
475
445
  .map(field => ({
476
446
  value: field.field,
@@ -478,22 +448,22 @@ function ChartForm({ data, fields, theme, saveVisualization, report, editChart,
478
448
  }));
479
449
  const yAxisOptions = data?.length
480
450
  ? Object.keys(data[0])
481
- .filter(option => (0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option)) === 'number')
451
+ .filter(option => getPostgresBasicType(newFields.find(field => field.name === option)) === 'number')
482
452
  .map(field => ({
483
453
  value: field,
484
454
  label: field,
485
455
  }))
486
456
  : fields
487
457
  .filter(option => {
488
- return ((0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option.field)) === 'number');
458
+ return (getPostgresBasicType(newFields.find(field => field.name === option.field)) === 'number');
489
459
  })
490
460
  .map(field => ({
491
461
  value: field.field,
492
462
  label: field.field,
493
463
  }));
494
- const [dateFieldOptions, setDateFieldOptions] = (0, react_1.useState)([]);
495
- const [formValues, setFormValues] = (0, react_1.useState)({});
496
- (0, react_1.useEffect)(() => {
464
+ const [dateFieldOptions, setDateFieldOptions] = useState([]);
465
+ const [formValues, setFormValues] = useState({});
466
+ useEffect(() => {
497
467
  const fetchReferencedTables = async () => {
498
468
  if (!query) {
499
469
  return;
@@ -503,7 +473,7 @@ function ChartForm({ data, fields, theme, saveVisualization, report, editChart,
503
473
  };
504
474
  fetchReferencedTables();
505
475
  }, [query, schema]);
506
- return ((0, jsx_runtime_1.jsx)(FormikForm, { data: data, xAxisOptions: xAxisOptions, yAxisOptions: yAxisOptions, fieldOptions: fieldOptions, dateFieldOptions: dateFieldOptions, theme: theme, saveVisualization: saveVisualization, report: report, editChart: editChart, client: client, fields: fields, newFields: newFields, query: query, showTableFormatOptions: showTableFormatOptions, showDateFieldOptions: showDateFieldOptions, showAccessControlOptions: showAccessControlOptions, organizationName: organizationName, SelectComponent: SelectComponent
476
+ return (_jsx(FormikForm, { data: data, xAxisOptions: xAxisOptions, yAxisOptions: yAxisOptions, fieldOptions: fieldOptions, dateFieldOptions: dateFieldOptions, theme: theme, saveVisualization: saveVisualization, report: report, editChart: editChart, client: client, fields: fields, newFields: newFields, query: query, showTableFormatOptions: showTableFormatOptions, showDateFieldOptions: showDateFieldOptions, showAccessControlOptions: showAccessControlOptions, organizationName: organizationName, SelectComponent: SelectComponent
507
477
  ? ({ onChange, value, options, form, field, }) => {
508
478
  const handleChange = async (option) => {
509
479
  if (onChange) {
@@ -513,14 +483,14 @@ function ChartForm({ data, fields, theme, saveVisualization, report, editChart,
513
483
  await form.setFieldValue(field.name, option);
514
484
  form.setFieldTouched(field.name, true);
515
485
  };
516
- return ((0, jsx_runtime_1.jsx)(SelectComponent, { onChange: event => handleChange(event.target.value), value: value, options: options }));
486
+ return (_jsx(SelectComponent, { onChange: event => handleChange(event.target.value), value: value, options: options }));
517
487
  }
518
488
  : MemoizedDefaultSelectComponent, TextInputComponent: TextInputComponent
519
489
  ? TextInputComponent
520
490
  : MemoizedDefaultTextInputComponent, ButtonComponent: ButtonComponent
521
491
  ? ButtonComponent
522
492
  : ({ onClick, label }) => {
523
- return ((0, jsx_runtime_1.jsx)("div", { style: {
493
+ return (_jsx("div", { style: {
524
494
  height: 38,
525
495
  background: theme.primaryButtonColor,
526
496
  color: theme.backgroundColor,
@@ -538,7 +508,7 @@ function ChartForm({ data, fields, theme, saveVisualization, report, editChart,
538
508
  }, SecondaryButtonComponent: ButtonComponent
539
509
  ? ButtonComponent
540
510
  : ({ onClick, label }) => {
541
- return ((0, jsx_runtime_1.jsx)("div", { style: {
511
+ return (_jsx("div", { style: {
542
512
  height: 38,
543
513
  background: theme.backgroundColor,
544
514
  borderWidth: theme.borderWidth,
@@ -556,65 +526,61 @@ function ChartForm({ data, fields, theme, saveVisualization, report, editChart,
556
526
  }, onClick: onClick, children: label }));
557
527
  }, formHeaderStyle: formHeaderStyle, formLabelStyle: formLabelStyle }));
558
528
  }
559
- exports.ChartForm = ChartForm;
560
- function isValidDate(d) {
529
+ export function isValidDate(d) {
561
530
  return d instanceof Date && !isNaN(d);
562
531
  }
563
- exports.isValidDate = isValidDate;
564
- const isArrayOfValidDates = (arr, field) => arr.every(d => new Date(d[field]) instanceof Date && !isNaN(new Date(d[field])));
565
- exports.isArrayOfValidDates = isArrayOfValidDates;
566
- function formatDateBuckets(startDate, endDate) {
532
+ export const isArrayOfValidDates = (arr, field) => arr.every(d => new Date(d[field]) instanceof Date && !isNaN(new Date(d[field])));
533
+ export function formatDateBuckets(startDate, endDate) {
567
534
  // Calculate the distance in hours
568
- const distanceInHours = Math.abs((0, date_fns_2.differenceInHours)(endDate, startDate));
535
+ const distanceInHours = Math.abs(differenceInHours(endDate, startDate));
569
536
  // Check if the distance is less than or equal to one hour
570
537
  if (distanceInHours <= 1) {
571
538
  return {
572
539
  unit: 'hour',
573
540
  format: 'h a',
574
- startOf: date_fns_2.startOfHour,
541
+ startOf: startOfHour,
575
542
  };
576
543
  }
577
544
  // Calculate the distance in days
578
- const distanceInDays = Math.abs((0, date_fns_2.differenceInDays)(endDate, startDate));
545
+ const distanceInDays = Math.abs(differenceInDays(endDate, startDate));
579
546
  // Check if the distance is less than or equal to one day
580
547
  if (distanceInDays <= 1) {
581
548
  return {
582
549
  unit: 'day',
583
550
  format: 'MMM d',
584
- startOf: date_fns_2.startOfDay,
551
+ startOf: startOfDay,
585
552
  };
586
553
  }
587
554
  // Calculate the distance in months
588
- const distanceInMonths = Math.abs((0, date_fns_2.differenceInMonths)(endDate, startDate));
555
+ const distanceInMonths = Math.abs(differenceInMonths(endDate, startDate));
589
556
  // Check if the distance is less than or equal to one month
590
557
  if (distanceInMonths <= 1) {
591
558
  return {
592
559
  unit: 'month',
593
560
  format: 'MMM yyyy',
594
- startOf: date_fns_2.startOfMonth,
561
+ startOf: startOfMonth,
595
562
  };
596
563
  }
597
564
  // Calculate the distance in years
598
- const distanceInYears = Math.abs((0, date_fns_2.differenceInYears)(endDate, startDate));
565
+ const distanceInYears = Math.abs(differenceInYears(endDate, startDate));
599
566
  // Check if the distance is less than or equal to one year
600
567
  if (distanceInYears <= 1) {
601
568
  return {
602
569
  unit: 'year',
603
570
  format: 'yyyy',
604
- startOf: date_fns_2.startOfYear,
571
+ startOf: startOfYear,
605
572
  };
606
573
  }
607
574
  // Otherwise, the distance is more than one year
608
575
  return {
609
576
  unit: 'year',
610
577
  format: 'yyyy',
611
- startOf: date_fns_2.startOfYear,
578
+ startOf: startOfYear,
612
579
  };
613
580
  }
614
- exports.formatDateBuckets = formatDateBuckets;
615
581
  const FormTextInput = ({ field, form, ...props }) => {
616
582
  const { theme, wider } = props;
617
- return ((0, jsx_runtime_1.jsx)("input", { className: `px-[12px] text-sm h-[38px] py-1.5 shadow-sm w-[245px] border-[#E7E7E7] ${'text-[#212121]'} border-[1px] bg-[white] rounded-md`, type: "text", ...field, ...props }));
583
+ return (_jsx("input", { className: `px-[12px] text-sm h-[38px] py-1.5 shadow-sm w-[245px] border-[#E7E7E7] ${'text-[#212121]'} border-[1px] bg-[white] rounded-md`, type: "text", ...field, ...props }));
618
584
  };
619
585
  const POSTGRES_DATE_TYPES = [
620
586
  'timestamp',
@@ -627,7 +593,7 @@ async function getReferencedTables(client, sqlQuery, dbTables) {
627
593
  // const parser = new Parser();
628
594
  const tables = [];
629
595
  const withAliases = [];
630
- const resp = await (0, dataFetcher_1.getDataFromCloud)(client, `astify`, { query: sqlQuery });
596
+ const resp = await getDataFromCloud(client, `astify`, { query: sqlQuery });
631
597
  let ast = resp.ast;
632
598
  ast = ast.length ? ast[0] : ast;
633
599
  if (ast.with && ast.with.length) {
@@ -678,7 +644,7 @@ const Y_FORMAT_OPTIONS = [
678
644
  { value: 'string', label: 'string' },
679
645
  ];
680
646
  const handleBucketData = (dashboardItem, bucketFields, dateFilter) => {
681
- return (0, aggregate_1.aggregate)(dashboardItem, bucketFields, dateFilter);
647
+ return aggregate(dashboardItem, bucketFields, dateFilter);
682
648
  };
683
649
  function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldOptions, theme, report, editChart, fields, newFields, query, client, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, organizationName, formHeaderStyle, formLabelStyle, showTableFormatOptions, showDateFieldOptions, showAccessControlOptions, }) {
684
650
  // fieldOptions.sort((a, b) => {
@@ -701,24 +667,24 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
701
667
  return 1;
702
668
  return 0;
703
669
  });
704
- const { dashboardFilters, dashboardFiltersDispatch } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
705
- const [rows, setRows] = (0, react_1.useState)(null);
706
- const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
707
- const [xAxisField, setXAxisField] = (0, react_1.useState)(report?.xAxisField ||
670
+ const { dashboardFilters, dashboardFiltersDispatch } = useContext(DashboardFiltersContext);
671
+ const [rows, setRows] = useState(null);
672
+ const [isSubmitting, setIsSubmitting] = useState(false);
673
+ const [xAxisField, setXAxisField] = useState(report?.xAxisField ||
708
674
  (xAxisOptions && xAxisOptions.length && xAxisOptions[0].value) ||
709
675
  '');
710
- const [xAxisLabel, setXAxisLabel] = (0, react_1.useState)(report?.xAxisLabel || '');
711
- const [xAxisFormat, setXAxisFormat] = (0, react_1.useState)(report?.xAxisFormat ||
676
+ const [xAxisLabel, setXAxisLabel] = useState(report?.xAxisLabel || '');
677
+ const [xAxisFormat, setXAxisFormat] = useState(report?.xAxisFormat ||
712
678
  (X_FORMAT_OPTIONS.length && X_FORMAT_OPTIONS[0].value) ||
713
679
  '');
714
- const [chartName, setChartName] = (0, react_1.useState)(report?.name || '');
715
- const [chartType, setChartType] = (0, react_1.useState)(report?.chartType || 'column');
716
- const [dateFieldTable, setDateFieldTable] = (0, react_1.useState)((dateFieldOptions.length && dateFieldOptions[0].name) || '');
717
- const [dateField, setDateField] = (0, react_1.useState)((dateFieldOptions.length && dateFieldOptions[0].columns[0].name) || '');
718
- const [template, setTemplate] = (0, react_1.useState)(report?.template || false);
719
- const [chartConfig, setChartConfig] = (0, react_1.useState)({});
720
- const { dateFilter, setDateFilter } = (0, react_1.useContext)(Context_1.DateFilterContext);
721
- const [yAxisFields, setYAxisFields] = (0, react_1.useState)(report
680
+ const [chartName, setChartName] = useState(report?.name || '');
681
+ const [chartType, setChartType] = useState(report?.chartType || 'column');
682
+ const [dateFieldTable, setDateFieldTable] = useState((dateFieldOptions.length && dateFieldOptions[0].name) || '');
683
+ const [dateField, setDateField] = useState((dateFieldOptions.length && dateFieldOptions[0].columns[0].name) || '');
684
+ const [template, setTemplate] = useState(report?.template || false);
685
+ const [chartConfig, setChartConfig] = useState({});
686
+ const { dateFilter, setDateFilter } = useContext(DateFilterContext);
687
+ const [yAxisFields, setYAxisFields] = useState(report
722
688
  ? report.yAxisFields
723
689
  : [
724
690
  {
@@ -729,8 +695,8 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
729
695
  format: 'whole_number',
730
696
  },
731
697
  ]);
732
- const [bucketFields, setBucketFields] = (0, react_1.useState)((report && report.buckets) || []);
733
- const [columns, setColumns] = (0, react_1.useState)(report && report.columns.length
698
+ const [bucketFields, setBucketFields] = useState((report && report.buckets) || []);
699
+ const [columns, setColumns] = useState(report && report.columns.length
734
700
  ? report.columns
735
701
  : fields?.length
736
702
  ? fields.map(field => convertPostgresColumn(field))
@@ -785,7 +751,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
785
751
  ]);
786
752
  };
787
753
  const handleAddBucket = () => {
788
- const bucketPossibilities = xAxisOptions.filter(option => (0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === option.value)) === 'date');
754
+ const bucketPossibilities = xAxisOptions.filter(option => getPostgresBasicType(newFields.find(field => field.name === option.value)) === 'date');
789
755
  if (!bucketPossibilities.length) {
790
756
  alert('No possible buckets');
791
757
  return;
@@ -801,12 +767,12 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
801
767
  setXAxisFormat('dynamic');
802
768
  }
803
769
  else {
804
- setXAxisFormat(postgresFormatMap((0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === bucketPossibilities[0].value))));
770
+ setXAxisFormat(postgresFormatMap(getPostgresBasicType(newFields.find(field => field.name === bucketPossibilities[0].value))));
805
771
  }
806
772
  };
807
- const [dashboardOptions, setDashboardOptions] = (0, react_1.useState)([]);
808
- const [dashboardName, setDashboardName] = (0, react_1.useState)(report?.dashboardName || dashboardOptions[0]);
809
- (0, react_1.useEffect)(() => {
773
+ const [dashboardOptions, setDashboardOptions] = useState([]);
774
+ const [dashboardName, setDashboardName] = useState(report?.dashboardName || dashboardOptions[0]);
775
+ useEffect(() => {
810
776
  if (!report && dashboardOptions && dashboardOptions.length) {
811
777
  setDashboardName(dashboardOptions[0].value);
812
778
  }
@@ -821,8 +787,8 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
821
787
  dateFieldTable,
822
788
  dateField,
823
789
  };
824
- const [selectedTabIndex, setSelectedTabIndex] = (0, react_1.useState)(report && report.template ? 1 : 0);
825
- react_1.default.useEffect(() => {
790
+ const [selectedTabIndex, setSelectedTabIndex] = useState(report && report.template ? 1 : 0);
791
+ React.useEffect(() => {
826
792
  async function getDashboards() {
827
793
  const { publicKey, customerId, queryEndpoint } = client;
828
794
  if (customerId || queryEndpoint) {
@@ -839,16 +805,16 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
839
805
  ? { orgId: customerId, name, task: 'config' }
840
806
  : { name: dashboardName, task: 'config' },
841
807
  };
842
- const resp = await (0, dataFetcher_1.getData)(client, `dashconfig?${searchParams}`, 'omit', hostedBody, null, 'GET');
808
+ const resp = await getData(client, `dashconfig?${searchParams}`, 'omit', hostedBody, null, 'GET');
843
809
  const bigFilterObj = {};
844
810
  if (resp.dateFilter && Object.keys(resp.dateFilter).length) {
845
811
  if (resp.dateFilter.initialRange === 'LAST_90_DAYS') {
846
812
  const filter = {
847
- startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
813
+ startDate: sub(startOfToday(), { days: 90 }),
848
814
  endDate: new Date(),
849
815
  filterType: 'date_range',
850
816
  selectedValue: [
851
- (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
817
+ sub(startOfToday(), { days: 90 }),
852
818
  new Date(),
853
819
  '90d',
854
820
  ],
@@ -867,11 +833,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
867
833
  }
868
834
  else if (resp.dateFilter.initialRange === 'LAST_30_DAYS') {
869
835
  const filter = {
870
- startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }),
836
+ startDate: sub(startOfToday(), { days: 30 }),
871
837
  endDate: new Date(),
872
838
  filterType: 'date_range',
873
839
  selectedValue: [
874
- (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }),
840
+ sub(startOfToday(), { days: 30 }),
875
841
  new Date(),
876
842
  't',
877
843
  ],
@@ -892,10 +858,10 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
892
858
  }
893
859
  else if (resp.dateFilter.initialRange === 'CURRENT_MONTH') {
894
860
  const filter = {
895
- startDate: (0, date_fns_2.startOfMonth)(new Date()),
861
+ startDate: startOfMonth(new Date()),
896
862
  endDate: new Date(),
897
863
  filterType: 'date_range',
898
- selectedValue: [(0, date_fns_2.startOfMonth)(new Date()), new Date(), 'm'],
864
+ selectedValue: [startOfMonth(new Date()), new Date(), 'm'],
899
865
  options: options,
900
866
  field: 'date_range',
901
867
  label: 'Date',
@@ -912,11 +878,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
912
878
  }
913
879
  else {
914
880
  const filter = {
915
- startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
881
+ startDate: sub(startOfToday(), { days: 90 }),
916
882
  endDate: new Date(),
917
883
  filterType: 'date_range',
918
884
  selectedValue: [
919
- (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
885
+ sub(startOfToday(), { days: 90 }),
920
886
  new Date(),
921
887
  '90d',
922
888
  ],
@@ -959,16 +925,16 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
959
925
  }
960
926
  getDashboards();
961
927
  }, [dashboardName, client]);
962
- (0, react_1.useEffect)(() => {
928
+ useEffect(() => {
963
929
  async function getDashNames() {
964
- const resp = await (0, dataFetcher_1.getDataFromCloud)(client, `dashnames/${client.publicKey}/`, null, 'GET');
930
+ const resp = await getDataFromCloud(client, `dashnames/${client.publicKey}/`, null, 'GET');
965
931
  setDashboardOptions(resp.dashboardNames
966
932
  .filter(elem => elem !== null)
967
933
  .map(key => ({ label: key, value: key })));
968
934
  }
969
935
  getDashNames();
970
936
  }, []);
971
- (0, react_1.useEffect)(() => {
937
+ useEffect(() => {
972
938
  // if (!dateField) {
973
939
  // return;
974
940
  // }
@@ -986,7 +952,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
986
952
  return;
987
953
  }
988
954
  }, [chartType, dateField]);
989
- (0, react_1.useEffect)(() => {
955
+ useEffect(() => {
990
956
  if (dateFieldOptions.length) {
991
957
  setDateFieldTable(dateFieldOptions[0].name);
992
958
  setDateField(dateFieldOptions[0].columns[0].name);
@@ -1012,7 +978,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1012
978
  setXAxisFormat('dynamic');
1013
979
  }
1014
980
  else {
1015
- setXAxisFormat(postgresFormatMap((0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === value))));
981
+ setXAxisFormat(postgresFormatMap(getPostgresBasicType(newFields.find(field => field.name === value))));
1016
982
  }
1017
983
  };
1018
984
  const handleXAxisFieldChange = value => {
@@ -1030,7 +996,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1030
996
  setXAxisFormat('dynamic');
1031
997
  }
1032
998
  else {
1033
- setXAxisFormat(postgresFormatMap((0, ReportBuilder_1.getPostgresBasicType)(newFields.find(field => field.name === value))));
999
+ setXAxisFormat(postgresFormatMap(getPostgresBasicType(newFields.find(field => field.name === value))));
1034
1000
  }
1035
1001
  if (bucketFields.length > 0) {
1036
1002
  const newBucketFields = [...bucketFields];
@@ -1072,7 +1038,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1072
1038
  newColumns[index] = { ...newColumns[index], label: value };
1073
1039
  setColumns(newColumns);
1074
1040
  };
1075
- (0, react_1.useEffect)(() => {
1041
+ useEffect(() => {
1076
1042
  const now = new Date();
1077
1043
  if (!dateFilter ||
1078
1044
  (dateFilter && dateFilter.startDate && dateFilter.endDate)) {
@@ -1107,15 +1073,15 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1107
1073
  columns,
1108
1074
  dateFilter,
1109
1075
  ]);
1110
- return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'inline-block' }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1076
+ return (_jsx("div", { style: { display: 'inline-block' }, children: _jsxs("div", { style: {
1111
1077
  display: 'flex',
1112
1078
  flexDirection: 'column',
1113
1079
  paddingLeft: 25,
1114
1080
  paddingRight: chartConfig.chartType === 'pie' ? 25 : undefined,
1115
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1081
+ }, children: [_jsxs("div", { style: {
1116
1082
  display: 'flex',
1117
1083
  flexDirection: 'column',
1118
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)("div", { style: {
1084
+ }, children: [_jsx("div", { style: { height: 20 } }), _jsx("div", { style: {
1119
1085
  marginRight: chartConfig.chartType === 'pie' ||
1120
1086
  chartConfig.chartType === 'table'
1121
1087
  ? undefined
@@ -1124,36 +1090,36 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1124
1090
  chartConfig.chartType === 'table'
1125
1091
  ? undefined
1126
1092
  : -25,
1127
- }, children: Object.keys(chartConfig).length > 0 && ((0, jsx_runtime_1.jsx)(Chart_1.default, { config: chartConfig, colors: theme.chartColors, containerStyle: {
1093
+ }, children: Object.keys(chartConfig).length > 0 && (_jsx(Chart, { config: chartConfig, colors: theme.chartColors, containerStyle: {
1128
1094
  width: chartConfig.chartType === 'table'
1129
1095
  ? 640
1130
1096
  : 'calc(100% - 24px)',
1131
1097
  height: 300,
1132
- } })) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 40 } }), showTableFormatOptions || showDateFieldOptions ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { style: formHeaderStyle || {
1098
+ } })) }), _jsx("div", { style: { height: 40 } }), showTableFormatOptions || showDateFieldOptions ? (_jsx(_Fragment, { children: _jsx("div", { style: formHeaderStyle || {
1133
1099
  fontFamily: theme.fontFamily,
1134
1100
  color: theme.primaryTextColor,
1135
1101
  fontSize: theme.fontSize + 2,
1136
1102
  fontWeight: 600,
1137
- }, children: 'Chart' }) })) : null, (0, jsx_runtime_1.jsxs)("div", { style: {
1103
+ }, children: 'Chart' }) })) : null, _jsxs("div", { style: {
1138
1104
  display: 'flex',
1139
1105
  flexDirection: 'row',
1140
1106
  alignItems: 'center',
1141
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 8 }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1107
+ }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 8 }, children: [_jsx("div", { style: formLabelStyle || {
1142
1108
  color: theme.secondaryTextColor,
1143
1109
  fontFamily: theme?.fontFamily,
1144
1110
  fontSize: theme?.fontSize || '14px',
1145
1111
  fontWeight: theme.labelFontWeight || '600',
1146
- }, children: "Name" }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200, marginTop: 6 }, children: (0, jsx_runtime_1.jsx)(TextInputComponent, { onChange: e => setChartName(e.target.value), value: chartName, theme: theme, placeholder: 'Enter a chart name' }) })] }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 8 }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1112
+ }, children: "Name" }), _jsx("div", { style: { minWidth: 200, marginTop: 6 }, children: _jsx(TextInputComponent, { onChange: e => setChartName(e.target.value), value: chartName, theme: theme, placeholder: 'Enter a chart name' }) })] }), _jsx("div", { style: { width: 20 } }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 8 }, children: [_jsx("div", { style: formLabelStyle || {
1147
1113
  color: theme.secondaryTextColor,
1148
1114
  fontFamily: theme?.fontFamily,
1149
1115
  fontSize: theme?.fontSize || '14px',
1150
1116
  fontWeight: theme.labelFontWeight || '600',
1151
- }, children: "Dashboard name" }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200, marginTop: 6 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: value => setDashboardName(value), value: dashboardName, theme: theme, options: dashboardOptions }) })] }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 8 }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1117
+ }, children: "Dashboard name" }), _jsx("div", { style: { minWidth: 200, marginTop: 6 }, children: _jsx(SelectComponent, { onChange: value => setDashboardName(value), value: dashboardName, theme: theme, options: dashboardOptions }) })] }), _jsx("div", { style: { width: 20 } }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 8 }, children: [_jsx("div", { style: formLabelStyle || {
1152
1118
  color: theme.secondaryTextColor,
1153
1119
  fontFamily: theme?.fontFamily,
1154
1120
  fontSize: theme?.fontSize || '14px',
1155
1121
  fontWeight: theme.labelFontWeight || '600',
1156
- }, children: "Chart type" }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200, marginTop: 6 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: e => setChartType(e), value: chartType, options: [
1122
+ }, children: "Chart type" }), _jsx("div", { style: { minWidth: 200, marginTop: 6 }, children: _jsx(SelectComponent, { onChange: e => setChartType(e), value: chartType, options: [
1157
1123
  { label: 'column', value: 'column' },
1158
1124
  { label: 'bar', value: 'bar' },
1159
1125
  { label: 'line', value: 'line' },
@@ -1162,29 +1128,29 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1162
1128
  { label: 'table', value: 'table' },
1163
1129
  ], theme: theme }) })] })] })] }), chartType !== 'table' &&
1164
1130
  chartType !== 'metric' &&
1165
- chartType !== 'pie' && ((0, jsx_runtime_1.jsxs)("div", { style: {
1131
+ chartType !== 'pie' && (_jsxs("div", { style: {
1166
1132
  display: 'flex',
1167
1133
  flexDirection: 'column',
1168
1134
  marginTop: 20,
1169
1135
  maxWidth: 200,
1170
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1136
+ }, children: [_jsx("div", { style: formLabelStyle || {
1171
1137
  color: theme.secondaryTextColor,
1172
1138
  fontFamily: theme?.fontFamily,
1173
1139
  fontSize: theme?.fontSize || '14px',
1174
1140
  fontWeight: theme.labelFontWeight || '600',
1175
- }, children: "Buckets" }), (0, jsx_runtime_1.jsx)("div", { style: {
1141
+ }, children: "Buckets" }), _jsx("div", { style: {
1176
1142
  maxWidth: 200,
1177
1143
  // marginTop: 6,
1178
1144
  display: 'flex',
1179
1145
  flexDirection: 'column',
1180
- }, children: bucketFields.map((bucketField, index) => ((0, jsx_runtime_1.jsxs)("div", { style: {
1146
+ }, children: bucketFields.map((bucketField, index) => (_jsxs("div", { style: {
1181
1147
  display: 'flex',
1182
1148
  flexDirection: 'row',
1183
1149
  alignItems: 'center',
1184
1150
  marginTop: index === 0 ? 6 : 10,
1185
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: option => handleBucketFieldChange(index, option), value: bucketField.field,
1151
+ }, children: [_jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { onChange: option => handleBucketFieldChange(index, option), value: bucketField.field,
1186
1152
  // TODO: PROB FILTER OUT NUMBERS LMAO (SO DATE AND STRING ONLY)
1187
- options: xAxisOptions, theme: theme }) }), (0, jsx_runtime_1.jsx)("div", { onClick: () => handleDeleteBucketField(index), style: {
1153
+ options: xAxisOptions, theme: theme }) }), _jsx("div", { onClick: () => handleDeleteBucketField(index), style: {
1188
1154
  cursor: 'pointer',
1189
1155
  paddingLeft: 6,
1190
1156
  paddingTop: 9,
@@ -1194,28 +1160,28 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1194
1160
  display: 'flex',
1195
1161
  alignItems: 'center',
1196
1162
  justifyContent: 'center',
1197
- }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: theme?.secondaryTextColor, height: "20", width: "20", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }, `bucketField-${index}`))) }), !bucketFields.length && ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 12 }, children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: handleAddBucket, label: "Add bucket +" }) }))] })), (0, jsx_runtime_1.jsx)("div", { style: {
1163
+ }, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: theme?.secondaryTextColor, height: "20", width: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }, `bucketField-${index}`))) }), !bucketFields.length && (_jsx("div", { style: { marginTop: 12 }, children: _jsx(SecondaryButtonComponent, { onClick: handleAddBucket, label: "Add bucket +" }) }))] })), _jsx("div", { style: {
1198
1164
  display: 'flex',
1199
1165
  flexDirection: 'row',
1200
1166
  alignItems: 'center',
1201
1167
  // justifyContent: 'space-between',
1202
1168
  marginTop: 20,
1203
- }, children: chartType !== 'table' && ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1169
+ }, children: chartType !== 'table' && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: formLabelStyle || {
1204
1170
  color: theme.secondaryTextColor,
1205
1171
  fontFamily: theme?.fontFamily,
1206
1172
  fontSize: theme?.fontSize || '14px',
1207
1173
  fontWeight: theme.labelFontWeight || '600',
1208
- }, children: chartType === 'pie' ? 'Category column' : 'x-axis column' }), (0, jsx_runtime_1.jsx)("div", { style: { height: 6 } }), (0, jsx_runtime_1.jsxs)("div", { style: {
1174
+ }, children: chartType === 'pie' ? 'Category column' : 'x-axis column' }), _jsx("div", { style: { height: 6 } }), _jsxs("div", { style: {
1209
1175
  display: 'flex',
1210
1176
  flexDirection: 'row',
1211
1177
  alignItems: 'center',
1212
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: e => handleXAxisFieldChange(e), value: xAxisField, options: xAxisOptions, theme: theme }) }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(TextInputComponent, { onChange: e => setXAxisLabel(e.target.value), value: xAxisLabel, theme: theme, placeholder: 'Enter a label' }) }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: e => setXAxisFormat(e), value: xAxisFormat, options: X_FORMAT_OPTIONS, theme: theme }) })] })] })) }), (0, jsx_runtime_1.jsxs)("div", { style: {
1178
+ }, children: [_jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { onChange: e => handleXAxisFieldChange(e), value: xAxisField, options: xAxisOptions, theme: theme }) }), _jsx("div", { style: { width: 20 } }), _jsx("div", { style: { minWidth: 200 }, children: _jsx(TextInputComponent, { onChange: e => setXAxisLabel(e.target.value), value: xAxisLabel, theme: theme, placeholder: 'Enter a label' }) }), _jsx("div", { style: { width: 20 } }), _jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { onChange: e => setXAxisFormat(e), value: xAxisFormat, options: X_FORMAT_OPTIONS, theme: theme }) })] })] })) }), _jsxs("div", { style: {
1213
1179
  display: 'flex',
1214
1180
  flexDirection: 'row',
1215
1181
  alignItems: 'flex-start',
1216
1182
  // justifyContent: 'space-between',
1217
1183
  marginTop: 20,
1218
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1184
+ }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: formLabelStyle || {
1219
1185
  color: theme.secondaryTextColor,
1220
1186
  fontFamily: theme?.fontFamily,
1221
1187
  fontSize: theme?.fontSize || '14px',
@@ -1224,32 +1190,32 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1224
1190
  ? 'Columns'
1225
1191
  : chartType === 'pie'
1226
1192
  ? 'Quantity column'
1227
- : 'y-axis columns' }), (0, jsx_runtime_1.jsxs)("div", { style: {
1193
+ : 'y-axis columns' }), _jsxs("div", { style: {
1228
1194
  display: 'flex',
1229
1195
  flexDirection: 'column',
1230
- }, children: [yAxisFields.map((yAxisField, index) => ((0, jsx_runtime_1.jsx)("div", { style: {
1196
+ }, children: [yAxisFields.map((yAxisField, index) => (_jsx("div", { style: {
1231
1197
  display: 'flex',
1232
1198
  flexDirection: 'row',
1233
1199
  alignItems: 'center',
1234
1200
  marginTop: index === 0 ? 6 : 10,
1235
- }, children: (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: option => handleYAxisFieldChange(index, option), value: yAxisField.field, options: chartType === 'table' ? fieldOptions : yAxisOptions, theme: theme }) }) }, `yAxisField-${index}`))), chartType !== 'pie' && ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 12 }, children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: handleAddYAxisField, label: "Add column +" }) })), (0, jsx_runtime_1.jsx)("div", { style: { height: 10 } })] })] }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsxs)("div", { style: {
1201
+ }, children: _jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { onChange: option => handleYAxisFieldChange(index, option), value: yAxisField.field, options: chartType === 'table' ? fieldOptions : yAxisOptions, theme: theme }) }) }, `yAxisField-${index}`))), chartType !== 'pie' && (_jsx("div", { style: { marginTop: 12 }, children: _jsx(SecondaryButtonComponent, { onClick: handleAddYAxisField, label: "Add column +" }) })), _jsx("div", { style: { height: 10 } })] })] }), _jsx("div", { style: { width: 20 } }), _jsxs("div", { style: {
1236
1202
  display: 'flex',
1237
1203
  flexDirection: 'column',
1238
1204
  justifyContent: 'flex-start',
1239
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1205
+ }, children: [_jsx("div", { style: formLabelStyle || {
1240
1206
  color: 'transparent',
1241
1207
  fontFamily: theme?.fontFamily,
1242
1208
  fontSize: theme?.fontSize || '14px',
1243
1209
  fontWeight: theme.labelFontWeight || '600',
1244
1210
  }, children: "y-axis label" }), chartType !== 'pie' &&
1245
- yAxisFields.map((yAxisField, index) => ((0, jsx_runtime_1.jsxs)("div", { style: {
1211
+ yAxisFields.map((yAxisField, index) => (_jsxs("div", { style: {
1246
1212
  display: 'flex',
1247
1213
  flexDirection: 'row',
1248
1214
  // alignItems: 'center',
1249
1215
  marginTop: index === 0 ? 6 : 10,
1250
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(TextInputComponent, { value: yAxisFields[index].label, onChange: e => {
1216
+ }, children: [_jsx("div", { style: { minWidth: 200 }, children: _jsx(TextInputComponent, { value: yAxisFields[index].label, onChange: e => {
1251
1217
  handleYAxisLabelChange(index, e.target.value);
1252
- }, theme: theme, placeholder: 'Enter a label' }) }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { onChange: value => handleYAxisFieldFormatChange(index, value), value: yAxisField.format, options: Y_FORMAT_OPTIONS, theme: theme }) }), (0, jsx_runtime_1.jsx)("div", { onClick: () => index > 0 ? handleDeleteYAxisField(index) : undefined, style: {
1218
+ }, theme: theme, placeholder: 'Enter a label' }) }), _jsx("div", { style: { width: 20 } }), _jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { onChange: value => handleYAxisFieldFormatChange(index, value), value: yAxisField.format, options: Y_FORMAT_OPTIONS, theme: theme }) }), _jsx("div", { onClick: () => index > 0 ? handleDeleteYAxisField(index) : undefined, style: {
1253
1219
  cursor: index > 0 ? 'pointer' : undefined,
1254
1220
  paddingLeft: 6,
1255
1221
  paddingTop: 12,
@@ -1259,68 +1225,68 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1259
1225
  display: 'flex',
1260
1226
  alignItems: 'center',
1261
1227
  justifyContent: 'center',
1262
- }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: index > 0 ? theme?.secondaryTextColor : 'rgba(0,0,0,0)', height: "20", width: "20", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }, `yAxisField-${index}`)))] })] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), showTableFormatOptions && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: formHeaderStyle || {
1228
+ }, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: index > 0 ? theme?.secondaryTextColor : 'rgba(0,0,0,0)', height: "20", width: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) })] }, `yAxisField-${index}`)))] })] }), _jsx("div", { style: { height: 20 } }), showTableFormatOptions && (_jsxs(_Fragment, { children: [_jsx("div", { style: formHeaderStyle || {
1263
1229
  fontFamily: theme.fontFamily,
1264
1230
  color: theme.primaryTextColor,
1265
1231
  fontSize: theme.fontSize + 2,
1266
1232
  fontWeight: 600,
1267
1233
  // marginTop: 20,
1268
- }, children: 'Table' }), (0, jsx_runtime_1.jsx)("div", { style: { height: 8 } })] })), showTableFormatOptions && chartType !== 'table' && ((0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1234
+ }, children: 'Table' }), _jsx("div", { style: { height: 8 } })] })), showTableFormatOptions && chartType !== 'table' && (_jsx("div", { style: formLabelStyle || {
1269
1235
  color: theme.secondaryTextColor,
1270
1236
  fontFamily: theme?.fontFamily,
1271
1237
  fontSize: theme?.fontSize || '14px',
1272
1238
  fontWeight: theme.labelFontWeight || '600',
1273
- }, children: 'Columns' })), showTableFormatOptions && chartType !== 'table' && ((0, jsx_runtime_1.jsxs)("div", { style: {
1239
+ }, children: 'Columns' })), showTableFormatOptions && chartType !== 'table' && (_jsxs("div", { style: {
1274
1240
  display: 'flex',
1275
1241
  flexDirection: 'row',
1276
1242
  alignItems: 'flex-start',
1277
1243
  marginTop: 6,
1278
1244
  // justifyContent: 'space-between',
1279
1245
  // marginTop: 8,
1280
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1246
+ }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsxs("div", { style: {
1281
1247
  display: 'flex',
1282
1248
  flexDirection: 'column',
1283
- }, children: [columns.map((yAxisField, index) => ((0, jsx_runtime_1.jsx)("div", { style: {
1249
+ }, children: [columns.map((yAxisField, index) => (_jsx("div", { style: {
1284
1250
  display: 'flex',
1285
1251
  flexDirection: 'row',
1286
1252
  alignItems: 'center',
1287
1253
  marginTop: index === 0 ? 6 : 10,
1288
- }, children: (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { value: yAxisField.field, onChange: option => {
1254
+ }, children: _jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { value: yAxisField.field, onChange: option => {
1289
1255
  handleColumnFieldChange(index, option);
1290
- }, options: fieldOptions, theme: theme }) }) }, `column-${index}`))), (0, jsx_runtime_1.jsx)("div", { style: { height: 10 } })] }) }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsx)("div", { style: {
1256
+ }, options: fieldOptions, theme: theme }) }) }, `column-${index}`))), _jsx("div", { style: { height: 10 } })] }) }), _jsx("div", { style: { width: 20 } }), _jsx("div", { style: {
1291
1257
  display: 'flex',
1292
1258
  flexDirection: 'column',
1293
1259
  justifyContent: 'flex-start',
1294
- }, children: columns.map((yAxisField, index) => ((0, jsx_runtime_1.jsxs)("div", { style: {
1260
+ }, children: columns.map((yAxisField, index) => (_jsxs("div", { style: {
1295
1261
  display: 'flex',
1296
1262
  flexDirection: 'row',
1297
1263
  alignItems: 'center',
1298
1264
  marginTop: index === 0 ? 6 : 10,
1299
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(TextInputComponent, { theme: theme, placeholder: "Enter column label", value: yAxisField.label, onChange: event => handleColumnLabelChange(index, event.target.value) }) }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { value: yAxisField.format, onChange: option => handleColumnFormatChange(index, option), options: Y_FORMAT_OPTIONS, theme: theme }) })] }, `column-${index}`))) })] })), showDateFieldOptions && (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), showDateFieldOptions && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: formHeaderStyle || {
1265
+ }, children: [_jsx("div", { style: { minWidth: 200 }, children: _jsx(TextInputComponent, { theme: theme, placeholder: "Enter column label", value: yAxisField.label, onChange: event => handleColumnLabelChange(index, event.target.value) }) }), _jsx("div", { style: { width: 20 } }), _jsx("div", { style: { minWidth: 200 }, children: _jsx(SelectComponent, { value: yAxisField.format, onChange: option => handleColumnFormatChange(index, option), options: Y_FORMAT_OPTIONS, theme: theme }) })] }, `column-${index}`))) })] })), showDateFieldOptions && _jsx("div", { style: { height: 20 } }), showDateFieldOptions && (_jsxs(_Fragment, { children: [_jsx("div", { style: formHeaderStyle || {
1300
1266
  fontFamily: theme.fontFamily,
1301
1267
  color: theme.primaryTextColor,
1302
1268
  fontSize: theme.fontSize + 2,
1303
1269
  fontWeight: 600,
1304
1270
  // marginTop: 20,
1305
- }, children: 'Filters' }), (0, jsx_runtime_1.jsx)("div", { style: { height: 8 } })] })), showDateFieldOptions && ((0, jsx_runtime_1.jsxs)("div", { style: {
1271
+ }, children: 'Filters' }), _jsx("div", { style: { height: 8 } })] })), showDateFieldOptions && (_jsxs("div", { style: {
1306
1272
  display: 'flex',
1307
1273
  flexDirection: 'row',
1308
1274
  alignItems: 'center',
1309
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1275
+ }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: formLabelStyle || {
1310
1276
  color: theme.secondaryTextColor,
1311
1277
  fontFamily: theme?.fontFamily,
1312
1278
  fontSize: theme?.fontSize || '14px',
1313
1279
  fontWeight: theme.labelFontWeight || '600',
1314
- }, children: "Date field table" }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200, marginTop: 6 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { options: !dateFieldOptions.length
1280
+ }, children: "Date field table" }), _jsx("div", { style: { minWidth: 200, marginTop: 6 }, children: _jsx(SelectComponent, { options: !dateFieldOptions.length
1315
1281
  ? [{ label: '', value: '' }]
1316
1282
  : dateFieldOptions.map(elem => {
1317
1283
  return { label: elem.name, value: elem.name };
1318
- }), onChange: e => setDateFieldTable(e), value: dateFieldTable, theme: theme }) })] }), (0, jsx_runtime_1.jsx)("div", { style: { width: 20 } }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: formLabelStyle || {
1284
+ }), onChange: e => setDateFieldTable(e), value: dateFieldTable, theme: theme }) })] }), _jsx("div", { style: { width: 20 } }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: formLabelStyle || {
1319
1285
  color: theme.secondaryTextColor,
1320
1286
  fontFamily: theme?.fontFamily,
1321
1287
  fontSize: theme?.fontSize || '14px',
1322
1288
  fontWeight: theme.labelFontWeight || '600',
1323
- }, children: "Date field" }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 200, marginTop: 6 }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { options: !dateFieldOptions.length
1289
+ }, children: "Date field" }), _jsx("div", { style: { minWidth: 200, marginTop: 6 }, children: _jsx(SelectComponent, { options: !dateFieldOptions.length
1324
1290
  ? [{ label: '', value: '' }]
1325
1291
  : dateFieldOptions.filter(elem => elem.name === dateFieldTable // Replace `values.dateFieldTable` with your state variable or prop
1326
1292
  ).length
@@ -1329,17 +1295,17 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1329
1295
  .columns.map(elem => {
1330
1296
  return { label: elem.name, value: elem.name };
1331
1297
  })
1332
- : [{ label: '', value: '' }], onChange: value => setDateField(value), value: dateField, theme: theme }) })] })] })), showAccessControlOptions && ((0, jsx_runtime_1.jsxs)("div", { style: {
1298
+ : [{ label: '', value: '' }], onChange: value => setDateField(value), value: dateField, theme: theme }) })] })] })), showAccessControlOptions && (_jsxs("div", { style: {
1333
1299
  display: 'flex',
1334
1300
  flexDirection: 'column',
1335
1301
  marginTop: 40,
1336
1302
  marginBottom: 40,
1337
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1303
+ }, children: [_jsx("div", { style: {
1338
1304
  fontFamily: theme.fontFamily,
1339
1305
  color: theme.primaryTextColor,
1340
1306
  fontSize: theme.fontSize + 2,
1341
1307
  fontWeight: 600,
1342
- }, children: 'Access Control' }), (0, jsx_runtime_1.jsx)("div", { style: { height: 12 } }), (0, jsx_runtime_1.jsxs)("div", { style: {
1308
+ }, children: 'Access Control' }), _jsx("div", { style: { height: 12 } }), _jsxs("div", { style: {
1343
1309
  padding: '1px',
1344
1310
  display: 'flex',
1345
1311
  flexDirection: 'row',
@@ -1350,7 +1316,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1350
1316
  color: '#212121',
1351
1317
  backgroundColor: 'rgba(33, 33, 33, 0.03)',
1352
1318
  borderRadius: '6px',
1353
- }, children: [(0, jsx_runtime_1.jsx)("div", { onClick: () => {
1319
+ }, children: [_jsx("div", { onClick: () => {
1354
1320
  setSelectedTabIndex(0);
1355
1321
  setTemplate(false);
1356
1322
  }, style: {
@@ -1377,7 +1343,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1377
1343
  ? '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)'
1378
1344
  : undefined, // Shadow when selected
1379
1345
  outline: 'none', // focus:outline-none
1380
- }, children: `This Organization${organizationName ? ` (${organizationName})` : ``}` }), (0, jsx_runtime_1.jsx)("div", { onClick: () => {
1346
+ }, children: `This Organization${organizationName ? ` (${organizationName})` : ``}` }), _jsx("div", { onClick: () => {
1381
1347
  setSelectedTabIndex(1);
1382
1348
  setTemplate(true);
1383
1349
  }, style: {
@@ -1404,7 +1370,7 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1404
1370
  ? '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)'
1405
1371
  : undefined, // Shadow when selected
1406
1372
  outline: 'none', // focus:outline-none
1407
- }, children: 'Global (All Organizations)' })] })] })), (0, jsx_runtime_1.jsx)("div", { style: { paddingRight: 25 }, children: (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: () => {
1373
+ }, children: 'Global (All Organizations)' })] })] })), _jsx("div", { style: { paddingRight: 25 }, children: _jsx(ButtonComponent, { onClick: () => {
1408
1374
  const { xAxisField, xAxisLabel, xAxisFormat, chartName, chartType, dashboardName, dateFieldTable, dateField, template, } = chartConfig;
1409
1375
  if (isSubmitting === false) {
1410
1376
  editChart({
@@ -1428,5 +1394,5 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
1428
1394
  showTableFormatOptions,
1429
1395
  });
1430
1396
  }
1431
- }, label: report ? 'Save changes' : 'Add to dashboard' }) }), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } })] }) }));
1397
+ }, label: report ? 'Save changes' : 'Add to dashboard' }) }), _jsx("div", { style: { height: 20 } })] }) }));
1432
1398
  }