@quillsql/react 2.11.15 → 2.11.16

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 (67) hide show
  1. package/dist/cjs/ChartBuilder.d.ts +7 -4
  2. package/dist/cjs/ChartBuilder.d.ts.map +1 -1
  3. package/dist/cjs/ChartBuilder.js +11 -10
  4. package/dist/cjs/Dashboard.d.ts +1 -0
  5. package/dist/cjs/Dashboard.d.ts.map +1 -1
  6. package/dist/cjs/Dashboard.js +3 -3
  7. package/dist/cjs/ReportBuilder.d.ts +18 -10
  8. package/dist/cjs/ReportBuilder.d.ts.map +1 -1
  9. package/dist/cjs/ReportBuilder.js +125 -72
  10. package/dist/cjs/SQLEditor.d.ts +1 -7
  11. package/dist/cjs/SQLEditor.d.ts.map +1 -1
  12. package/dist/cjs/SQLEditor.js +19 -4
  13. package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts +24 -1
  14. package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
  15. package/dist/cjs/components/ReportBuilder/AddColumnPopover.js +26 -9
  16. package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts +13 -2
  17. package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
  18. package/dist/cjs/components/ReportBuilder/AddLimitPopover.js +18 -8
  19. package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts +2 -2
  20. package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
  21. package/dist/cjs/components/ReportBuilder/AddSortPopover.js +7 -7
  22. package/dist/cjs/components/ReportBuilder/ui.d.ts +0 -1
  23. package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
  24. package/dist/cjs/components/ReportBuilder/ui.js +17 -22
  25. package/dist/cjs/components/ReportBuilder/util.d.ts +1 -0
  26. package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
  27. package/dist/cjs/components/ReportBuilder/util.js +20 -1
  28. package/dist/cjs/components/UiComponents.d.ts +15 -14
  29. package/dist/cjs/components/UiComponents.d.ts.map +1 -1
  30. package/dist/cjs/components/UiComponents.js +14 -9
  31. package/dist/cjs/utils/width.d.ts +12 -0
  32. package/dist/cjs/utils/width.d.ts.map +1 -0
  33. package/dist/cjs/utils/width.js +25 -0
  34. package/dist/esm/ChartBuilder.d.ts +7 -4
  35. package/dist/esm/ChartBuilder.d.ts.map +1 -1
  36. package/dist/esm/ChartBuilder.js +11 -10
  37. package/dist/esm/Dashboard.d.ts +1 -0
  38. package/dist/esm/Dashboard.d.ts.map +1 -1
  39. package/dist/esm/Dashboard.js +3 -3
  40. package/dist/esm/ReportBuilder.d.ts +18 -10
  41. package/dist/esm/ReportBuilder.d.ts.map +1 -1
  42. package/dist/esm/ReportBuilder.js +127 -74
  43. package/dist/esm/SQLEditor.d.ts +1 -7
  44. package/dist/esm/SQLEditor.d.ts.map +1 -1
  45. package/dist/esm/SQLEditor.js +19 -4
  46. package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts +24 -1
  47. package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
  48. package/dist/esm/components/ReportBuilder/AddColumnPopover.js +27 -10
  49. package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts +13 -2
  50. package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
  51. package/dist/esm/components/ReportBuilder/AddLimitPopover.js +19 -9
  52. package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts +2 -2
  53. package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
  54. package/dist/esm/components/ReportBuilder/AddSortPopover.js +7 -7
  55. package/dist/esm/components/ReportBuilder/ui.d.ts +0 -1
  56. package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
  57. package/dist/esm/components/ReportBuilder/ui.js +17 -21
  58. package/dist/esm/components/ReportBuilder/util.d.ts +1 -0
  59. package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
  60. package/dist/esm/components/ReportBuilder/util.js +18 -0
  61. package/dist/esm/components/UiComponents.d.ts +15 -14
  62. package/dist/esm/components/UiComponents.d.ts.map +1 -1
  63. package/dist/esm/components/UiComponents.js +14 -9
  64. package/dist/esm/utils/width.d.ts +12 -0
  65. package/dist/esm/utils/width.d.ts.map +1 -0
  66. package/dist/esm/utils/width.js +21 -0
  67. package/package.json +1 -1
