From 40242dedd4e1bcbdf156af388edafb344b60dff5 Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Fri, 7 Feb 2025 14:00:03 +0300 Subject: [PATCH] =?UTF-8?q?WEBAPP:=20P8PDataGrid=20-=20=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20=D0=BE=D1=82=D0=BA=D1=80?= =?UTF-8?q?=D1=8B=D1=82=D1=8B=D1=85=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BC=D0=BE=D0=BD=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8,=20=D0=BD=D0=B5=D0=BE=D0=B1?= =?UTF-8?q?=D1=8F=D0=B7=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20"reloading"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/p8p_data_grid.js | 4 ++-- app/components/p8p_table.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/components/p8p_data_grid.js b/app/components/p8p_data_grid.js index 441aac0..fc743cc 100644 --- a/app/components/p8p_data_grid.js +++ b/app/components/p8p_data_grid.js @@ -44,7 +44,7 @@ const P8PDataGrid = ({ fixedHeader = false, fixedColumns = 0, morePages = false, - reloading, + reloading = false, expandable, orderAscMenuItemCaption, orderDescMenuItemCaption, @@ -162,7 +162,7 @@ P8PDataGrid.propTypes = { fixedHeader: PropTypes.bool, fixedColumns: PropTypes.number, morePages: PropTypes.bool, - reloading: PropTypes.bool.isRequired, + reloading: PropTypes.bool, expandable: PropTypes.bool, orderAscMenuItemCaption: PropTypes.string.isRequired, orderDescMenuItemCaption: PropTypes.string.isRequired, diff --git a/app/components/p8p_table.js b/app/components/p8p_table.js index f5d3c31..0cb7c34 100644 --- a/app/components/p8p_table.js +++ b/app/components/p8p_table.js @@ -118,7 +118,9 @@ const STYLES = { }, TABLE_CELL_EXPAND_CONTAINER: { paddingBottom: 0, - paddingTop: 0 + paddingTop: 0, + paddingLeft: 0, + paddingRight: 0 }, TABLE_CELL_GROUP_HEADER: { backgroundColor: "lightgray" @@ -495,7 +497,7 @@ const P8PTable = ({ fixedHeader = false, fixedColumns = 0, morePages = false, - reloading, + reloading = false, expandable, orderAscMenuItemCaption, orderDescMenuItemCaption, @@ -531,7 +533,9 @@ const P8PTable = ({ const [expanded, setExpanded] = useState({}); //Собственное состояния - развёрнутые группы - const [expandedGroups, setExpandedGroups] = useState({}); + const [expandedGroups, setExpandedGroups] = useState( + Array.isArray(groups) && groups.length > 0 ? Object.assign({}, ...groups.map(g => ({ [g.name]: g.expanded }))) : {} + ); //Собственное состояние - колонка с отображаемой подсказкой const [displayHintColumn, setDisplayHintColumn] = useState(null); @@ -931,7 +935,7 @@ P8PTable.propTypes = { fixedHeader: PropTypes.bool, fixedColumns: PropTypes.number, morePages: PropTypes.bool, - reloading: PropTypes.bool.isRequired, + reloading: PropTypes.bool, expandable: PropTypes.bool, orderAscMenuItemCaption: PropTypes.string.isRequired, orderDescMenuItemCaption: PropTypes.string.isRequired,