From f698bc178962a877b13359786918f8effb1c8ee1 Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Thu, 4 Sep 2025 15:36:27 +0300 Subject: [PATCH] =?UTF-8?q?WEBAPP:=20P8PDialog=20-=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20=D0=BD=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D1=88=D0=B8=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D1=8B=20(width)=20=D0=B8=20=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20(fullWidth)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/p8p_dialog.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/components/p8p_dialog.js b/app/components/p8p_dialog.js index 30ab288..8c2cd8e 100644 --- a/app/components/p8p_dialog.js +++ b/app/components/p8p_dialog.js @@ -13,12 +13,25 @@ import { Dialog, DialogTitle, DialogContent, DialogActions, Button } from "@mui/ import { BUTTONS } from "../../app.text"; //Общие текстовые ресурсы import { P8P_INPUT, P8PInput } from "./p8p_input"; //Поле ввода +//--------- +//Константы +//--------- + +//Типовая ширина диалога +const P8P_DIALOG_WIDTH = { + XS: "xs", + SM: "sm", + MD: "md", + LG: "lg", + XL: "xl" +}; + //----------- //Тело модуля //----------- //Диалог -const P8PDialog = ({ title, inputs = [], children, onOk, onCancel, onClose }) => { +const P8PDialog = ({ title, width, fullWidth, inputs = [], children, onOk, onCancel, onClose }) => { //Состояние диалога const [state, setState] = useState({}); @@ -42,7 +55,7 @@ const P8PDialog = ({ title, inputs = [], children, onOk, onCancel, onClose }) => //Формирование представления return ( - + {title} {inputs.map((input, i) => ( @@ -62,6 +75,8 @@ const P8PDialog = ({ title, inputs = [], children, onOk, onCancel, onClose }) => //Контроль свойств - Диалог P8PDialog.propTypes = { title: PropTypes.string.isRequired, + width: PropTypes.oneOf(Object.values(P8P_DIALOG_WIDTH)), + fullWidth: PropTypes.bool, inputs: PropTypes.arrayOf(PropTypes.shape(P8P_INPUT)), children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]), onOk: PropTypes.func, @@ -73,4 +88,4 @@ P8PDialog.propTypes = { //Интерфейс модуля //---------------- -export { P8PDialog }; +export { P8PDialog, P8P_DIALOG_WIDTH };