@@ -1,2 +1,25 @@
1
- export default function AddColumnPopover({ onSave, orderedColumnNames, setOrderedColumnNames, selectedColumns, setSelectedColumns, isSelectedAllColumns, clearAllState, nameToColumn, baseAst, setBaseAst, pivot, initialTableName, defaultAST, defaultTable, setPivot, TextInput, SelectColumn, SecondaryButton, Button, HandleButton, }: any): import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
+ import { TextInputComponentProps } from '../UiComponents';
3
+ export default function AddColumnPopover({ onSave, orderedColumnNames, setOrderedColumnNames, selectedColumns, setSelectedColumns, isSelectedAllColumns, clearAllState, nameToColumn, baseAst, setBaseAst, pivot, initialTableName, defaultAST, defaultTable, setPivot, TextInput, SelectColumn, SecondaryButton, Button, HandleButton, }: {
4
+ onSave: any;
5
+ orderedColumnNames: any;
6
+ setOrderedColumnNames: any;
7
+ selectedColumns: any;
8
+ setSelectedColumns: any;
9
+ isSelectedAllColumns: any;
10
+ clearAllState: any;
11
+ nameToColumn: any;
12
+ baseAst: any;
13
+ setBaseAst: any;
14
+ pivot: any;
15
+ initialTableName: any;
16
+ defaultAST: any;
17
+ defaultTable: any;
18
+ setPivot: any;
19
+ TextInput: (props: TextInputComponentProps) => JSX.Element;
20
+ SelectColumn: any;
21
+ SecondaryButton: any;
22
+ Button: any;
23
+ HandleButton: any;
24
+ }): import("react/jsx-runtime").JSX.Element;
2
25
  //# sourceMappingURL=AddColumnPopover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddColumnPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddColumnPopover.tsx"],"names":[],"mappings":"AAoBA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,MAAM,EACN,YAAY,GACb,EAAE,GAAG,2CAgML"}
1
+ {"version":3,"file":"AddColumnPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddColumnPopover.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAI1D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,MAAM,EACN,YAAY,GACb,EAAE;IACD,MAAM,EAAE,GAAG,CAAC;IACZ,kBAAkB,EAAE,GAAG,CAAC;IACxB,qBAAqB,EAAE,GAAG,CAAC;IAC3B,eAAe,EAAE,GAAG,CAAC;IACrB,kBAAkB,EAAE,GAAG,CAAC;IACxB,oBAAoB,EAAE,GAAG,CAAC;IAC1B,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,EAAE,GAAG,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC;IACb,UAAU,EAAE,GAAG,CAAC;IAChB,KAAK,EAAE,GAAG,CAAC;IACX,gBAAgB,EAAE,GAAG,CAAC;IACtB,UAAU,EAAE,GAAG,CAAC;IAChB,YAAY,EAAE,GAAG,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC3D,YAAY,EAAE,GAAG,CAAC;IAClB,eAAe,EAAE,GAAG,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC;IACZ,YAAY,EAAE,GAAG,CAAC;CACnB,2CAsNA"}
@@ -1,12 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useContext, useState } from 'react';
2
+ import { useContext, useState, useRef, useEffect } from 'react';
3
3
  import { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors, } from '@dnd-kit/core';
4
4
  import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy, useSortable, } from '@dnd-kit/sortable';
5
5
  import { CSS as DND_CSS } from '@dnd-kit/utilities';
6
6
  import { ThemeContext } from '../../Context';
7
+ import { updateFirstChildWidth } from '../../utils/width';
8
+ import { snakeCaseToTitleCase } from '../../utils/textProcessing';
7
9
  export default function AddColumnPopover({ onSave, orderedColumnNames, setOrderedColumnNames, selectedColumns, setSelectedColumns, isSelectedAllColumns, clearAllState, nameToColumn, baseAst, setBaseAst, pivot, initialTableName, defaultAST, defaultTable, setPivot, TextInput, SelectColumn, SecondaryButton, Button, HandleButton, }) {
8
10
  const [theme] = useContext(ThemeContext);
9
11
  const [search, setSearch] = useState('');
12
+ const [searchResults, setSearchResults] = useState(orderedColumnNames);
13
+ const textInputContainerRef = useRef(null);
14
+ const [searchInputWidth, setSearchInputWidth] = useState(200);
15
+ useEffect(() => {
16
+ // Since the TextInput component takes a required numeric width parameter,
17
+ // we dynamically calculate the width of this component onload here.
18
+ updateFirstChildWidth(textInputContainerRef, setSearchInputWidth);
19
+ }, []);
10
20
  const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
11
21
  coordinateGetter: sortableKeyboardCoordinates,
12
22
  }));
