From 68349c88bb6e65ba639f9cb765b6612d5e27f996 Mon Sep 17 00:00:00 2001 From: Johan Bisse Mattsson <bisse.mattsson@kb.se> Date: Wed, 26 Jun 2024 14:00:35 +0200 Subject: [PATCH 1/3] Remove freetext label and add quotes instead --- lxl-web/src/lib/components/find/SearchMapping.svelte | 12 ++++++++++++ lxl-web/src/lib/types/search.ts | 5 ++++- lxl-web/src/lib/utils/search.ts | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lxl-web/src/lib/components/find/SearchMapping.svelte b/lxl-web/src/lib/components/find/SearchMapping.svelte index 73de9b103..601984bdb 100644 --- a/lxl-web/src/lib/components/find/SearchMapping.svelte +++ b/lxl-web/src/lib/components/find/SearchMapping.svelte @@ -54,6 +54,7 @@ class="mapping-item {m.children ? 'pill-group' : 'pill'} pill-{m.operator}" class:wildcard={m.operator === 'equals' && m.display === '*'} class:outer={depth === 0} + class:free-text={!m.children && m?.['@id'] === 'https://id.kb.se/vocab/textQuery'} > {#if 'children' in m} <svelte:self mapping={m.children} parentOperator={m.operator} depth={depth + 1} /> @@ -162,4 +163,15 @@ .pill-between:last-of-type { @apply hidden; } + + .free-text { + & > .pill-label { + display: none; + } + + & > .pill-value::before, + & > .pill-value::after { + content: '"'; + } + } </style> diff --git a/lxl-web/src/lib/types/search.ts b/lxl-web/src/lib/types/search.ts index 1aa2f86dc..fc8903da4 100644 --- a/lxl-web/src/lib/types/search.ts +++ b/lxl-web/src/lib/types/search.ts @@ -58,6 +58,7 @@ export interface MultiSelectFacet extends Facet { } export interface DisplayMapping { + '@id'?: string; display?: DisplayDecorated; up?: Link; children?: DisplayMapping[]; @@ -126,7 +127,9 @@ export interface SearchMapping extends MappingObj { up: { '@id': string }; } -interface ObjectProperty {} +interface ObjectProperty { + '@id'?: string; +} export interface DatatypeProperty { '@type': 'DataTypeProperty'; diff --git a/lxl-web/src/lib/utils/search.ts b/lxl-web/src/lib/utils/search.ts index d1e12225e..63cf1c111 100644 --- a/lxl-web/src/lib/utils/search.ts +++ b/lxl-web/src/lib/utils/search.ts @@ -78,6 +78,7 @@ function displayMappings( if ('property' in m && operator) { const property = m[operator] as FramedData; return { + ...(isObject(m.property) && { '@id': m.property['@id'] }), display: displayUtil.lensAndFormat(property, LensType.Chip, locale), label: m.alias ? translate(`facet.${m.alias}`) From 94ea75e62962499a759356acb09282ed5ebcc105 Mon Sep 17 00:00:00 2001 From: Johan Bisse Mattsson <bisse.mattsson@kb.se> Date: Wed, 26 Jun 2024 14:08:37 +0200 Subject: [PATCH 2/3] Skip redundant conditional check --- lxl-web/src/lib/components/find/SearchMapping.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxl-web/src/lib/components/find/SearchMapping.svelte b/lxl-web/src/lib/components/find/SearchMapping.svelte index 601984bdb..46ec4a16f 100644 --- a/lxl-web/src/lib/components/find/SearchMapping.svelte +++ b/lxl-web/src/lib/components/find/SearchMapping.svelte @@ -54,7 +54,7 @@ class="mapping-item {m.children ? 'pill-group' : 'pill'} pill-{m.operator}" class:wildcard={m.operator === 'equals' && m.display === '*'} class:outer={depth === 0} - class:free-text={!m.children && m?.['@id'] === 'https://id.kb.se/vocab/textQuery'} + class:free-text={m?.['@id'] === 'https://id.kb.se/vocab/textQuery'} > {#if 'children' in m} <svelte:self mapping={m.children} parentOperator={m.operator} depth={depth + 1} /> From f514588b9963bf6970448ff95161d8e6bcda544d Mon Sep 17 00:00:00 2001 From: Johan Bisse Mattsson <bisse.mattsson@kb.se> Date: Wed, 26 Jun 2024 15:10:50 +0200 Subject: [PATCH 3/3] Update changelog --- lxl-web/src/routes/(app)/[[lang=lang]]/help/en.md | 4 ++++ lxl-web/src/routes/(app)/[[lang=lang]]/help/sv.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lxl-web/src/routes/(app)/[[lang=lang]]/help/en.md b/lxl-web/src/routes/(app)/[[lang=lang]]/help/en.md index ac37e3ef4..f6804ef87 100644 --- a/lxl-web/src/routes/(app)/[[lang=lang]]/help/en.md +++ b/lxl-web/src/routes/(app)/[[lang=lang]]/help/en.md @@ -8,6 +8,10 @@ title: 'Hjälp' Here we will continuously provide information about newly added features and planned developments: +### 2024-06-26 + +- Hide labels for free text queries and add quotes instead + ### 2024-06-12 - Improved help text diff --git a/lxl-web/src/routes/(app)/[[lang=lang]]/help/sv.md b/lxl-web/src/routes/(app)/[[lang=lang]]/help/sv.md index c36d189eb..df68fd400 100644 --- a/lxl-web/src/routes/(app)/[[lang=lang]]/help/sv.md +++ b/lxl-web/src/routes/(app)/[[lang=lang]]/help/sv.md @@ -8,6 +8,10 @@ title: 'Hjälp' Här kommer vi kontinuerligt berätta om nytillkomna funktioner och planerad utveckling: +### 2024-06-26 + +- Dölj etikett för fritext-sökningar och lägg till citattecken istället + ### 2024-06-12 - Förbättrad hjälptext