@quillsql/react 1.6.1 → 1.6.4
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/lib/AddToDashboardButton.d.ts +1 -0
- package/lib/AddToDashboardButton.js +2 -0
- package/lib/AddToDashboardButton.js.map +1 -0
- package/lib/AddToDashboardModal.d.ts +22 -0
- package/lib/AddToDashboardModal.js +638 -0
- package/lib/AddToDashboardModal.js.map +1 -0
- package/lib/BarList.js +28 -28
- package/lib/BarList.js.map +1 -1
- package/lib/Chart.js +30 -114
- package/lib/Chart.js.map +1 -1
- package/lib/Context.d.ts +3 -3
- package/lib/Context.js +3 -3
- package/lib/Context.js.map +1 -1
- package/lib/Dashboard.js +31 -16
- package/lib/Dashboard.js.map +1 -1
- package/lib/Dialog.d.ts +68 -0
- package/lib/Dialog.js +407 -0
- package/lib/Dialog.js.map +1 -0
- package/lib/Portal.d.ts +32 -0
- package/lib/Portal.js +171 -0
- package/lib/Portal.js.map +1 -0
- package/lib/Props.d.ts +0 -0
- package/lib/Props.js +2 -0
- package/lib/Props.js.map +1 -0
- package/lib/QuillProvider.d.ts +32 -14
- package/lib/QuillProvider.js +15 -2
- package/lib/QuillProvider.js.map +1 -1
- package/lib/ReportBuilder.d.ts +26 -2
- package/lib/ReportBuilder.js +210 -486
- package/lib/ReportBuilder.js.map +1 -1
- package/lib/SQLEditor.d.ts +38 -1
- package/lib/SQLEditor.js +385 -210
- package/lib/SQLEditor.js.map +1 -1
- package/lib/Table.js +12 -14
- package/lib/Table.js.map +1 -1
- package/lib/components/BigModal/BigModal.d.ts +14 -0
- package/lib/components/BigModal/BigModal.js +85 -0
- package/lib/components/BigModal/BigModal.js.map +1 -0
- package/lib/components/BigModal/Modal.d.ts +14 -0
- package/lib/components/BigModal/Modal.js +109 -0
- package/lib/components/BigModal/Modal.js.map +1 -0
- package/lib/components/Modal/Modal.d.ts +1 -1
- package/lib/hooks/useQuill.js +14 -24
- package/lib/hooks/useQuill.js.map +1 -1
- package/lib/hooks/useSyncRefs.d.ts +5 -0
- package/lib/hooks/useSyncRefs.js +38 -0
- package/lib/hooks/useSyncRefs.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/Props.d.ts +0 -0
- package/lib/types/Props.js +2 -0
- package/lib/types/Props.js.map +1 -0
- package/lib/types.d.ts +27 -0
- package/lib/types.js +6 -0
- package/lib/types.js.map +1 -0
- package/package.json +2 -1
- package/src/AddToDashboardModal.tsx +1213 -0
- package/src/BarList.tsx +28 -28
- package/src/Chart.tsx +31 -107
- package/src/Context.tsx +8 -5
- package/src/Dashboard.tsx +29 -2
- package/src/QuillProvider.tsx +52 -10
- package/src/ReportBuilder.tsx +420 -649
- package/src/SQLEditor.tsx +805 -235
- package/src/Table.tsx +20 -26
- package/src/components/BigModal/BigModal.tsx +108 -0
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/continue_logs.txt +75 -0
- package/src/hooks/useQuill.ts +2 -16
- package/src/index.ts +1 -0
package/src/Table.tsx
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from './Context';
|
|
11
11
|
import Skeleton from 'react-loading-skeleton';
|
|
12
12
|
import { valueFormatter } from './Chart';
|
|
13
|
+
import { SpecialTable } from './SQLEditor';
|
|
14
|
+
import { QuillTheme } from './QuillProvider';
|
|
13
15
|
|
|
14
16
|
const Table = ({
|
|
15
17
|
chartId,
|
|
@@ -20,7 +22,8 @@ const Table = ({
|
|
|
20
22
|
}) => {
|
|
21
23
|
const { dispatch, dashboard } = useContext(DashboardContext);
|
|
22
24
|
const [client, _] = useContext(ClientContext);
|
|
23
|
-
const [theme] =
|
|
25
|
+
const [theme] =
|
|
26
|
+
useContext<[QuillTheme, (theme: QuillTheme) => void]>(ThemeContext);
|
|
24
27
|
|
|
25
28
|
const downloadCSV = (rows, name) => {
|
|
26
29
|
// report.rows
|
|
@@ -146,6 +149,9 @@ const ChartUpdater = ({
|
|
|
146
149
|
: 6;
|
|
147
150
|
|
|
148
151
|
const memoizedData = useMemo(() => {
|
|
152
|
+
if (!chartConfig || !chartConfig.rows || !chartConfig.rows.length) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
149
155
|
// Deep copy of data
|
|
150
156
|
const copiedData = JSON.parse(
|
|
151
157
|
JSON.stringify(
|
|
@@ -155,7 +161,7 @@ const ChartUpdater = ({
|
|
|
155
161
|
)
|
|
156
162
|
);
|
|
157
163
|
|
|
158
|
-
return copiedData.
|
|
164
|
+
return copiedData.map(item => {
|
|
159
165
|
const fieldsWithFormattedValues = {};
|
|
160
166
|
|
|
161
167
|
for (const field of chartConfig.columns) {
|
|
@@ -169,20 +175,20 @@ const ChartUpdater = ({
|
|
|
169
175
|
|
|
170
176
|
return fieldsWithFormattedValues;
|
|
171
177
|
});
|
|
172
|
-
}, [chartConfig
|
|
178
|
+
}, [chartConfig]);
|
|
173
179
|
|
|
174
180
|
const handleDownloadCSV = () => {
|
|
175
181
|
downloadCSV(memoizedData, chartConfig.name);
|
|
176
182
|
};
|
|
177
183
|
|
|
178
|
-
if (!chartConfig || loading
|
|
184
|
+
if (!chartConfig || loading) {
|
|
179
185
|
return (
|
|
180
186
|
<div
|
|
181
187
|
// className="flex flex-col flex-1 h-[100%]"
|
|
182
188
|
style={{
|
|
183
189
|
...containerStyle,
|
|
184
|
-
marginLeft: 25,
|
|
185
|
-
marginRight: 25,
|
|
190
|
+
// marginLeft: 25,
|
|
191
|
+
// marginRight: 25,
|
|
186
192
|
boxSizing: 'content-box',
|
|
187
193
|
height: '100%',
|
|
188
194
|
display: 'flex',
|
|
@@ -220,26 +226,14 @@ const ChartUpdater = ({
|
|
|
220
226
|
}
|
|
221
227
|
|
|
222
228
|
return (
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
flexDirection: 'column',
|
|
232
|
-
// justifyContent: 'space-between',
|
|
233
|
-
}}
|
|
234
|
-
>
|
|
235
|
-
<Columns
|
|
236
|
-
columns={chartConfig.columns}
|
|
237
|
-
data={memoizedData}
|
|
238
|
-
theme={theme}
|
|
239
|
-
handleDownloadCSV={handleDownloadCSV}
|
|
240
|
-
numToShow={NUM_TO_SHOW}
|
|
241
|
-
/>
|
|
242
|
-
</div>
|
|
229
|
+
<SpecialTable
|
|
230
|
+
showDownloadCsvButton
|
|
231
|
+
csvFilename={chartConfig.name}
|
|
232
|
+
columns={chartConfig.columns}
|
|
233
|
+
rows={memoizedData}
|
|
234
|
+
height={containerStyle?.height || '100%'}
|
|
235
|
+
theme={theme}
|
|
236
|
+
/>
|
|
243
237
|
);
|
|
244
238
|
};
|
|
245
239
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* eslint-disable react/display-name */
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { useOnClickOutside, useOnWindowResize } from '../../hooks';
|
|
5
|
+
|
|
6
|
+
import { HorizontalPosition } from '../../lib/inputTypes';
|
|
7
|
+
import { mergeRefs } from '../../lib';
|
|
8
|
+
|
|
9
|
+
export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
showModal: boolean;
|
|
11
|
+
setShowModal:
|
|
12
|
+
| React.Dispatch<React.SetStateAction<boolean>>
|
|
13
|
+
| ((nextState: boolean) => void);
|
|
14
|
+
parentRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
width?: number;
|
|
16
|
+
maxHeight?: string;
|
|
17
|
+
anchorPosition?: HorizontalPosition;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
theme: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const BigModal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
showModal,
|
|
25
|
+
setShowModal,
|
|
26
|
+
parentRef,
|
|
27
|
+
width,
|
|
28
|
+
maxHeight = '18rem',
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
theme,
|
|
32
|
+
...other
|
|
33
|
+
} = props;
|
|
34
|
+
const [modalExceedsWindow, setModalExceedsWindow] = useState(false);
|
|
35
|
+
|
|
36
|
+
const modalRef = useRef<HTMLDivElement>(null);
|
|
37
|
+
|
|
38
|
+
const checkModalExceedsWindow = useCallback(
|
|
39
|
+
(modalWidth: number, windowWidth: number): boolean => {
|
|
40
|
+
if (!parentRef.current) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const modalBoundingRight =
|
|
44
|
+
parentRef.current.getBoundingClientRect().left + modalWidth;
|
|
45
|
+
return windowWidth - modalBoundingRight < 0;
|
|
46
|
+
},
|
|
47
|
+
[parentRef]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const getAbsoluteSpacing = () => {
|
|
51
|
+
return modalExceedsWindow ? '0' : '0';
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
useOnClickOutside(modalRef, e => {
|
|
55
|
+
// Exclude click on trigger button (e.g. Dropdown Button) from outside click handler
|
|
56
|
+
const isTriggerElem = parentRef
|
|
57
|
+
? parentRef.current?.contains(e.target)
|
|
58
|
+
: false;
|
|
59
|
+
if (!isTriggerElem) {
|
|
60
|
+
setShowModal(false);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Execute only when modal is of absolute size
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (width) {
|
|
67
|
+
setModalExceedsWindow(checkModalExceedsWindow(width, window.innerWidth));
|
|
68
|
+
}
|
|
69
|
+
}, [checkModalExceedsWindow, parentRef, width]);
|
|
70
|
+
|
|
71
|
+
useOnWindowResize(() => {
|
|
72
|
+
if (width) {
|
|
73
|
+
setModalExceedsWindow(checkModalExceedsWindow(width, window.innerWidth));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return showModal ? (
|
|
78
|
+
<div
|
|
79
|
+
ref={mergeRefs([modalRef, ref])}
|
|
80
|
+
style={{
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
zIndex: 10,
|
|
83
|
+
overflowY: 'auto',
|
|
84
|
+
backgroundColor: theme?.backgroundColor || 'white',
|
|
85
|
+
borderColor: theme?.borderColor || '#E5E7EB',
|
|
86
|
+
borderTopStyle: 'solid',
|
|
87
|
+
borderBottomStyle: 'solid',
|
|
88
|
+
borderLeftStyle: 'solid',
|
|
89
|
+
borderRightStyle: 'solid',
|
|
90
|
+
borderTopWidth: 1,
|
|
91
|
+
borderBottomWidth: 1,
|
|
92
|
+
borderLeftWidth: 1,
|
|
93
|
+
borderRightWidth: 1,
|
|
94
|
+
borderRadius: '0.375rem',
|
|
95
|
+
boxShadow:
|
|
96
|
+
'0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
97
|
+
top: '50%',
|
|
98
|
+
left: '50%',
|
|
99
|
+
transform: 'translate(-50%, -50%)',
|
|
100
|
+
}}
|
|
101
|
+
{...other}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</div>
|
|
105
|
+
) : null;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export default BigModal;
|
|
@@ -11,7 +11,7 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
setShowModal:
|
|
12
12
|
| React.Dispatch<React.SetStateAction<boolean>>
|
|
13
13
|
| ((nextState: boolean) => void);
|
|
14
|
-
parentRef
|
|
14
|
+
parentRef?: React.RefObject<HTMLElement>;
|
|
15
15
|
width?: number;
|
|
16
16
|
maxHeight?: string;
|
|
17
17
|
anchorPosition?: HorizontalPosition;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
This is a log of the exact prompt/completion pairs sent/received from the LLM during this step
|
|
2
|
+
|
|
3
|
+
############################################
|
|
4
|
+
|
|
5
|
+
Prompt:
|
|
6
|
+
|
|
7
|
+
<Assistant>
|
|
8
|
+
Called function Welcome to Continue
|
|
9
|
+
|
|
10
|
+
<User>
|
|
11
|
+
/edit convert from rem to px using 1rem = 16px
|
|
12
|
+
|
|
13
|
+
<User>
|
|
14
|
+
/edit convert from rem to px using 1rem = 16px
|
|
15
|
+
|
|
16
|
+
<User>
|
|
17
|
+
convert from rem to px using 1rem = 16px
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
############################################
|
|
22
|
+
|
|
23
|
+
Completion:
|
|
24
|
+
|
|
25
|
+
To convert from rem to pixels, you simply multiply the rem value by 16.
|
|
26
|
+
|
|
27
|
+
For example, if you have a value of 2rem and you want to convert it to pixels, you would do:
|
|
28
|
+
|
|
29
|
+
2rem * 16 = 32px
|
|
30
|
+
|
|
31
|
+
So, 2rem is equal to 32px.
|
|
32
|
+
|
|
33
|
+
############################################
|
|
34
|
+
|
|
35
|
+
Prompt:
|
|
36
|
+
|
|
37
|
+
<User>
|
|
38
|
+
Diff summary: "convert from rem to px using 1rem = 16px"
|
|
39
|
+
|
|
40
|
+
```diff
|
|
41
|
+
- padding: '1rem',
|
|
42
|
+
- borderRadius: '0.375rem',
|
|
43
|
+
+ To convert from rem to pixels, you simply multiply the rem value by 16.
|
|
44
|
+
+
|
|
45
|
+
+ For example, if you have a value of 2rem and you want to convert it to pixels, you would do:
|
|
46
|
+
+
|
|
47
|
+
+ 2rem * 16 = 32px
|
|
48
|
+
+
|
|
49
|
+
+ So, 2rem is equal to 32px.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Please give brief a description of the changes made above using markdown bullet points. Be concise:
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
############################################
|
|
57
|
+
|
|
58
|
+
Completion:
|
|
59
|
+
|
|
60
|
+
"- The code originally used `rem` units for padding and border radius.\n- The diff summary explains how to convert `rem` units to `px` units using the conversion factor of 1rem = 16px.\n- An example is provided to illustrate the conversion process.\n- The final statement clarifies that 2rem is equal to 32px."
|
|
61
|
+
|
|
62
|
+
############################################
|
|
63
|
+
|
|
64
|
+
Prompt:
|
|
65
|
+
|
|
66
|
+
<User>
|
|
67
|
+
Write a very short title to describe this requested change (no quotes): 'convert from rem to px using 1rem = 16px'. This is the title:
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
############################################
|
|
72
|
+
|
|
73
|
+
Completion:
|
|
74
|
+
|
|
75
|
+
"Rem to Px Conversion: 1rem = 16px"
|
package/src/hooks/useQuill.ts
CHANGED
|
@@ -77,28 +77,14 @@ export const useQuill = (
|
|
|
77
77
|
} = client;
|
|
78
78
|
try {
|
|
79
79
|
if (queryEndpoint) {
|
|
80
|
-
const resp = await axios.
|
|
81
|
-
'https://quill-344421.uc.r.appspot.com/selfhostitem',
|
|
82
|
-
{
|
|
83
|
-
params: {
|
|
84
|
-
id: chartId,
|
|
85
|
-
orgId: customerId,
|
|
86
|
-
publicKey: publicKey,
|
|
87
|
-
},
|
|
88
|
-
environment: environment || undefined,
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const resp1 = await axios.post(
|
|
80
|
+
const resp = await axios.post(
|
|
93
81
|
queryEndpoint,
|
|
94
|
-
{
|
|
82
|
+
{ metadata: { id: chartId, task: 'item' } },
|
|
95
83
|
{ headers: queryHeaders }
|
|
96
84
|
);
|
|
97
85
|
setLoading(false);
|
|
98
86
|
setData({
|
|
99
87
|
...resp.data,
|
|
100
|
-
rows: resp1.data.rows,
|
|
101
|
-
fields: resp1.data.fields,
|
|
102
88
|
});
|
|
103
89
|
dispatch({ type: 'UPDATE_DASHBOARD_ITEM', id, data: resp.data });
|
|
104
90
|
} else {
|
package/src/index.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { default as Chart } from './Chart';
|
|
|
5
5
|
export { default as Table } from './Table';
|
|
6
6
|
export { default as SQLEditor } from './SQLEditor';
|
|
7
7
|
export { default as ReportBuilder } from './ReportBuilder';
|
|
8
|
+
export { default as AddToDashboardModal } from './AddToDashboardModal';
|
|
8
9
|
export { useQuill } from './hooks/useQuill';
|