@@ -27,25 +37,32 @@ export default function AddColumnPopover({ onSave, orderedColumnNames, setOrdere
27
37
  const { valueField, rowField, columnField } = pivot;
28
38
  return [valueField, rowField, columnField].filter(Boolean);
29
39
  };
30
- const searchResults = orderedColumnNames
31
- .filter((row) => {
32
- const [table, _column] = row.split('.');
33
- return (selectedColumns.length === 0 || selectedColumns[0].startsWith(table));
34
- })
35
- .filter((row) => search.length === 0 || row.includes(search));
40
+ useEffect(() => {
41
+ setSearchResults(orderedColumnNames
42
+ .filter((row) => {
43
+ const [table, _column] = row.split('.');
44
+ return (selectedColumns.length === 0 || selectedColumns[0].startsWith(table));
45
+ })
46
+ .filter((row) => search.length === 0 ||
47
+ row.includes(search) ||
48
+ snakeCaseToTitleCase(row)
49
+ .toLowerCase()
50
+ .includes(search.toLowerCase())));
51
+ }, [search, orderedColumnNames, selectedColumns]);
36
52
  return (_jsxs("div", { style: {
37
53
  display: 'flex',
38
54
  flexDirection: 'column',
39
55
  gap: 2,
40
56
  minWidth: 300,
41
57
  maxHeight: 500,
42
- }, children: [_jsx("div", { style: {
58
+ }, children: [_jsx("div", { ref: textInputContainerRef, style: {
43
59
  position: 'relative',
44
60
  display: 'flex',
45
61
  flexDirection: 'row',
46
62
  alignItems: 'center',
47
63
  marginTop: 2,
48
- }, children: _jsx(TextInput, { type: "text", value: search, placeholder: 'Search...', style: { marginBottom: 6, width: '100%' }, onChange: (e) => setSearch(e.target.value) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: orderedColumnNames, strategy: verticalListSortingStrategy, children: _jsxs("div", { style: {
64
+ marginBottom: 6,
65
+ }, children: _jsx(TextInput, { id: 'add_column_search_bar', value: search, placeholder: 'Search...', width: searchInputWidth, onChange: (e) => setSearch(e.target.value) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: orderedColumnNames, strategy: verticalListSortingStrategy, children: _jsxs("div", { style: {
49
66
  display: 'flex',
50
67
  flexDirection: 'column',
51
68
  gap: 8,
@@ -60,7 +77,7 @@ export default function AddColumnPopover({ onSave, orderedColumnNames, setOrdere
60
77
  gap: 8,
61
78
  justifyContent: 'end',
62
79
  marginTop: 12,
63
- }, children: [selectedColumns.length > 0 && !isSelectedAllColumns() && (_jsx(SecondaryButton, { onClick: () => setSelectedColumns(orderedColumnNames.filter((row) => {
80
+ }, children: [selectedColumns.length > 0 && !isSelectedAllColumns() && (_jsx(SecondaryButton, { onClick: () => setSelectedColumns(searchResults.filter((row) => {
64
81
  const [table, _column] = row.split('.');
65
82
  return selectedColumns[0].startsWith(table);
66
83
  })), label: "Select all" })), selectedColumns.length > 0 && isSelectedAllColumns() && (_jsx(SecondaryButton, { onClick: () => setSelectedColumns([]), label: "Clear" })), _jsx(Button, { onClick: () => {
@@ -1,3 +1,14 @@
1
- export declare const LimitSentence: ({ limit, handleDelete, setOpenPopover, onSave, popoverTitle, LimitPopover, EditPopover, children, }: any) => import("react/jsx-runtime").JSX.Element;
2
- export declare const AddLimitPopover: ({ onSave, initialLimit, isEdit, onDelete, }: any) => import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
+ import { ButtonComponentProps, TextInputComponentProps } from '../UiComponents';
3
+ export declare const LimitSentence: ({ limit, handleDelete, setOpenPopover, onSave, popoverTitle, LimitPopover, EditPopover, TextInput, Button, SecondaryButton, children, }: any) => import("react/jsx-runtime").JSX.Element;
4
+ export interface AddLimitPopoverProps {
5
+ onSave: (limit: number) => void;
6
+ initialLimit?: number;
7
+ isEdit?: boolean;
8
+ onDelete?: () => void;
9
+ TextInput?: (props: TextInputComponentProps) => JSX.Element;
10
+ Button?: (props: ButtonComponentProps) => JSX.Element;
11
+ SecondaryButton?: (props: ButtonComponentProps) => JSX.Element;
12
+ }
13
+ export declare const AddLimitPopover: ({ onSave, initialLimit, isEdit, onDelete, TextInput, Button, SecondaryButton, }: AddLimitPopoverProps) => import("react/jsx-runtime").JSX.Element;
3
14
  //# sourceMappingURL=AddLimitPopover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddLimitPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddLimitPopover.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,wGASvB,GAAG,4CAiCL,CAAC;AAEF,eAAO,MAAM,eAAe,gDAKzB,GAAG,4CAmCL,CAAC"}
1
+ {"version":3,"file":"AddLimitPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddLimitPopover.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,oBAAoB,EAIpB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAUzB,eAAO,MAAM,aAAa,4IAYvB,GAAG,4CAoCL,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC5D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,GAAG,CAAC,OAAO,CAAC;IACtD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,GAAG,CAAC,OAAO,CAAC;CAChE;AAED,eAAO,MAAM,eAAe,oFAQzB,oBAAoB,4CA+CtB,CAAC"}
@@ -1,13 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useContext } from 'react';
3
- import { MemoizedButton, MemoizedSecondaryButton } from '../UiComponents';
3
+ import { MemoizedButton, MemoizedSecondaryButton, QuillTextInput, } from '../UiComponents';
4
4
  import { ThemeContext } from '../../Context';
5
- import { QuillTextInput } from './ui';
6
5
  const SORT_VALUE_TO_LABEL = {
7
6
  ASC: 'ascending',
8
7
  DESC: 'descending',
9
8
  };
10
- export const LimitSentence = ({ limit, handleDelete, setOpenPopover, onSave, popoverTitle = 'Edit limit', LimitPopover, EditPopover, children, }) => {
9
+ export const LimitSentence = ({ limit, handleDelete, setOpenPopover, onSave, popoverTitle = 'Edit limit', LimitPopover, EditPopover, TextInput = QuillTextInput, Button = MemoizedButton, SecondaryButton = MemoizedSecondaryButton, children, }) => {
11
10
  const [isOpen, setIsOpen] = useState(false);
12
11
  const handleClickDelete = (e) => {
13
12
  setOpenPopover(null);
@@ -20,19 +19,30 @@ export const LimitSentence = ({ limit, handleDelete, setOpenPopover, onSave, pop
20
19
  filterLabel: `limit ${limit.value[0].value}`, onClickDelete: handleClickDelete, popoverTitle: popoverTitle, popoverChildren: _jsx(EditPopover, { onSave: (column, direction) => {
21
20
  setIsOpen(false);
22
21
  onSave(column, direction);
23
- }, isEdit: true, onDelete: handleClickDelete, initialLimit: limit.value[0].value }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
22
+ }, isEdit: true, onDelete: handleClickDelete, initialLimit: limit.value[0].value, TextInput: TextInput, Button: Button, SecondaryButton: SecondaryButton }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
24
23
  handleDelete();
25
24
  } }) }));
26
25
  };
27
- export const AddLimitPopover = ({ onSave, initialLimit, isEdit, onDelete, }) => {
28
- const [limit, setLimit] = useState(initialLimit || 0);
26
+ export const AddLimitPopover = ({ onSave, initialLimit = 0, isEdit = false, onDelete = () => { }, TextInput = QuillTextInput, Button = MemoizedButton, SecondaryButton = MemoizedSecondaryButton, }) => {
27
+ const [limit, setLimit] = useState(initialLimit);
29
28
  const [theme] = useContext(ThemeContext);
30
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', gap: 12, padding: '6px 0px' }, children: _jsx(QuillTextInput, { value: limit, type: "number", style: { width: 200, minHeight: 32, padding: '6px 12px' }, onChange: (e) => {
31
- setLimit(e.target.value);
29
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [_jsx("div", { style: {
30
+ display: 'flex',
31
+ flexDirection: 'row',
32
+ gap: 12,
33
+ padding: '6px 0px',
34
+ }, children: _jsx(TextInput, { id: 'add_limit_input', value: limit, width: 200,
35
+ // style={{ minHeight: 32, padding: '6px 12px' }}
36
+ onChange: (e) => {
37
+ if (Number.isNaN(parseFloat(e.target.value || '0'))) {
38
+ alert('Please input a number.');
39
+ return;
40
+ }
41
+ setLimit(parseFloat(e.target.value || '0'));
32
42
  } }) }), _jsx("div", { style: {
33
43
  display: 'flex',
34
44
  flexDirection: 'row',
35
45
  justifyContent: 'end',
36
46
  gap: 12,
37
- }, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(MemoizedButton, { onClick: () => onSave(limit), label: "Edit limit" })] })) : (_jsx(MemoizedButton, { onClick: () => onSave(limit), label: "Add limit" })) })] }));
47
+ }, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(SecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(Button, { onClick: () => onSave(limit), label: "Edit limit" })] })) : (_jsx(Button, { onClick: () => onSave(limit), label: "Add limit" })) })] }));
38
48
  };
@@ -1,3 +1,3 @@
1
- export declare const SortSentence: ({ sortData, keyPrefix, columns, handleDelete, setEditPopoverKey, setOpenPopover, setActiveEditItem, setIsPending, setActivePath, onSave, popoverTitle, SortPopover, EditPopover, children, }: any) => import("react/jsx-runtime").JSX.Element | undefined;
2
- export declare const AddSortPopover: ({ onSave, columns, isEdit, onDelete, column, }: any) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const SortSentence: ({ sortData, keyPrefix, columns, handleDelete, setEditPopoverKey, setOpenPopover, setActiveEditItem, setIsPending, setActivePath, onSave, popoverTitle, SortPopover, EditPopover, Select, Button, SecondaryButton, children, }: any) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const AddSortPopover: ({ onSave, columns, isEdit, onDelete, column, Select, Button, SecondaryButton, }: any) => import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=AddSortPopover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddSortPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddSortPopover.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,iMAetB,GAAG,wDA2CL,CAAC;AAEF,eAAO,MAAM,cAAc,mDAMxB,GAAG,4CAiEL,CAAC"}
1
+ {"version":3,"file":"AddSortPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddSortPopover.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,kOAkBtB,GAAG,mDA8CL,CAAC;AAEF,eAAO,MAAM,cAAc,oFASxB,GAAG,4CAiEL,CAAC"}
@@ -8,7 +8,7 @@ const SORT_VALUE_TO_LABEL = {
8
8
  ASC: 'ascending',
9
9
  DESC: 'descending',
10
10
  };
11
- export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEditPopoverKey, setOpenPopover, setActiveEditItem, setIsPending, setActivePath, onSave, popoverTitle = 'Edit Sort', SortPopover, EditPopover, children, }) => {
11
+ export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEditPopoverKey, setOpenPopover, setActiveEditItem, setIsPending, setActivePath, onSave, popoverTitle = 'Edit Sort', SortPopover, EditPopover, Select = QuillSelectComponent, Button = MemoizedButton, SecondaryButton = MemoizedSecondaryButton, children, }) => {
12
12
  const [isOpen, setIsOpen] = useState(false);
13
13
  const handleClickDelete = (e) => {
14
14
  e.stopPropagation(); // don't call onClick handler
@@ -19,7 +19,7 @@ export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEd
19
19
  setEditPopoverKey(null);
20
20
  };
21
21
  if (!sortData && (!sortData.expr.column || !sortData.expr.value)) {
22
- return;
22
+ return null;
23
23
  }
24
24
  return (_jsx("div", { children: _jsx(SortPopover
25
25
  // @ts-ignore
@@ -28,13 +28,13 @@ export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEd
28
28
  filterLabel: `${snakeCaseToTitleCase(sortData.expr.column) || snakeCaseToTitleCase(sortData.expr.value)} ${SORT_VALUE_TO_LABEL[sortData.type]}`, onClickDelete: handleClickDelete, popoverTitle: popoverTitle, popoverChildren: _jsx(EditPopover, { onSave: (column, direction) => {
29
29
  setIsOpen(false);
30
30
  onSave(column, direction);
31
- }, columns: columns, isEdit: true, onDelete: handleClickDelete, column: sortData.expr.column || sortData.expr.value }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
31
+ }, columns: columns, isEdit: true, onDelete: handleClickDelete, column: sortData.expr.column || sortData.expr.value, Select: Select, Button: Button, SecondaryButton: SecondaryButton }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
32
32
  setIsPending(false);
33
33
  setActiveEditItem(null);
34
34
  setActivePath(null);
35
35
  } }) }));
36
36
  };
37
- export const AddSortPopover = ({ onSave, columns, isEdit, onDelete, column, }) => {
37
+ export const AddSortPopover = ({ onSave, columns, isEdit, onDelete, column, Select = QuillSelectComponent, Button = MemoizedButton, SecondaryButton = MemoizedSecondaryButton, }) => {
38
38
  const [sortColumn, setSortColumn] = useState(column || '');
39
39
  const [sortDirection, setSortDirection] = useState('ASC');
40
40
  const [theme] = useContext(ThemeContext);
@@ -43,14 +43,14 @@ export const AddSortPopover = ({ onSave, columns, isEdit, onDelete, column, }) =
43
43
  flexDirection: 'row',
44
44
  gap: 12,
45
45
  padding: '6px 0px',
46
- }, children: [_jsx(QuillSelectComponent, { theme: theme, value: sortColumn, onChange: (value) => {
46
+ }, children: [_jsx(Select, { theme: theme, value: sortColumn, onChange: (value) => {
47
47
  setSortColumn(value);
48
48
  }, options: [
49
49
  ...columns.map((column) => ({
50
50
  label: snakeCaseToTitleCase(column.split('.')[1] || ''),
51
51
  value: column.split('.')[1],
52
52
  })),
53
- ] }), _jsx(QuillSelectComponent, { theme: theme, value: sortDirection, onChange: (value) => {
53
+ ] }), _jsx(Select, { theme: theme, value: sortDirection, onChange: (value) => {
54
54
  setSortDirection(value);
55
55
  }, options: [
56
56
  { label: 'Ascending', value: 'ASC' },
@@ -60,5 +60,5 @@ export const AddSortPopover = ({ onSave, columns, isEdit, onDelete, column, }) =
60
60
  flexDirection: 'row',
61
61
  justifyContent: 'end',
62
62
  gap: 12,
63
- }, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(MemoizedButton, { onClick: () => onSave(sortColumn, sortDirection), label: "Edit sort" })] })) : (_jsx(MemoizedButton, { onClick: () => onSave(sortColumn, sortDirection), label: "Add sort" })) })] }));
63
+ }, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(SecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(Button, { onClick: () => onSave(sortColumn, sortDirection), label: "Edit sort" })] })) : (_jsx(Button, { onClick: () => onSave(sortColumn, sortDirection), label: "Add sort" })) })] }));
64
64
  };
