Skip to content

Commit fba88cd

Browse files
authored
Merge pull request #674 from rowyio/rc
v2.5.0
2 parents e968898 + 888d9c9 commit fba88cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1294
-232
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rowy",
3-
"version": "2.4.0",
3+
"version": "2.5.0",
44
"homepage": "https://rowy.io",
55
"repository": {
66
"type": "git",
@@ -15,10 +15,10 @@
1515
"@hookform/resolvers": "^2.8.5",
1616
"@mdi/js": "^6.5.95",
1717
"@monaco-editor/react": "^4.3.1",
18-
"@mui/icons-material": "^5.4.4",
19-
"@mui/lab": "^5.0.0-alpha.71",
20-
"@mui/material": "^5.4.4",
21-
"@mui/styles": "^5.4.4",
18+
"@mui/icons-material": "^5.5.1",
19+
"@mui/lab": "^5.0.0-alpha.73",
20+
"@mui/material": "^5.5.1",
21+
"@mui/styles": "^5.5.1",
2222
"@rowy/form-builder": "^0.5.3",
2323
"@rowy/multiselect": "^0.2.3",
2424
"@tinymce/tinymce-react": "^3.12.6",

src/components/CodeEditor/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function CodeEditor({
3838
extraLibs,
3939
diagnosticsOptions,
4040
onUnmount,
41-
41+
defaultLanguage = "javascript",
4242
...props
4343
}: ICodeEditorProps) {
4444
const theme = useTheme();
@@ -77,7 +77,7 @@ export default function CodeEditor({
7777
style={fullScreen ? { height: "100%" } : {}}
7878
>
7979
<Editor
80-
defaultLanguage="javascript"
80+
defaultLanguage={defaultLanguage}
8181
value={initialEditorValue}
8282
loading={<CircularProgressOptical size={20} sx={{ m: 2 }} />}
8383
className="editor"

src/components/CodeEditor/rowy.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ interface Rowy {
4848
/**
4949
* Get an existing secret from the secret manager.
5050
*/
51-
get: (name: SecretNames, version?: string) => Promise<string | undefined>;
51+
get: (
52+
name: SecretNames,
53+
version?: string
54+
) => Promise<string | any | undefined>;
5255
};
5356
/**
5457
* Gives access to the Cloud Storage.

src/components/ConfirmationDialog/Dialog.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function Confirmation({
2121
confirm,
2222
confirmationCommand,
2323
handleConfirm,
24+
handleCancel,
2425
confirmColor,
2526
open,
2627
handleClose,
@@ -60,7 +61,14 @@ export default function Confirmation({
6061

6162
<DialogActions>
6263
{!hideCancel && (
63-
<Button onClick={handleClose}>{cancel ?? "Cancel"}</Button>
64+
<Button
65+
onClick={() => {
66+
if (handleCancel) handleCancel();
67+
handleClose();
68+
}}
69+
>
70+
{cancel ?? "Cancel"}
71+
</Button>
6472
)}
6573
<Button
6674
onClick={() => {

src/components/ConfirmationDialog/props.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type confirmationProps =
88
confirm?: string | JSX.Element;
99
confirmationCommand?: string;
1010
handleConfirm: () => void;
11+
handleCancel?: () => void;
1112
open?: Boolean;
1213
confirmColor?: string;
1314
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { ReactNode, useState } from "react";
2+
3+
import {
4+
Dialog,
5+
DialogProps,
6+
Slide,
7+
IconButton,
8+
Container,
9+
} from "@mui/material";
10+
import CloseIcon from "@mui/icons-material/Close";
11+
12+
import ScrollableDialogContent, {
13+
IScrollableDialogContentProps,
14+
} from "./ScrollableDialogContent";
15+
16+
export interface IFullScreenModalProps
17+
extends Partial<Omit<DialogProps, "title">> {
18+
onClose: (setOpen: React.Dispatch<React.SetStateAction<boolean>>) => void;
19+
disableBackdropClick?: boolean;
20+
disableEscapeKeyDown?: boolean;
21+
22+
"aria-labelledby": DialogProps["aria-labelledby"];
23+
header?: ReactNode;
24+
children?: ReactNode;
25+
footer?: ReactNode;
26+
27+
hideCloseButton?: boolean;
28+
ScrollableDialogContentProps?: Partial<IScrollableDialogContentProps>;
29+
}
30+
31+
export default function FullScreenModal({
32+
onClose,
33+
disableBackdropClick,
34+
disableEscapeKeyDown,
35+
header,
36+
children,
37+
footer,
38+
hideCloseButton,
39+
ScrollableDialogContentProps,
40+
...props
41+
}: IFullScreenModalProps) {
42+
const [open, setOpen] = useState(true);
43+
const handleClose: NonNullable<DialogProps["onClose"]> = (_, reason) => {
44+
if (
45+
(disableBackdropClick && reason === "backdropClick") ||
46+
(disableEscapeKeyDown && reason === "escapeKeyDown")
47+
) {
48+
setEmphasizeCloseButton(true);
49+
return;
50+
}
51+
52+
setOpen(false);
53+
setEmphasizeCloseButton(false);
54+
setTimeout(() => onClose(setOpen), 300);
55+
};
56+
57+
const [emphasizeCloseButton, setEmphasizeCloseButton] = useState(false);
58+
59+
return (
60+
<Dialog
61+
fullScreen
62+
open={open}
63+
onClose={handleClose}
64+
TransitionComponent={Slide}
65+
TransitionProps={{ direction: "up" } as any}
66+
{...props}
67+
>
68+
<Container
69+
sx={{
70+
display: "flex",
71+
flexDirection: "column",
72+
height: "100%",
73+
pt: { xs: "var(--dialog-spacing)", xl: 6 },
74+
}}
75+
>
76+
{!hideCloseButton && (
77+
<IconButton
78+
onClick={handleClose as any}
79+
aria-label="Close"
80+
sx={{
81+
position: "absolute",
82+
top: (theme) => theme.spacing(1),
83+
right: (theme) => theme.spacing(1),
84+
85+
bgcolor: emphasizeCloseButton ? "error.main" : undefined,
86+
color: emphasizeCloseButton ? "error.contrastText" : undefined,
87+
"&:hover": emphasizeCloseButton
88+
? { bgcolor: "error.dark" }
89+
: undefined,
90+
}}
91+
className="dialog-close"
92+
>
93+
<CloseIcon />
94+
</IconButton>
95+
)}
96+
97+
{header}
98+
99+
<ScrollableDialogContent
100+
style={{ padding: 0 }}
101+
{...ScrollableDialogContentProps}
102+
>
103+
{children}
104+
</ScrollableDialogContent>
105+
106+
{footer}
107+
</Container>
108+
</Dialog>
109+
);
110+
}

src/components/RenderedMarkdown.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const components = {
99
a: (props) => <Link color="inherit" {...props} />,
1010
p: Typography,
1111
// eslint-disable-next-line jsx-a11y/alt-text
12-
img: (props) => <img style={{ maxWidth: "100%" }} {...props} />,
12+
img: (props) => (
13+
<img style={{ maxWidth: "100%", borderRadius: 4 }} {...props} />
14+
),
1315
};
1416

1517
const restrictionPresets = {
@@ -31,7 +33,7 @@ export default function RenderedMarkdown({
3133
unwrapDisallowed
3234
linkTarget="_blank"
3335
remarkPlugins={remarkPlugins}
34-
components={components}
36+
components={{ ...components, ...props.components }}
3537
/>
3638
);
3739
}

src/components/SideDrawer/index.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@ export default function SideDrawer() {
3838

3939
const handleNavigate = (direction: "up" | "down") => () => {
4040
if (!tableState?.rows) return;
41-
4241
let row = cell!.row;
4342
if (direction === "up" && row > 0) row -= 1;
4443
if (direction === "down" && row < tableState.rows.length - 1) row += 1;
45-
4644
setCell!((cell) => ({ column: cell!.column, row }));
47-
4845
const idx = tableState?.columns[cell!.column]?.index;
4946
dataGridRef?.current?.selectCell({ rowIdx: row, idx }, false);
5047
};
@@ -68,13 +65,6 @@ export default function SideDrawer() {
6865

6966
useEffect(() => {
7067
if (cell && tableState?.rows[cell.row]) {
71-
window.history.pushState(
72-
"",
73-
`${tableState?.config.id}`,
74-
`${window.location.pathname}?rowRef=${encodeURIComponent(
75-
tableState?.rows[cell.row].ref.path
76-
)}`
77-
);
7868
if (urlDocState.doc) {
7969
urlDocState.unsubscribe();
8070
dispatchUrlDoc({ path: "", doc: null });

src/components/Table/BulkActions/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export default function BulkActions({ selectedRows, columns, clearSelection }) {
143143
clearSelection();
144144
};
145145
const handleDelete = () => {
146-
deleteRow!(selectedRows.map((row) => row.ref.id));
146+
deleteRow!(selectedRows.map((row) => row.ref));
147147
clearSelection();
148148
};
149149

src/components/Table/ColumnMenu/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { getFieldProp } from "@src/components/fields";
3737
import { Column } from "react-data-grid";
3838
import { PopoverProps } from "@mui/material";
3939
import { useConfirmation } from "@src/components/ConfirmationDialog";
40+
import { analytics } from "@src/analytics";
4041

4142
const INITIAL_MODAL = { type: "", data: {} };
4243

@@ -288,8 +289,9 @@ export default function ColumnMenu() {
288289
),
289290
confirm: "Delete",
290291
confirmColor: "error",
291-
handleConfirm: () => {
292+
handleConfirm: async () => {
292293
actions.remove(column.key);
294+
await analytics.logEvent("delete_column", { type: column.type });
293295
handleClose();
294296
},
295297
}),

0 commit comments

Comments
 (0)