From c4cccc3b487da5757528363b703ed46ebcea31c0 Mon Sep 17 00:00:00 2001 From: operramon <52449656+operramon@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:44:30 +0100 Subject: [PATCH] [sc-7705] Disable label filters when a labelset is selected (#1096) * [sc-7705] Disable label filters when a labelset is selected * Avoid id collision --- .../src/common/checkbox/Checkbox.scss | 7 +++++++ .../src/common/checkbox/Checkbox.svelte | 15 ++++++++++----- .../labels-expander/LabelsExpander.svelte | 11 +++++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/libs/search-widget/src/common/checkbox/Checkbox.scss b/libs/search-widget/src/common/checkbox/Checkbox.scss index 838f6a1f6..494f9523e 100644 --- a/libs/search-widget/src/common/checkbox/Checkbox.scss +++ b/libs/search-widget/src/common/checkbox/Checkbox.scss @@ -22,6 +22,13 @@ background-image: url('data:image/svg+xml; utf8, '); background-size: var(--size-checkbox) var(--size-checkbox); } + + &:disabled { + border-color: var(--color-neutral-light); + & ~ label { + color: var(--color-neutral-light); + } + } } label { diff --git a/libs/search-widget/src/common/checkbox/Checkbox.svelte b/libs/search-widget/src/common/checkbox/Checkbox.svelte index fc1249cbb..23ef6e03c 100644 --- a/libs/search-widget/src/common/checkbox/Checkbox.svelte +++ b/libs/search-widget/src/common/checkbox/Checkbox.svelte @@ -1,27 +1,32 @@ + -
+
diff --git a/libs/search-widget/src/components/labels-expander/LabelsExpander.svelte b/libs/search-widget/src/components/labels-expander/LabelsExpander.svelte index 6319163af..bea359a80 100644 --- a/libs/search-widget/src/components/labels-expander/LabelsExpander.svelte +++ b/libs/search-widget/src/components/labels-expander/LabelsExpander.svelte @@ -2,7 +2,7 @@ import { createEventDispatcher, onMount } from 'svelte'; import { map, Observable, take } from 'rxjs'; import type { LabelSetWithId } from '../../core'; - import { addLabelSetFilter, labelFilters, labelSetFilters, removeLabelSetFilter } from '../../core'; + import { addLabelSetFilter, labelFilters, labelSetFilters, removeLabelFilter, removeLabelSetFilter } from '../../core'; import IconButton from '../../common/button/IconButton.svelte'; import Checkbox from '../../common/checkbox/Checkbox.svelte'; @@ -16,7 +16,13 @@ ); function selectLabelSet(labelSet, selected) { - selected ? addLabelSetFilter(labelSet.id, labelSet.kind) : removeLabelSetFilter(labelSet.id); + if (selected) { + labelSet.labels.forEach((label) => removeLabelFilter({ labelset: labelSet.id, label: label.title})); + addLabelSetFilter(labelSet.id, labelSet.kind) + } + else { + removeLabelSetFilter(labelSet.id); + } } function toggleLabelSet(labelSetId) { @@ -60,6 +66,7 @@
dispatch('labelSelect', { labelSet, label, selected: event.detail })}> {label.title}