From ef1a63b4b69699e6f23982728400c4007c0b92de Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Thu, 4 Sep 2025 15:50:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A6=D0=98=D0=A2=D0=9A-979=20-=20=D0=94=D0=B8?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE=D0=B3=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=B8=20=D0=B0=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= =?UTF-8?q?=20-=20=D1=84=D0=B8=D0=BA=D1=81=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=88=D0=B8=D1=80=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?,=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BE=D0=B1=20=D0=BE=D1=82=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspector_query_ents/attrs_list.js | 66 +++++++++---------- .../entity_attrs_dialog.js | 35 ++++++++-- 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/app/panels/query_editor/components/inspector_query_ents/attrs_list.js b/app/panels/query_editor/components/inspector_query_ents/attrs_list.js index 08eda21..72ddbfd 100644 --- a/app/panels/query_editor/components/inspector_query_ents/attrs_list.js +++ b/app/panels/query_editor/components/inspector_query_ents/attrs_list.js @@ -22,7 +22,7 @@ const STYLES = { SMALL_TOOL_ICON: { fontSize: 20 }, - LIST: { height: "500px", width: "360px", bgcolor: "background.paper", overflowY: "auto", ...APP_STYLES.SCROLL } + LIST: { height: "100%", width: "100%", bgcolor: "background.paper", overflowY: "auto", ...APP_STYLES.SCROLL } }; //----------- @@ -30,54 +30,49 @@ const STYLES = { //----------- //Список атрибутов сущности -const AttrsList = ({ attrs = [], filter, onSelect = null, onShow = null } = {}) => { +const AttrsList = ({ attrs = [], onSelect = null, onShow = null } = {}) => { //При выборе элемента списка const handleSelectClick = attr => { onSelect && onSelect(attr); }; - //При нажатии на исправлении + //При нажатии на кнопку изменения видимости атрибута const handleShowClick = (e, attr) => { e.stopPropagation(); onShow && onShow(attr); }; - //Рег. выражение для фильтра - const filterRegExp = filter ? new RegExp(filter, "i") : null; - //Формирование представления return ( {attrs && - attrs - .filter(attr => (filterRegExp ? filterRegExp.test(attr.name) || filterRegExp.test(attr.title) : true)) - .map((attr, i) => { - const [selected, selectedTitle] = attrGetUse(attr, true); - const [showTitle, showIcon] = attrGetShow(attr, true); - return ( - - handleSelectClick(attr)} selected={selected} dense> - - - - - {`${attr.alias || attr.name}`} - - } - /> - - handleShowClick(e, attr)} title={showTitle}> - {showIcon} - - - - - ); - })} + attrs.map((attr, i) => { + const [selected, selectedTitle] = attrGetUse(attr, true); + const [showTitle, showIcon] = attrGetShow(attr, true); + return ( + + handleSelectClick(attr)} selected={selected} dense> + + + + + {`${attr.alias || attr.name}`} + + } + /> + + handleShowClick(e, attr)} title={showTitle}> + {showIcon} + + + + + ); + })} ); }; @@ -85,7 +80,6 @@ const AttrsList = ({ attrs = [], filter, onSelect = null, onShow = null } = {}) //Контроль свойств компонента - Список атрибутов сущности AttrsList.propTypes = { attrs: PropTypes.arrayOf(ATTRIBUTE_SHAPE), - filter: PropTypes.string, onSelect: PropTypes.func, onShow: PropTypes.func }; diff --git a/app/panels/query_editor/components/inspector_query_ents/entity_attrs_dialog.js b/app/panels/query_editor/components/inspector_query_ents/entity_attrs_dialog.js index d588f5b..11c0d14 100644 --- a/app/panels/query_editor/components/inspector_query_ents/entity_attrs_dialog.js +++ b/app/panels/query_editor/components/inspector_query_ents/entity_attrs_dialog.js @@ -9,11 +9,21 @@ import React, { useState, useEffect } from "react"; //Классы React import PropTypes from "prop-types"; //Контроль свойств компонента -import { TextField, InputAdornment, Icon, IconButton } from "@mui/material"; //Интерфейсные элементы MUI -import { P8PDialog } from "../../../../components/p8p_dialog"; //Типовой диалог +import { Box, TextField, InputAdornment, Icon, IconButton } from "@mui/material"; //Интерфейсные элементы MUI +import { P8PDialog, P8P_DIALOG_WIDTH } from "../../../../components/p8p_dialog"; //Типовой диалог +import { P8PComponentInlineMessage } from "../../../../components/editors/p8p_component_inline_message"; //Типовое встраиваемое сообщение import { AttrsList } from "./attrs_list"; //Список атрибутов сущности import { useEntityAttrs } from "./hooks"; //Хуки диалога настройки атрибутов сущности +//--------- +//Константы +//--------- + +//Стили +const STYLES = { + LIST_CONTAINER: { width: "100%", height: "500px" } +}; + //----------- //Тело модуля //----------- @@ -65,9 +75,18 @@ const EntityAttrsDialog = ({ query, id, title, onOk, onCancel }) => { if (srvAttrs) setAttrs(srvAttrs.map(srvAttr => ({ ...srvAttr }))); }, [srvAttrs]); + //Рег. выражение для фильтра + const filterRegExp = filter ? new RegExp(filter, "i") : null; + + //Отфильтрованные для отображения атрибуты + const filteredAttrs = attrs.filter(attr => (filterRegExp ? filterRegExp.test(attr.name) || filterRegExp.test(attr.title) : true)); + + //Флаг отображения списка атрибутов + const displayAttrsList = attrs.length == 0 ? null : filteredAttrs.length > 0 ? true : false; + //Генерация содержимого return ( - + { ) }} /> - + + {displayAttrsList === true && } + {displayAttrsList === false && ( + + )} + ); };