@quillsql/react 2.8.5 → 2.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddToDashboardModal.js +146 -180
- package/dist/BarList.js +36 -43
- package/dist/Chart.js +99 -131
- package/dist/ChartBuilder.js +80 -88
- package/dist/ChartEditor.js +14 -20
- package/dist/Context.js +52 -56
- package/dist/Dashboard.d.ts.map +1 -1
- package/dist/Dashboard.js +246 -305
- package/dist/DateRangePicker/Calendar.js +41 -45
- package/dist/DateRangePicker/DateRangePicker.js +32 -60
- package/dist/DateRangePicker/DateRangePickerButton.js +14 -16
- package/dist/DateRangePicker/dateRangePickerUtils.d.ts +6 -0
- package/dist/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/DateRangePicker/dateRangePickerUtils.js +89 -89
- package/dist/DateRangePicker/index.js +1 -8
- package/dist/PieChart.js +35 -69
- package/dist/QuillProvider.js +4 -6
- package/dist/ReportBuilder.js +120 -128
- package/dist/SQLEditor.js +56 -64
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +64 -68
- package/dist/TableChart.js +17 -44
- package/dist/assets/ArrowDownHeadIcon.js +3 -5
- package/dist/assets/ArrowDownIcon.js +3 -5
- package/dist/assets/ArrowDownRightIcon.js +3 -5
- package/dist/assets/ArrowLeftHeadIcon.js +3 -5
- package/dist/assets/ArrowRightHeadIcon.js +3 -5
- package/dist/assets/ArrowRightIcon.js +3 -5
- package/dist/assets/ArrowUpHeadIcon.js +3 -5
- package/dist/assets/ArrowUpIcon.js +3 -5
- package/dist/assets/ArrowUpRightIcon.js +3 -5
- package/dist/assets/CalendarIcon.js +3 -5
- package/dist/assets/CalendarNormalIcon.js +3 -5
- package/dist/assets/DoubleArrowLeftHeadIcon.js +3 -5
- package/dist/assets/DoubleArrowRightHeadIcon.js +3 -5
- package/dist/assets/ExclamationFilledIcon.js +3 -5
- package/dist/assets/FilterIcon.js +3 -5
- package/dist/assets/LoadingSpinner.js +3 -5
- package/dist/assets/RefreshIcon.js +3 -5
- package/dist/assets/SearchIcon.js +3 -5
- package/dist/assets/UpLeftArrowsIcon.js +3 -5
- package/dist/assets/XCircleIcon.js +3 -5
- package/dist/assets/XIcon.js +3 -5
- package/dist/assets/index.js +21 -48
- package/dist/components/BigModal/BigModal.js +13 -38
- package/dist/components/Dropdown/Dropdown.js +24 -52
- package/dist/components/Dropdown/DropdownItem.js +9 -34
- package/dist/components/Dropdown/index.js +2 -10
- package/dist/components/Modal/Modal.js +13 -38
- package/dist/components/Modal/index.js +1 -8
- package/dist/components/QuillCard.js +8 -12
- package/dist/components/SqlTextEditor.d.ts +7 -0
- package/dist/components/SqlTextEditor.d.ts.map +1 -0
- package/dist/components/SqlTextEditor.js +14 -0
- package/dist/components/UiComponents.js +37 -50
- package/dist/components/selectUtils.js +6 -16
- package/dist/contexts/BaseColorContext.js +3 -5
- package/dist/contexts/HoveredValueContext.js +3 -5
- package/dist/contexts/RootStylesContext.js +3 -5
- package/dist/contexts/SelectedValueContext.js +3 -5
- package/dist/contexts/index.js +4 -14
- package/dist/hooks/index.js +4 -14
- package/dist/hooks/useDashboard.d.ts +7 -0
- package/dist/hooks/useDashboard.d.ts.map +1 -0
- package/dist/hooks/useDashboard.js +48 -0
- package/dist/hooks/useInternalState.js +3 -5
- package/dist/hooks/useOnClickOutside.js +3 -5
- package/dist/hooks/useOnWindowResize.js +4 -6
- package/dist/hooks/useQuill.js +11 -15
- package/dist/hooks/useSelectOnKeyDown.js +4 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -28
- package/dist/internals/ReportBuilder/PivotList.js +14 -19
- package/dist/internals/ReportBuilder/PivotModal.js +84 -91
- package/dist/internals/ReportBuilder/PivotModal.spec.js +70 -72
- package/dist/lib/font.js +2 -5
- package/dist/lib/index.js +3 -19
- package/dist/lib/inputTypes.js +1 -2
- package/dist/lib/utils.js +8 -18
- package/dist/utils/aggregate.js +28 -34
- package/dist/utils/colorToHex.js +1 -4
- package/dist/utils/dataFetcher.js +2 -7
- package/dist/utils/downloadCSV.js +1 -5
- package/package.json +2 -1
package/dist/SQLEditor.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertPostgresColumn = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
2
|
// @ts-nocheck
|
|
9
3
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import { useState, useContext, useEffect } from 'react';
|
|
5
|
+
import MonacoEditor from '@monaco-editor/react';
|
|
12
6
|
// import './nightOwlLight.css';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function convertPostgresColumn(column) {
|
|
7
|
+
import { ClientContext, SchemaContext, ThemeContext } from './Context';
|
|
8
|
+
import { SpecialTable } from './Table';
|
|
9
|
+
import { getData, getDataFromCloud } from './utils/dataFetcher';
|
|
10
|
+
import ChartBuilder from './ChartBuilder';
|
|
11
|
+
export function convertPostgresColumn(column) {
|
|
18
12
|
let format;
|
|
19
13
|
let fieldType;
|
|
20
14
|
switch (column.dataTypeID) {
|
|
@@ -80,7 +74,6 @@ function convertPostgresColumn(column) {
|
|
|
80
74
|
fieldType,
|
|
81
75
|
};
|
|
82
76
|
}
|
|
83
|
-
exports.convertPostgresColumn = convertPostgresColumn;
|
|
84
77
|
function defineEditorTheme(monaco, theme) {
|
|
85
78
|
monaco.editor.defineTheme('onedark', {
|
|
86
79
|
base: theme.darkMode ? 'vs-dark' : 'vs',
|
|
@@ -106,7 +99,7 @@ function setEditorTheme(editor, monaco) {
|
|
|
106
99
|
console.log('ERROR: ', e);
|
|
107
100
|
}
|
|
108
101
|
}
|
|
109
|
-
const QuillButton = ({ onClick, label, theme, secondary, }) => ((
|
|
102
|
+
const QuillButton = ({ onClick, label, theme, secondary, }) => (_jsx("button", { style: {
|
|
110
103
|
borderRadius: '6px',
|
|
111
104
|
backgroundColor: secondary
|
|
112
105
|
? theme?.secondaryButtonColor || '#F5F5F5'
|
|
@@ -126,7 +119,7 @@ const QuillButton = ({ onClick, label, theme, secondary, }) => ((0, jsx_runtime_
|
|
|
126
119
|
height: 38,
|
|
127
120
|
}, onClick: onClick, children: label }));
|
|
128
121
|
const QuillTextInput = ({ onChange, value, id, placeholder, theme, }) => {
|
|
129
|
-
return ((
|
|
122
|
+
return (_jsx("input", { style: {
|
|
130
123
|
display: 'flex',
|
|
131
124
|
flexDirection: 'row',
|
|
132
125
|
alignItems: 'center',
|
|
@@ -144,26 +137,26 @@ const QuillTextInput = ({ onChange, value, id, placeholder, theme, }) => {
|
|
|
144
137
|
borderRadius: '6px',
|
|
145
138
|
}, id: id, onChange: onChange, value: value, placeholder: placeholder }));
|
|
146
139
|
};
|
|
147
|
-
function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, SecondaryButtonComponent, TextInputComponent, TableComponent, AddToDashboardButton, newQueryEnabled = false, LoadingComponent, defaultQuery, onChangeQuery, onChangeData, onChangeColumns, onChangeFields, chartBuilderEnabled = false, showTableFormatOptions = false, showDateFieldOptions = false, showAccessControlOptions = false, destinationDashboard, chartBuilderTitle, chartBuilderButtonLabel, }) {
|
|
148
|
-
const [sqlPrompt, setSqlPrompt] =
|
|
149
|
-
const [isOpen, setIsOpen] =
|
|
150
|
-
const [client] =
|
|
151
|
-
const [theme] =
|
|
152
|
-
const [query, setQuery] =
|
|
153
|
-
const [rows, setRows] =
|
|
154
|
-
const [columns, setColumns] =
|
|
155
|
-
const [fields, setFields] =
|
|
156
|
-
const [schema, setSchema] =
|
|
157
|
-
const [errorMessage, setErrorMessage] =
|
|
158
|
-
const [sqlResponseLoading, setSqlResponseLoading] =
|
|
159
|
-
const [sqlQueryLoading, setSqlQueryLoading] =
|
|
160
|
-
const [schemaLoading, setSchemaLoading] =
|
|
161
|
-
const [isChartBuilderOpen, setIsChartBuilderOpen] =
|
|
162
|
-
|
|
140
|
+
export default function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, SecondaryButtonComponent, TextInputComponent, TableComponent, AddToDashboardButton, newQueryEnabled = false, LoadingComponent, defaultQuery, onChangeQuery, onChangeData, onChangeColumns, onChangeFields, chartBuilderEnabled = false, showTableFormatOptions = false, showDateFieldOptions = false, showAccessControlOptions = false, destinationDashboard, chartBuilderTitle, chartBuilderButtonLabel, }) {
|
|
141
|
+
const [sqlPrompt, setSqlPrompt] = useState('');
|
|
142
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
143
|
+
const [client] = useContext(ClientContext);
|
|
144
|
+
const [theme] = useContext(ThemeContext);
|
|
145
|
+
const [query, setQuery] = useState(defaultQuery);
|
|
146
|
+
const [rows, setRows] = useState([]);
|
|
147
|
+
const [columns, setColumns] = useState([]);
|
|
148
|
+
const [fields, setFields] = useState([]);
|
|
149
|
+
const [schema, setSchema] = useContext(SchemaContext);
|
|
150
|
+
const [errorMessage, setErrorMessage] = useState('');
|
|
151
|
+
const [sqlResponseLoading, setSqlResponseLoading] = useState(false);
|
|
152
|
+
const [sqlQueryLoading, setSqlQueryLoading] = useState(false);
|
|
153
|
+
const [schemaLoading, setSchemaLoading] = useState(false);
|
|
154
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = useState(false);
|
|
155
|
+
useEffect(() => {
|
|
163
156
|
let isSubscribed = true;
|
|
164
157
|
async function getSchema() {
|
|
165
158
|
setSchemaLoading(true);
|
|
166
|
-
const resp = await
|
|
159
|
+
const resp = await getDataFromCloud(client, `schema2/${client.publicKey}/`, null, 'GET');
|
|
167
160
|
if (isSubscribed) {
|
|
168
161
|
setSchema(resp.tables);
|
|
169
162
|
setSchemaLoading(false);
|
|
@@ -178,7 +171,7 @@ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, Se
|
|
|
178
171
|
}, []);
|
|
179
172
|
const handleRunSqlPrompt = async () => {
|
|
180
173
|
setSqlResponseLoading(true);
|
|
181
|
-
const resp = await
|
|
174
|
+
const resp = await getDataFromCloud(client, `quillai`, {
|
|
182
175
|
initialQuestion: sqlPrompt,
|
|
183
176
|
});
|
|
184
177
|
setQuery(resp.message);
|
|
@@ -196,7 +189,7 @@ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, Se
|
|
|
196
189
|
: { query, task: 'query', clientId: client.publicKey },
|
|
197
190
|
};
|
|
198
191
|
const cloudBody = { query };
|
|
199
|
-
const resp = await
|
|
192
|
+
const resp = await getData(client, 'dashquery', 'same-origin', hostedBody, cloudBody);
|
|
200
193
|
if (resp && resp.errorMessage) {
|
|
201
194
|
setSqlQueryLoading(false);
|
|
202
195
|
setErrorMessage('Failed to run SQL query: ' + resp.errorMessage);
|
|
@@ -256,35 +249,35 @@ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, Se
|
|
|
256
249
|
downloadLink.click();
|
|
257
250
|
document.body.removeChild(downloadLink);
|
|
258
251
|
};
|
|
259
|
-
|
|
252
|
+
useEffect(() => {
|
|
260
253
|
if (onChangeQuery) {
|
|
261
254
|
onChangeQuery(query);
|
|
262
255
|
}
|
|
263
256
|
}, [query]);
|
|
264
257
|
/* rest of your methods */
|
|
265
|
-
return ((
|
|
258
|
+
return (_jsxs("div", { style: containerStyle, children: [_jsx("div", { style: {
|
|
266
259
|
height: 'calc(100%)',
|
|
267
260
|
display: 'flex',
|
|
268
261
|
flexDirection: 'column',
|
|
269
262
|
padding: 0,
|
|
270
|
-
}, children: (
|
|
263
|
+
}, children: _jsx("div", { style: { height: '100%', display: 'flex', flexDirection: 'column' }, children: _jsxs("div", { style: {
|
|
271
264
|
width: '100%',
|
|
272
265
|
display: 'flex',
|
|
273
266
|
height: '100%',
|
|
274
267
|
flexDirection: 'row',
|
|
275
|
-
}, children: [(
|
|
268
|
+
}, children: [_jsx(SchemaListComponent, { schema: schema, theme: theme, LoadingComponent: LoadingComponent, loading: schemaLoading }), _jsxs("div", { style: {
|
|
276
269
|
display: 'flex',
|
|
277
270
|
flexDirection: 'column',
|
|
278
271
|
width: 'calc(100% - 250px)',
|
|
279
272
|
overflowX: 'hidden',
|
|
280
|
-
}, children: [(
|
|
273
|
+
}, children: [_jsxs("div", { style: {
|
|
281
274
|
// TODO: change color
|
|
282
275
|
height: 80,
|
|
283
276
|
background: 'white',
|
|
284
277
|
display: 'flex',
|
|
285
278
|
flexDirection: 'row',
|
|
286
279
|
alignItems: 'center',
|
|
287
|
-
}, children: [(
|
|
280
|
+
}, children: [_jsx("div", { style: { minWidth: 440, marginRight: 10 }, children: (TextInputComponent && (_jsx(TextInputComponent, { id: "ai-search", value: sqlPrompt, onChange: e => setSqlPrompt(e.target.value), placeholder: "Ask a question..." }))) || (_jsx(QuillTextInput, { id: "ai-search", value: sqlPrompt, onChange: e => setSqlPrompt(e.target.value), placeholder: "Ask a question...", theme: theme })) }), (ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunSqlPrompt, label: "Ask AI" }))) || (_jsx(QuillButton, { theme: theme, onClick: handleRunSqlPrompt, label: "Ask AI" }))] }), _jsx("div", { style: { height: 'calc(50% - 40px)' }, children: _jsx(SQLEditorComponent, { query: query, setQuery: setQuery, handleRunQuery: handleRunQuery, newQueryEnabled: newQueryEnabled, handleClearQuery: handleClearQuery, theme: theme, defineEditorTheme: defineEditorTheme, setEditorTheme: setEditorTheme, ButtonComponent: ButtonComponent, SecondaryButtonComponent: SecondaryButtonComponent, loading: sqlResponseLoading, LoadingComponent: LoadingComponent }) }), _jsxs("div", { style: {
|
|
288
281
|
height: 'calc(50% - 40px)',
|
|
289
282
|
display: 'flex',
|
|
290
283
|
flexDirection: 'column',
|
|
@@ -292,12 +285,12 @@ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, Se
|
|
|
292
285
|
margin: 0,
|
|
293
286
|
border: 'none',
|
|
294
287
|
outline: 'none',
|
|
295
|
-
}, children: [errorMessage && ((
|
|
288
|
+
}, children: [errorMessage && (_jsx("div", { style: {
|
|
296
289
|
fontFamily: theme?.fontFamily,
|
|
297
290
|
color: theme?.primaryTextColor,
|
|
298
291
|
fontSize: 15,
|
|
299
292
|
fontWeight: '400',
|
|
300
|
-
}, children: (
|
|
293
|
+
}, children: _jsx("div", { style: {
|
|
301
294
|
padding: 30,
|
|
302
295
|
// TODO: change color
|
|
303
296
|
background: 'rgba(0,0,0,0.02)',
|
|
@@ -308,7 +301,7 @@ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, Se
|
|
|
308
301
|
fontFamily: theme?.fontFamily,
|
|
309
302
|
}, children: errorMessage }) })), errorMessage
|
|
310
303
|
? null
|
|
311
|
-
: (TableComponent && ((
|
|
304
|
+
: (TableComponent && (_jsx(TableComponent, { rows: rows, columns: columns, height: "calc(100%)" }))) || (_jsx(_Fragment, { children: _jsx(SpecialTable, { rows: rows, columns: columns, height: "calc(100%)", LoadingComponent: LoadingComponent, loading: sqlQueryLoading, theme: theme }) }))] })] })] }) }) }), chartBuilderEnabled && rows.length > 0 && (_jsx("div", { style: {
|
|
312
305
|
display: 'flex',
|
|
313
306
|
flexDirection: 'row',
|
|
314
307
|
alignItems: 'center',
|
|
@@ -316,11 +309,10 @@ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, Se
|
|
|
316
309
|
width: '100%',
|
|
317
310
|
height: '70px',
|
|
318
311
|
gap: '8px',
|
|
319
|
-
}, children: (ButtonComponent && ((
|
|
312
|
+
}, children: (ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunQuery, label: "Run query" }))) || (_jsx(QuillButton, { onClick: () => setIsChartBuilderOpen(true), label: "Add to dashboard", theme: theme })) })), _jsx(ChartBuilder, { rows: rows, columns: columns, fields: fields, query: query, isOpen: isChartBuilderOpen, setIsOpen: setIsChartBuilderOpen, showTableFormatOptions: showTableFormatOptions, showDateFieldOptions: showDateFieldOptions, showAccessControlOptions: showAccessControlOptions, destinationDashboard: destinationDashboard, title: chartBuilderTitle, button: chartBuilderButtonLabel })] }));
|
|
320
313
|
}
|
|
321
|
-
exports.default = QueryEditor;
|
|
322
314
|
const SQLEditorComponent = ({ query, setQuery, handleRunQuery, handleClearQuery, defineEditorTheme, setEditorTheme, ButtonComponent, SecondaryButtonComponent, newQueryEnabled, theme, loading, LoadingComponent, }) => {
|
|
323
|
-
return ((
|
|
315
|
+
return (_jsxs("div", { style: {
|
|
324
316
|
background: theme.backgroundColor,
|
|
325
317
|
// maxHeight: 700,
|
|
326
318
|
width: '100%',
|
|
@@ -334,25 +326,25 @@ const SQLEditorComponent = ({ query, setQuery, handleRunQuery, handleClearQuery,
|
|
|
334
326
|
borderTopRightRadius: 0,
|
|
335
327
|
borderBottomRightRadius: 0,
|
|
336
328
|
overflow: 'hidden',
|
|
337
|
-
}, children: [loading ? ((
|
|
329
|
+
}, children: [loading ? (_jsxs("div", { style: {
|
|
338
330
|
height: 'calc(100% - 70px)',
|
|
339
331
|
width: '100%',
|
|
340
332
|
display: 'flex',
|
|
341
333
|
alignItems: 'center',
|
|
342
334
|
justifyContent: 'center',
|
|
343
335
|
background: '#F9F9F9',
|
|
344
|
-
}, children: [LoadingComponent && (
|
|
336
|
+
}, children: [LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: theme?.primaryTextColor || '#364153', fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] }))] })) : (_jsx(MonacoEditor, { height: "calc(100% - 70px)", width: "100%", defaultLanguage: "pgsql", defaultValue: "", value: query, loading: _jsx("div", {}), options: {
|
|
345
337
|
wordWrap: 'on',
|
|
346
338
|
minimap: {
|
|
347
339
|
enabled: false,
|
|
348
340
|
},
|
|
349
341
|
padding: { top: 16 },
|
|
350
|
-
}, onChange: query => setQuery(query), beforeMount: monaco => defineEditorTheme(monaco, theme), onMount: setEditorTheme })), (
|
|
342
|
+
}, onChange: query => setQuery(query), beforeMount: monaco => defineEditorTheme(monaco, theme), onMount: setEditorTheme })), _jsx("div", { style: {
|
|
351
343
|
display: 'flex',
|
|
352
344
|
flexDirection: 'row',
|
|
353
345
|
alignItems: 'center',
|
|
354
346
|
height: 70,
|
|
355
|
-
}, children: (
|
|
347
|
+
}, children: _jsxs("div", { style: { display: 'flex', gap: 10 }, children: [(ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunQuery, label: "Run query" }))) || (_jsx(QuillButton, { onClick: handleRunQuery, label: "Run query", theme: theme })), newQueryEnabled && (_jsx("div", { children: (SecondaryButtonComponent && (_jsx(SecondaryButtonComponent, { onClick: handleClearQuery, label: "Clear query" }))) || (_jsx(QuillButton, { secondary: true, onClick: handleClearQuery, label: "Clear query", theme: theme })) }))] }) })] }));
|
|
356
348
|
};
|
|
357
349
|
const styles = {
|
|
358
350
|
columnHeader: {
|
|
@@ -388,7 +380,7 @@ const styles = {
|
|
|
388
380
|
};
|
|
389
381
|
const SchemaListComponent = ({ schema, theme, loading, LoadingComponent }) => {
|
|
390
382
|
if (loading) {
|
|
391
|
-
return ((
|
|
383
|
+
return (_jsxs("div", { style: {
|
|
392
384
|
background: theme.backgroundColor,
|
|
393
385
|
// maxHeight: 700,
|
|
394
386
|
width: 250,
|
|
@@ -402,9 +394,9 @@ const SchemaListComponent = ({ schema, theme, loading, LoadingComponent }) => {
|
|
|
402
394
|
display: 'flex',
|
|
403
395
|
// alignItems: 'center',
|
|
404
396
|
justifyContent: 'center',
|
|
405
|
-
}, children: [(
|
|
397
|
+
}, children: [_jsx("div", { style: { height: 100 } }), LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: theme?.primaryTextColor || '#364153', fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] }))] }));
|
|
406
398
|
}
|
|
407
|
-
return ((
|
|
399
|
+
return (_jsx("div", { style: {
|
|
408
400
|
background: theme.backgroundColor,
|
|
409
401
|
// maxHeight: 700,
|
|
410
402
|
width: 250,
|
|
@@ -414,10 +406,10 @@ const SchemaListComponent = ({ schema, theme, loading, LoadingComponent }) => {
|
|
|
414
406
|
// maxHeight: "100%",
|
|
415
407
|
paddingLeft: 20,
|
|
416
408
|
paddingRight: 30,
|
|
417
|
-
}, children: schema.map((elem, index) => ((
|
|
409
|
+
}, children: schema.map((elem, index) => (_jsx(SchemaItem, { elem: elem, theme: theme, index: index }, elem.displayName + index))) }));
|
|
418
410
|
};
|
|
419
411
|
function SchemaItem({ elem, theme, index }) {
|
|
420
|
-
const [isOpen, setIsOpen] =
|
|
412
|
+
const [isOpen, setIsOpen] = useState(index === 0);
|
|
421
413
|
const schemaContainerStyle = {
|
|
422
414
|
display: 'flex',
|
|
423
415
|
flexDirection: 'column',
|
|
@@ -439,7 +431,7 @@ function SchemaItem({ elem, theme, index }) {
|
|
|
439
431
|
const schemaRowHoverStyle = {
|
|
440
432
|
background: theme.selectUnderlayColor,
|
|
441
433
|
};
|
|
442
|
-
return ((
|
|
434
|
+
return (_jsxs("div", { style: schemaContainerStyle, children: [_jsxs("div", { style: { ...schemaRowStyle, ...(isOpen && schemaRowHoverStyle) }, onClick: () => setIsOpen(!isOpen), children: [_jsx("p", { style: {
|
|
443
435
|
marginLeft: theme.padding,
|
|
444
436
|
fontSize: 13,
|
|
445
437
|
color: '#384151',
|
|
@@ -450,7 +442,7 @@ function SchemaItem({ elem, theme, index }) {
|
|
|
450
442
|
textOverflow: 'ellipsis',
|
|
451
443
|
overflow: 'hidden',
|
|
452
444
|
fontFamily: theme?.fontFamily,
|
|
453
|
-
}, title: elem.displayName, children: elem.displayName }), (
|
|
445
|
+
}, title: elem.displayName, children: elem.displayName }), _jsx("div", { style: {
|
|
454
446
|
display: 'flex',
|
|
455
447
|
alignItems: 'center',
|
|
456
448
|
justifyContent: 'center',
|
|
@@ -464,24 +456,24 @@ function SchemaItem({ elem, theme, index }) {
|
|
|
464
456
|
// style={{ height: 13, width: 13, color: theme.secondaryTextColor }}
|
|
465
457
|
// aria-hidden="true"
|
|
466
458
|
// />
|
|
467
|
-
(
|
|
459
|
+
_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: theme.secondaryTextColor, children: _jsx("path", { fillRule: "evenodd", d: "M12.53 16.28a.75.75 0 01-1.06 0l-7.5-7.5a.75.75 0 011.06-1.06L12 14.69l6.97-6.97a.75.75 0 111.06 1.06l-7.5 7.5z", clipRule: "evenodd" }) })) : (
|
|
468
460
|
// <ChevronRightIcon
|
|
469
461
|
// style={{ height: 13, width: 13, color: theme.secondaryTextColor }}
|
|
470
462
|
// aria-hidden="true"
|
|
471
463
|
// />
|
|
472
|
-
(
|
|
464
|
+
_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: theme.secondaryTextColor, children: _jsx("path", { fillRule: "evenodd", d: "M16.28 11.47a.75.75 0 010 1.06l-7.5 7.5a.75.75 0 01-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 011.06-1.06l7.5 7.5z", clipRule: "evenodd" }) })) })] }), isOpen ? (_jsx("div", { style: {
|
|
473
465
|
paddingBottom: theme.padding,
|
|
474
466
|
display: 'flex',
|
|
475
467
|
flexDirection: 'column',
|
|
476
468
|
paddingLeft: theme.padding,
|
|
477
469
|
paddingRight: theme.padding,
|
|
478
|
-
}, children: elem.columns.map((elem, index) => ((
|
|
470
|
+
}, children: elem.columns.map((elem, index) => (_jsxs("div", { style: {
|
|
479
471
|
paddingTop: theme.padding,
|
|
480
472
|
display: 'flex',
|
|
481
473
|
flexDirection: 'row',
|
|
482
474
|
alignItems: 'center',
|
|
483
475
|
justifyContent: 'space-between',
|
|
484
|
-
}, children: [(
|
|
476
|
+
}, children: [_jsx("div", { title: elem.displayName,
|
|
485
477
|
// className="text-gray-500"
|
|
486
478
|
style: {
|
|
487
479
|
fontSize: 12,
|
|
@@ -496,7 +488,7 @@ function SchemaItem({ elem, theme, index }) {
|
|
|
496
488
|
width: 200,
|
|
497
489
|
maxWidth: 200,
|
|
498
490
|
fontFamily: theme?.fontFamily,
|
|
499
|
-
}, children: elem.displayName }), (
|
|
491
|
+
}, children: elem.displayName }), _jsx("div", {
|
|
500
492
|
// className="text-gray-500"
|
|
501
493
|
title: elem.displayName, style: {
|
|
502
494
|
fontSize: 12,
|
package/dist/Table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface TableColumn {
|
|
2
|
+
export interface TableColumn {
|
|
3
3
|
label: string;
|
|
4
4
|
field: string;
|
|
5
5
|
}
|
|
@@ -32,6 +32,7 @@ export declare function SpecialTable({ columns, rows, height, containerStyle, lo
|
|
|
32
32
|
csvFilename?: string;
|
|
33
33
|
DownloadCSVButtonComponent?: (props: TableButtonComponentProps) => JSX.Element;
|
|
34
34
|
AddToDashboardButtonComponent?: (props: TableButtonComponentProps) => JSX.Element;
|
|
35
|
+
isTableChart?: boolean;
|
|
35
36
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
36
37
|
export default Table;
|
|
37
38
|
//# sourceMappingURL=Table.d.ts.map
|
package/dist/Table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../src/Table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAYxE,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../src/Table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAYxE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;CACtC;AAED,QAAA,MAAM,KAAK,sGAQR,iBAAiB,GAAG,cAAc,4CAqEpC,CAAC;AAEF,UAAU,yBAAyB;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAyBD,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,IAAI,EACJ,MAAM,EACN,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,qBAA4B,EAC5B,WAAW,EACX,0BAA0B,EAC1B,6BAA6B,EAC7B,YAAoB,EACpB,IAAI,GACL,EAAE;IACD,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;IACrC,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B,CAAC,EAAE,CAC3B,KAAK,EAAE,yBAAyB,KAC7B,GAAG,CAAC,OAAO,CAAC;IACjB,6BAA6B,CAAC,EAAE,CAC9B,KAAK,EAAE,yBAAyB,KAC7B,GAAG,CAAC,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,kDA4lBA;AAuUD,eAAe,KAAK,CAAC"}
|