@quillsql/react 1.6.0 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/AddToDashboardButton.d.ts +1 -0
  2. package/lib/AddToDashboardButton.js +2 -0
  3. package/lib/AddToDashboardButton.js.map +1 -0
  4. package/lib/AddToDashboardModal.d.ts +22 -0
  5. package/lib/AddToDashboardModal.js +638 -0
  6. package/lib/AddToDashboardModal.js.map +1 -0
  7. package/lib/BarList.js +28 -28
  8. package/lib/BarList.js.map +1 -1
  9. package/lib/Chart.js +30 -114
  10. package/lib/Chart.js.map +1 -1
  11. package/lib/Context.d.ts +3 -3
  12. package/lib/Context.js +3 -3
  13. package/lib/Context.js.map +1 -1
  14. package/lib/Dashboard.js +31 -16
  15. package/lib/Dashboard.js.map +1 -1
  16. package/lib/Dialog.d.ts +68 -0
  17. package/lib/Dialog.js +407 -0
  18. package/lib/Dialog.js.map +1 -0
  19. package/lib/Portal.d.ts +32 -0
  20. package/lib/Portal.js +171 -0
  21. package/lib/Portal.js.map +1 -0
  22. package/lib/Props.d.ts +0 -0
  23. package/lib/Props.js +2 -0
  24. package/lib/Props.js.map +1 -0
  25. package/lib/QuillProvider.d.ts +32 -14
  26. package/lib/QuillProvider.js +15 -2
  27. package/lib/QuillProvider.js.map +1 -1
  28. package/lib/ReportBuilder.d.ts +26 -2
  29. package/lib/ReportBuilder.js +220 -492
  30. package/lib/ReportBuilder.js.map +1 -1
  31. package/lib/SQLEditor.d.ts +35 -1
  32. package/lib/SQLEditor.js +264 -211
  33. package/lib/SQLEditor.js.map +1 -1
  34. package/lib/Table.js +2 -10
  35. package/lib/Table.js.map +1 -1
  36. package/lib/components/BigModal/BigModal.d.ts +14 -0
  37. package/lib/components/BigModal/BigModal.js +85 -0
  38. package/lib/components/BigModal/BigModal.js.map +1 -0
  39. package/lib/components/BigModal/Modal.d.ts +14 -0
  40. package/lib/components/BigModal/Modal.js +109 -0
  41. package/lib/components/BigModal/Modal.js.map +1 -0
  42. package/lib/components/Modal/Modal.d.ts +1 -1
  43. package/lib/hooks/useQuill.js +14 -24
  44. package/lib/hooks/useQuill.js.map +1 -1
  45. package/lib/hooks/useSyncRefs.d.ts +5 -0
  46. package/lib/hooks/useSyncRefs.js +38 -0
  47. package/lib/hooks/useSyncRefs.js.map +1 -0
  48. package/lib/index.d.ts +1 -0
  49. package/lib/index.js +1 -0
  50. package/lib/index.js.map +1 -1
  51. package/lib/types/Props.d.ts +0 -0
  52. package/lib/types/Props.js +2 -0
  53. package/lib/types/Props.js.map +1 -0
  54. package/lib/types.d.ts +27 -0
  55. package/lib/types.js +6 -0
  56. package/lib/types.js.map +1 -0
  57. package/package.json +2 -1
  58. package/src/AddToDashboardModal.tsx +1213 -0
  59. package/src/BarList.tsx +28 -28
  60. package/src/Chart.tsx +31 -107
  61. package/src/Context.tsx +8 -5
  62. package/src/Dashboard.tsx +29 -2
  63. package/src/QuillProvider.tsx +52 -10
  64. package/src/ReportBuilder.tsx +433 -652
  65. package/src/SQLEditor.tsx +578 -235
  66. package/src/Table.tsx +9 -21
  67. package/src/components/BigModal/BigModal.tsx +108 -0
  68. package/src/components/Modal/Modal.tsx +1 -1
  69. package/src/continue_logs.txt +75 -0
  70. package/src/hooks/useQuill.ts +2 -16
  71. 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] = useContext(ThemeContext);
25
+ const [theme] =
26
+ useContext<[QuillTheme, (theme: QuillTheme) => void]>(ThemeContext);
24
27
 
25
28
  const downloadCSV = (rows, name) => {
26
29
  // report.rows
@@ -220,26 +223,11 @@ const ChartUpdater = ({
220
223
  }
221
224
 
222
225
  return (
223
- <div
224
- style={{
225
- boxSizing: 'content-box',
226
- height: containerStyle?.height || '100%',
227
- marginTop: 20,
228
- // overflow: 'hidden',
229
- display: 'flex',
230
- marginLeft: '1rem',
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>
226
+ <SpecialTable
227
+ columns={chartConfig.columns}
228
+ data={memoizedData}
229
+ height={containerStyle?.height || '100%'}
230
+ />
243
231
  );
244
232
  };
245
233
 
@@ -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: React.RefObject<HTMLElement>;
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"
@@ -77,28 +77,14 @@ export const useQuill = (
77
77
  } = client;
78
78
  try {
79
79
  if (queryEndpoint) {
80
- const resp = await axios.get(
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
- { query: resp.data.queryString },
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';