@@ -7,7 +7,6 @@
7
7
  */
8
8
  export declare const QuillButton: ({ children, ...props }: any) => import("react/jsx-runtime").JSX.Element;
9
9
  export declare const QuillSecondaryButton: ({ children, ...props }: any) => import("react/jsx-runtime").JSX.Element;
10
- export declare const QuillTextInput: (props: any) => import("react/jsx-runtime").JSX.Element;
11
10
  export declare const QuillReportBuilderTable: ({ rows, columns, error, ...props }: any) => import("react/jsx-runtime").JSX.Element;
12
11
  export declare const QuillTag: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<unknown>>;
13
12
  export declare const QuillSidebarHeading: ({ label }: any) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/ui.tsx"],"names":[],"mappings":";AAiBA;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,2BA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oDAK1B,GAAG,4CAsBL,CAAC"}
@@ -3,7 +3,7 @@ import { forwardRef, useContext, useEffect, useRef, useState } from 'react';
3
3
  import { MemoizedSelect, MemoizedCheckbox, MemoizedHeader, MemoizedLabel, MemoizedTabs, LoadingSpinner, MemoizedSecondaryButton, } from '../UiComponents';
4
4
  import MemoizedQuillTable from '../QuillTable';
5
5
  import { ThemeContext } from '../../Context';
