From f82e0a70c3b1271ce1e587986053502b5743feb3 Mon Sep 17 00:00:00 2001 From: Slava Olishevko Date: Wed, 18 Dec 2024 08:47:05 +0300 Subject: [PATCH] fix: fix diagnosis tree check handler; style: improve style --- sources/services/gallery/gallery.js | 3 ++- sources/styles/pages.less | 6 ++++-- .../views/subviews/gallery/parts/filters.js | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/sources/services/gallery/gallery.js b/sources/services/gallery/gallery.js index ded298a..bb2df5c 100644 --- a/sources/services/gallery/gallery.js +++ b/sources/services/gallery/gallery.js @@ -1254,7 +1254,8 @@ class GalleryService { // update form controls values(true/false for checkboxes, etc) _updateFiltersFormControls(data) { if (Array.isArray(data)) { - data.forEach((item) => { + // For treetable elements sorting from highest level to lowest + [...data].sort((a, b) => a.diagnosisLevel > b.diagnosisLevel).forEach((item) => { filterService.updateFiltersFormControl(item); }); } diff --git a/sources/styles/pages.less b/sources/styles/pages.less index 17c2ed5..0b52930 100644 --- a/sources/styles/pages.less +++ b/sources/styles/pages.less @@ -1049,6 +1049,7 @@ overflow: hidden; white-space: nowrap; padding-left: 5px; + padding-right: 5px; text-overflow: ellipsis; border-right: 1px solid #E8EBF0;; box-sizing: border-box; @@ -1056,10 +1057,11 @@ } .applied-filters-item-hierarchy-item:not(:last-child) { flex: 1; + min-width: 51px; padding-right: 5px; } .applied-filters-item-hierarchy-item:last-child { - flex: 3; + flex: 10; } .applied-filters-item-hierarchy-item:first-child { text-transform: uppercase; @@ -1070,7 +1072,7 @@ background-color: transparent; } .applied-filters-item-hierarchy-item:hover { - flex: 3; + flex: 10; } } .applied-filters-item-hierarchy_container:hover .applied-filters-item-hierarchy-item:not(:hover) { diff --git a/sources/views/subviews/gallery/parts/filters.js b/sources/views/subviews/gallery/parts/filters.js index 016e91a..5ca94b4 100644 --- a/sources/views/subviews/gallery/parts/filters.js +++ b/sources/views/subviews/gallery/parts/filters.js @@ -474,6 +474,26 @@ function getTreeCheckboxUI(data, collapsed, expandedFilters) { nextSiblingId = this.getNextSiblingId(currentId); } } + const allCheckedItems = this.getChecked(); + allCheckedItems.forEach((checkedItemId) => { + const checkedItem = this.getItem(checkedItemId); + const parentForCheckedItem = this.getItem(this.getParentId(checkedItemId)); + if (!parentForCheckedItem.checked) { + filtersChangedData.push({ + view: data.type, + datatype: checkedItem.datatype, + key: labelId, + filterName: data.name, + value: getTreeOptionValueById(checkedItem.id), + status: "equals", + treeCheckboxFlag: true, + diagnosisLevel: checkedItem.level, + optionId: checkedItem.id, + viewId: `treeTable-${data.id}`, + remove: false, + }); + } + }); } this.getTopParentView().$scope.app.callEvent("filtersChanged", [filtersChangedData]); }