Skip to content

Commit

Permalink
chore: add original dialog props
Browse files Browse the repository at this point in the history
  • Loading branch information
k0stik committed Jul 31, 2024
1 parent 0b74a6a commit 9053b10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions dist/mui/components/dialog/Dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { DialogProps } from "@mui/material/Dialog";
import React from "react";
export interface DialogModalProps extends DialogProps {
id?: string;
className?: string;
titleComponent?: string | React.ReactNode;
open: boolean;
onSubmit?: (() => void) | undefined;
Expand All @@ -25,5 +24,5 @@ export interface DialogModalProps extends DialogProps {
cancelButtonProps?: ButtonProps;
draggableId?: string;
}
declare function DialogModal({ id, className, title, titleComponent, open, scroll, onSubmit, onCancel, onClose, children, maxWidth, dividers, fullWidth, isSubmitButtonDisabled, isSubmitButtonProcessing, isSubmitOnEnter, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText, cancelButtonText, submitButtonProps, cancelButtonProps, PaperComponent, draggableId, }: DialogModalProps): React.JSX.Element;
declare function DialogModal({ id, title, titleComponent, open, scroll, onSubmit, onCancel, onClose, children, maxWidth, dividers, fullWidth, isSubmitButtonDisabled, isSubmitButtonProcessing, isSubmitOnEnter, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText, cancelButtonText, submitButtonProps, cancelButtonProps, PaperComponent, draggableId, ...originalProps }: DialogModalProps): React.JSX.Element;
export default DialogModal;
4 changes: 2 additions & 2 deletions dist/mui/components/dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import React, { useCallback } from "react";
import IconByName from "../icon/IconByName";
function DialogModal({ id = "modal-dialog", className, title, titleComponent, open, scroll = "paper", onSubmit = undefined, onCancel, onClose, children, maxWidth = "sm", dividers = true, fullWidth = true, isSubmitButtonDisabled = false, isSubmitButtonProcessing = false, isSubmitOnEnter = false, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText = "Submit", cancelButtonText = "Cancel", submitButtonProps, cancelButtonProps, PaperComponent, draggableId, }) {
function DialogModal({ id = "modal-dialog", title, titleComponent, open, scroll = "paper", onSubmit = undefined, onCancel, onClose, children, maxWidth = "sm", dividers = true, fullWidth = true, isSubmitButtonDisabled = false, isSubmitButtonProcessing = false, isSubmitOnEnter = false, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText = "Submit", cancelButtonText = "Cancel", submitButtonProps, cancelButtonProps, PaperComponent, draggableId, ...originalProps }) {
const handleSubmit = () => {
if (onSubmit)
onSubmit();
Expand Down Expand Up @@ -46,7 +46,7 @@ function DialogModal({ id = "modal-dialog", className, title, titleComponent, op
React.createElement(Button, { id: `${id}-cancel-button`, variant: "text", "data-dismiss": "modal", "aria-label": cancelButtonText, onClick: handleCancel, ...cancelButtonProps }, cancelButtonText),
React.createElement(LoadingButton, { id: `${id}-submit-button`, loading: isSubmitButtonProcessing, variant: "text", "aria-label": submitButtonText, disabled: isSubmitButtonDisabled || isSubmitButtonProcessing, onClick: handleSubmit, ...submitButtonProps }, submitButtonText)));
};
return (React.createElement(Dialog, { id: id, className: className, open: open, onClose: onClose, onSubmit: onSubmit, maxWidth: maxWidth, scroll: scroll, fullWidth: fullWidth, onKeyUp: handleSubmitOnEnter, PaperComponent: PaperComponent },
return (React.createElement(Dialog, { id: id, open: open, onClose: onClose, onSubmit: onSubmit, maxWidth: maxWidth, scroll: scroll, fullWidth: fullWidth, onKeyUp: handleSubmitOnEnter, PaperComponent: PaperComponent, ...originalProps },
renderHeaderCustom ? renderHeaderCustom() : renderHeaderDefault(),
renderBodyCustom ? renderBodyCustom() : renderBodyDefault(),
renderFooterCustom ? renderFooterCustom() : renderFooterDefault()));
Expand Down
7 changes: 3 additions & 4 deletions src/mui/components/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import IconByName from "../icon/IconByName";

export interface DialogModalProps extends DialogProps {
id?: string;
className?: string;
titleComponent?: string | React.ReactNode;
open: boolean;
onSubmit?: (() => void) | undefined;
Expand All @@ -39,7 +38,6 @@ export interface DialogModalProps extends DialogProps {

function DialogModal({
id = "modal-dialog",
className,
title,
titleComponent,
open,
Expand All @@ -63,6 +61,7 @@ function DialogModal({
cancelButtonProps,
PaperComponent,
draggableId,
...originalProps
}: DialogModalProps) {
const handleSubmit = () => {
if (onSubmit) onSubmit();
Expand Down Expand Up @@ -144,15 +143,15 @@ function DialogModal({
return (
<Dialog
id={id}
className={className}
open={open}
onClose={onClose}
onSubmit={onSubmit}
maxWidth={maxWidth}
scroll={scroll}
fullWidth={fullWidth}
onKeyUp={handleSubmitOnEnter}
PaperComponent={PaperComponent}>
PaperComponent={PaperComponent}
{...originalProps}>
{renderHeaderCustom ? renderHeaderCustom() : renderHeaderDefault()}
{renderBodyCustom ? renderBodyCustom() : renderBodyDefault()}
{renderFooterCustom ? renderFooterCustom() : renderFooterDefault()}
Expand Down

0 comments on commit 9053b10

Please sign in to comment.