6
- import { isNodeEmptyCollection } from './util';
6
+ import { isNodeEmptyCollection, allNumericNodesValidInTree } from './util';
7
7
  import { downloadCSV } from '../../utils/csv';
8
8
  import { snakeCaseToTitleCase } from '../../utils/textProcessing';
9
9
  /**
@@ -52,24 +52,6 @@ export const QuillSecondaryButton = ({ children, ...props }) => {
52
52
  ...props.style,
53
53
  }, children: children }));
54
54
  };
55
- export const QuillTextInput = (props) => {
56
- const [theme] = useContext(ThemeContext);
57
- return (_jsx("input", { ...props, style: {
58
- color: theme?.primaryTextColor,
59
- backgroundColor: theme?.backgroundColor || 'white',
60
- fontFamily: theme?.fontFamily,
61
- fontWeight: 'medium',
62
- borderWidth: '1px',
63
- borderColor: theme?.borderColor || '#E7E7E7',
64
- borderStyle: 'solid',
65
- borderRadius: '6px',
66
- boxShadow: 'rgba(0, 0, 0, 0.1) 0px 1px 5px 0px',
67
- padding: '0 12px',
68
- display: 'block',
69
- minHeight: 32,
70
- ...props.style,
71
- } }));
72
- };
73
55
  export const QuillReportBuilderTable = ({ rows, columns, error, ...props }) => {
74
56
  const reformattedColumns = columns.map((c) => ({ label: c, field: c }));
75
57
  return (_jsx("div", { style: { height: '100%', overflow: 'auto' }, children: _jsx(MemoizedQuillTable, { rows: rows, columns: reformattedColumns, rowsPerPage: 10, showDownloadCSVButton: rows?.length > 0, downloadCSV: () => downloadCSV({ rows, fields: reformattedColumns, name: 'my_report' }), emptyStateLabel: error || 'No results', ...props }) }));
@@ -305,6 +287,13 @@ export const DEFAULT_TAB_OPTIONS = [
305
287
  ];
306
288
  export const QuillTabs = forwardRef(({ options = DEFAULT_TAB_OPTIONS, ...props }, ref) => (_jsx(MemoizedTabs, { ref: ref, options: options, ...props })));
307
289
  export const EditPopover = ({ onSave, onDelete, Button, renderNode, activeEditItem, }) => {
290
+ const handleOnClick = () => {
291
+ if (!allNumericNodesValidInTree(activeEditItem)) {
292
+ alert('Please input a number.');
293
+ return;
294
+ }
295
+ onSave();
296
+ };
308
297
  return (_jsxs("div", { style: {
309
298
  display: 'flex',
310
299
  flexDirection: 'column',
@@ -315,7 +304,7 @@ export const EditPopover = ({ onSave, onDelete, Button, renderNode, activeEditIt
315
304
  justifyContent: 'end',
316
305
  gap: 8,
317
306
  width: '100%',
318
- }, children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(Button, { onClick: onSave, label: "Save" })] })] }));
307
+ }, children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(Button, { onClick: handleOnClick, label: "Save" })] })] }));
319
308
  };
320
309
  export const QuillFilterPopover = ({ filterLabel, onClickDeleteFilter, popoverTitle, popoverChildren, isOpen, setIsOpen, }) => {
321
310
  return (_jsx(QuillPopover, { isOpen: isOpen, title: popoverTitle, trigger: _jsx(QuillTag, { label: filterLabel, onClickDelete: onClickDeleteFilter, onClick: () => {
@@ -402,9 +391,16 @@ export const TagWrapper = ({ isCard, isRow, editPopoverKey, keyPrefix, formData,
402
391
  }
403
392
  };
404
393
  export const AddFilterPopover = ({ onSave, Button, renderNode, activeEditItem, }) => {
394
+ const handleOnClick = () => {
395
+ if (!allNumericNodesValidInTree(activeEditItem)) {
396
+ alert('Please input a number.');
397
+ return;
398
+ }
399
+ onSave();
400
+ };
405
401
  return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [activeEditItem && renderNode(activeEditItem), _jsx("div", { style: {
406
402
  display: 'flex',
407
403
  flexDirection: 'row',
408
404
  justifyContent: 'end',
409
- }, children: _jsx(Button, { onClick: onSave, label: 'Add filter' }) })] }));
405
+ }, children: _jsx(Button, { onClick: handleOnClick, label: 'Add filter' }) })] }));
410
406
  };
@@ -74,4 +74,5 @@ export declare const getDateFilterInfo: (node: any) => {
74
74
  intervalPaths: any;
75
75
  };
76
76
  export declare function removeNonSelectedTableReferences(ast: any, table: string): any;
77
+ export declare function allNumericNodesValidInTree(node: any): boolean;
77
78
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/util.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,YAW9C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,WAa1C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,WAK5C;AAGD,eAAO,MAAM,WAAW,SAAU,GAAG,YAuBpC,CAAC;AAKF,eAAO,MAAM,oBAAoB,SAAU,GAAG,QAE7C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG;;;;;;;;EAU3C;AAKD,eAAO,MAAM,eAAe,QAAS,GAAG,QAMvC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,WAiBvD;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,iBAQjD;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAOf;AAQD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAOf;AAMD,eAAO,MAAM,mBAAmB,SAAU,GAAG,gBAAgB,MAAM,YA4BlE,CAAC;AAIF,eAAO,MAAM,2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,MAAM,SAe5C,CAAC;AAmBF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,UAsBvE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,UAgB9C;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,sBAmBtE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,GAAG,YAU1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,GAAG,YAOxC,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,WAehD;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,GAAG,GACV,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAyB1C;AAED,eAAO,MAAM,QAAQ,QAAS,GAAG,QAAoC,CAAC;AAEtE,eAAO,MAAM,QAAQ,MAAO,MAAM,WAA2C,CAAC;AA4L9E,eAAO,MAAM,iBAAiB,SAAU,GAAG;;;;;;;CAc1C,CAAC;AAqCF,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,OAQvE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAe7D"}
@@ -662,3 +662,21 @@ export function removeNonSelectedTableReferences(ast, table) {
662
662
  console.log(ast);
663
663
  return ast;
664
664
  }
665
+ export function allNumericNodesValidInTree(node) {
666
+ if (!node)
667
+ return true;
668
+ if (node.type === 'number') {
669
+ const value = parseFloat(node.value);
670
+ console.log(node.value, value);
671
+ if (Number.isNaN(value)) {
672
+ return false;
673
+ }
674
+ else {
675
+ node.value = value;
676
+ return true;
677
+ }
678
+ }
679
+ const isLeftValid = allNumericNodesValidInTree(node.left);
680
+ const isRightValid = allNumericNodesValidInTree(node.right);
681
+ return isLeftValid && isRightValid;
682
+ }
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { CSSProperties } from 'react';
2
2
  export interface Option {
3
3
  value: string;
4
4
  label: string;
@@ -9,7 +9,8 @@ export interface SelectComponentProps {
9
9
  options: Option[];
10
10
  disabled?: boolean;
11
11
  label?: string;
12
- theme: any;
12
+ theme?: any;
13
+ style?: CSSProperties;
13
14
  }
14
15
  export interface ButtonComponentProps {
15
16
  onClick: () => void;
@@ -31,13 +32,15 @@ export interface TableComponentProps {
31
32
  rowsPerPage?: number;
32
33
  emptyStateLabel?: string;
33
34
  }
35
+ /**
36
+ * An input element used to accept data from the user.
37
+ */
34
38
  export interface TextInputComponentProps {
35
- onChange: (e: any) => void;
36
- value: string;
37
39
  id: string;
38
- placeholder: string;
39
- theme?: any;
40
- width?: string;
40
+ width: number;
41
+ value: string | number | undefined | null;
42
+ placeholder?: string;
43
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
41
44
  }
