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