From 193e8a0e7c8175f93f1fb4676a8aeb791f0ca8a0 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Thu, 26 Oct 2023 12:20:55 +0200 Subject: [PATCH 1/3] feat(warning): add warning when search is modified --- packages/demo/src/AppCCP.svelte | 1 + packages/demo/src/ccp.css | 1 + .../styles/default/search-modified-display.css | 8 ++++++++ packages/lib/index.ts | 3 ++- .../buttons/SearchButtonComponenet.wc.svelte | 4 +++- .../ModifiedSearchComponent.wc.svelte | 17 +++++++++++++++++ packages/lib/src/stores/query.ts | 8 ++++++++ 7 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 packages/demo/src/styles/default/search-modified-display.css create mode 100644 packages/lib/src/components/informational/ModifiedSearchComponent.wc.svelte diff --git a/packages/demo/src/AppCCP.svelte b/packages/demo/src/AppCCP.svelte index a2d59a0..cd90823 100644 --- a/packages/demo/src/AppCCP.svelte +++ b/packages/demo/src/AppCCP.svelte @@ -241,6 +241,7 @@ title="Ergebnisse" resultSummaryDataTypes={JSON.stringify(resultSummaryConfig)} /> + Diagramme repräsentieren nicht mehr die aktuelle Suche!
import { buildAstFromQuery } from "../../helpers/ast-transformer"; - import { queryStore } from "../../stores/query"; + import { queryModified, queryStore } from "../../stores/query"; import { measureStore } from "../../stores/measures"; import {translateAstToCql} from "../../cql-translator-service/ast-to-cql-translator"; import { buildLibrary, buildMeasure } from "../../helpers/cql-measure"; @@ -86,6 +86,8 @@ controller ) + queryModified.set(false); + }; diff --git a/packages/lib/src/components/informational/ModifiedSearchComponent.wc.svelte b/packages/lib/src/components/informational/ModifiedSearchComponent.wc.svelte new file mode 100644 index 0000000..0e9d826 --- /dev/null +++ b/packages/lib/src/components/informational/ModifiedSearchComponent.wc.svelte @@ -0,0 +1,17 @@ + + + + +{#if $queryModified} +
+ +
+{/if} diff --git a/packages/lib/src/stores/query.ts b/packages/lib/src/stores/query.ts index 2483fdf..df17249 100644 --- a/packages/lib/src/stores/query.ts +++ b/packages/lib/src/stores/query.ts @@ -6,10 +6,14 @@ import type { QueryItem, QueryValue } from "../types/queryData"; import { writable } from "svelte/store"; import { v4 as uuidv4 } from "uuid"; + + export const queryStore = writable([[]]); export const activeQueryGroupIndex = writable(0); +export const queryModified = writable(false); + /** * Adds an item to the query * If the item already exists in the query, the value will be added to the existing item @@ -20,6 +24,8 @@ export const activeQueryGroupIndex = writable(0); * @param queryGroupIndex */ export const addItemToQuery = (queryObject: QueryItem, queryGroupIndex: number) => { + queryModified.set(true); + /** * prevent mutation of the original object * otherwise the queryStore will not update properly with live changes inside the catalogue @@ -101,6 +107,7 @@ export const addItemToQuery = (queryObject: QueryItem, queryGroupIndex: number) * @param queryGroupIndex */ export const removeValueFromQuery = (queryObject: QueryItem, queryGroupIndex: number) => { + queryModified.set(true); /** * prevent mutation of the original object * otherwise the queryStore will not update properly with live changes inside the catalogue @@ -127,6 +134,7 @@ export const removeValueFromQuery = (queryObject: QueryItem, queryGroupIndex: nu export const removeItemFromQuery = (queryObject: QueryItem, queryGroupIndex: number) => { + queryModified.set(true); /** * prevent mutation of the original object * otherwise the queryStore will not update properly with live changes inside the catalogue From 0096f5c3a230d8329c325dd0923a1a1d099f78dc Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Thu, 26 Oct 2023 12:24:44 +0200 Subject: [PATCH 2/3] fix(chart): add x axis titles --- packages/demo/src/AppCCP.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/demo/src/AppCCP.svelte b/packages/demo/src/AppCCP.svelte index cd90823..237bee8 100644 --- a/packages/demo/src/AppCCP.svelte +++ b/packages/demo/src/AppCCP.svelte @@ -304,6 +304,7 @@ chartType="bar" headers={therapyHeaders} tooltips={therapyTooltips} + xAxisTitle="Art der Therapie" yAxisTitle="Anzahl der Therapien" />
@@ -313,6 +314,7 @@ catalogueGroupCode="medicationStatements" chartType="bar" tooltips={systemicTherapyTooltips} + xAxisTitle="Art der Therapie" yAxisTitle="Anzahl der Therapien" /> From b2e20e510d6ea95f21fb0fb0d1a801ec1816a874 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Thu, 26 Oct 2023 12:42:27 +0200 Subject: [PATCH 3/3] feat(human readable query): add spacing --- packages/lib/src/stores/negotiate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lib/src/stores/negotiate.ts b/packages/lib/src/stores/negotiate.ts index 1ead69e..d50ab37 100644 --- a/packages/lib/src/stores/negotiate.ts +++ b/packages/lib/src/stores/negotiate.ts @@ -75,7 +75,7 @@ const buildHumanReadableRecursively = (queryLayer: AstElement, humanReadableQuer if(index === queryLayer.children.length - 1){ } if(index < queryLayer.children.length - 1){ - humanReadableQuery += queryLayer.operand + humanReadableQuery += ` ${queryLayer.operand} ` } })