42
45
  export interface ModalComponentProps {
43
46
  children: any;
@@ -61,13 +64,11 @@ export interface DeleteButtonProps {
61
64
  onClick: () => void;
62
65
  style: any;
63
66
  }
64
- export declare const QuillTextInput: ({ value, onChange, placeholder, id, theme, }: TextInputComponentProps) => import("react/jsx-runtime").JSX.Element;
65
- export declare const MemoizedTextInput: ({ value, onChange, placeholder, id }: {
66
- value: any;
67
- onChange: any;
68
- placeholder: any;
69
- id: any;
70
- }) => import("react/jsx-runtime").JSX.Element;
67
+ /**
68
+ * The fallback TextInput element for Quill.
69
+ */
70
+ export declare const QuillTextInput: ({ id, value, width, placeholder, onChange, }: TextInputComponentProps) => import("react/jsx-runtime").JSX.Element;
71
+ export declare const MemoizedTextInput: ({ value, onChange, placeholder, id, }: TextInputComponentProps) => import("react/jsx-runtime").JSX.Element;
71
72
  export declare const MemoizedButton: ({ label, onClick, primary, isLoading, }: {
72
73
  label: any;
73
74
  onClick: any;
@@ -1 +1 @@
1
- {"version":3,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AAC;AAsBF,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAU,EACV,OAAO,EACP,WAAkB,EAClB,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE,oBAAoB,2CA2DtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAU,GACX;;;;;;;;CAAA,kDA4FA;AAED,eAAO,MAAM,oBAAoB;;;6CA0BhC,CAAC;AAEF,eAAO,MAAM,cAAc,+CAwD1B,CAAC"}
1
+ {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components/UiComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAiC,MAAM,OAAO,CAAC;AAK5E,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAo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AAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAU,EACV,OAAO,EACP,WAAkB,EAClB,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE,oBAAoB,2CA2DtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAU,GACX;;;;;;;;CAAA,kDA4FA;AAED,eAAO,MAAM,oBAAoB;;;6CA0BhC,CAAC;AAEF,eAAO,MAAM,cAAc,+CAwD1B,CAAC"}
@@ -3,7 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useContext, useEffect, useRef } from 'react';
4
4
  import { ArrowDownHeadIcon, XIcon } from '../assets';
5
5
  import { ThemeContext } from '../Context';
6
- export const QuillTextInput = ({ value, onChange, placeholder, id, theme, }) => {
6
+ /**
7
+ * The fallback TextInput element for Quill.
8
+ */
9
+ export const QuillTextInput = ({ id, value, width, placeholder, onChange, }) => {
10
+ const [theme] = useContext(ThemeContext);
7
11
  return (_jsx("input", { style: {
8
12
  display: 'flex',
9
13
  height: 40,
@@ -14,14 +18,15 @@ export const QuillTextInput = ({ value, onChange, placeholder, id, theme, }) =>
14
18
  fontSize: 14,
15
19
  boxSizing: 'border-box',
16
20
  paddingLeft: 13,
17
- backgroundColor: theme.backgroundColor,
18
- color: theme.primaryTextColor,
19
- fontFamily: theme.fontFamily,
20
- width: 200,
21
- minWidth: 200,
22
- }, id: id, type: "text", value: value, onChange: (event) => onChange(event.target.value), placeholder: placeholder }));
21
+ backgroundColor: theme?.backgroundColor,
22
+ color: theme?.primaryTextColor,
23
+ fontFamily: theme?.fontFamily,
24
+ width: width,
25
+ minWidth: width,
26
+ }, id: id, value: value, placeholder: placeholder, onChange: onChange }));
23
27
  };
24
- export const MemoizedTextInput = ({ value, onChange, placeholder, id }) => {
28
+ // TODO: depreciate this component in favor of QuillTextInput (or vice versa)
29
+ export const MemoizedTextInput = ({ value, onChange, placeholder, id, }) => {
25
30
  const [theme] = useContext(ThemeContext);
26
31
  return (_jsxs("div", { style: { position: 'relative' }, children: [_jsx("style", { children: `
27
32
  .quill-text-input {
@@ -38,7 +43,7 @@ export const MemoizedTextInput = ({ value, onChange, placeholder, id }) => {
38
43
  padding-top: 0px;
39
44
  padding-bottom: 0px;
40
45
  box-sizing: border-box;
41
- }` }), _jsx("input", { id: id, className: "quill-text-input", type: "text", value: value, onChange: (event) => onChange(event.target.value), placeholder: placeholder, style: { fontFamily: theme?.fontFamily } })] }));
46
+ }` }), _jsx("input", { id: id, className: "quill-text-input", type: "text", value: value, onChange: onChange, placeholder: placeholder, style: { fontFamily: theme?.fontFamily } })] }));
42
47
  };
43
48
  export const MemoizedButton = ({ label, onClick, primary = true, isLoading = false, }) => {
44
49
  const [theme] = useContext(ThemeContext);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Calculates the width that the first child of the given container should be
3
+ * such that the first child takes up as much space as possible in the container
4
+ * without crowding out the rest of its siblings. Also respects flexbox gap.
5
+ * @param containerRef the ref of the container element
6
+ * @param setState a callback to set the new width of the first child
7
+ * @param options config options ('gap' sets the size of the flexbox gap)
8
+ */
9
+ export declare const updateFirstChildWidth: (containerRef: React.RefObject<HTMLElement>, setState: (value: React.SetStateAction<number>) => void, options?: {
10
+ gap: number;
11
+ }) => void;
12
+ //# sourceMappingURL=width.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"width.d.ts","sourceRoot":"","sources":["../../../src/utils/width.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,iBAClB,MAAM,SAAS,CAAC,WAAW,CAAC,oBACxB,MAAM,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,YAC9C;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,SAazB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Calculates the width that the first child of the given container should be
3
+ * such that the first child takes up as much space as possible in the container
4
+ * without crowding out the rest of its siblings. Also respects flexbox gap.
5
+ * @param containerRef the ref of the container element
6
+ * @param setState a callback to set the new width of the first child
7
+ * @param options config options ('gap' sets the size of the flexbox gap)
8
+ */
9
+ export const updateFirstChildWidth = (containerRef, setState, options = { gap: 0 }) => {
10
+ if (containerRef.current) {
11
+ const element = containerRef.current;
12
+ const totalWidth = element.getBoundingClientRect().width;
13
+ const gapWidth = options.gap * (element.childElementCount - 1);
14
+ let siblingsWidth = 0;
15
+ const children = Array.from(containerRef.current.children);
16
+ for (let i = 1; i < children.length; i++) {
17
+ siblingsWidth += children[i].getBoundingClientRect().width;
18
+ }
19
+ setState(totalWidth - siblingsWidth - gapWidth);
20
+ }
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.11.15",
3
+ "version": "2.11.16",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/esm/index.js",