From 3ab2ebb94d8c0debb86b1916b2e70060f4ec088f Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 2 Oct 2024 09:36:49 +0200 Subject: [PATCH 1/3] feat(api): add api to set query the whole store --- packages/lib/src/components/DataPasser.wc.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/lib/src/components/DataPasser.wc.svelte b/packages/lib/src/components/DataPasser.wc.svelte index c321aeb..ee7d781 100644 --- a/packages/lib/src/components/DataPasser.wc.svelte +++ b/packages/lib/src/components/DataPasser.wc.svelte @@ -73,6 +73,14 @@ * Setters */ + /** + * sets the query store + * @param queryStore the new query store + */ + export const setQueryStoreAPI = (queryStore: QueryItem[][]): void => { + queryStore.set(queryStore); + }; + /** * lets the library user add a single stratifier to the query store * @param params the parameters for the function From 59de8e726c4739dcf98e36edddf42cb9086673d1 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 2 Oct 2024 09:57:08 +0200 Subject: [PATCH 2/3] feat(demo): add demo function to fragment development, fix naming in api function --- .../demo/src/AppFragmentDevelopment.svelte | 22 +++++++++++++++++++ .../lib/src/components/DataPasser.wc.svelte | 6 ++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/demo/src/AppFragmentDevelopment.svelte b/packages/demo/src/AppFragmentDevelopment.svelte index f14019a..2319747 100644 --- a/packages/demo/src/AppFragmentDevelopment.svelte +++ b/packages/demo/src/AppFragmentDevelopment.svelte @@ -95,6 +95,27 @@ getQuery(); }; + const setQueryStore = (): void => { + const store: QueryItem[][] = [ + [ + { + id: "0cf3a74c-77f8-49a0-bef5-16e20d6b361e", + key: "gender", + name: "Geschlecht", + type: "EQUALS", + values: [ + { + name: "Männlich", + value: "male", + queryBindId: "1f69dd2d-3c29-40a6-ba83-a966def1cd12", + }, + ], + }, + ], + ]; + dataPasser.setQueryStoreAPI(store); + }; + window.addEventListener("emit-lens-query", (e) => { const event = e as QueryEvent; const { ast, updateResponse, abortController } = event.detail; @@ -158,6 +179,7 @@ + {#each queryStore as queryStoreGroup}
{#each queryStoreGroup as queryStoreItem} diff --git a/packages/lib/src/components/DataPasser.wc.svelte b/packages/lib/src/components/DataPasser.wc.svelte index ee7d781..2055f60 100644 --- a/packages/lib/src/components/DataPasser.wc.svelte +++ b/packages/lib/src/components/DataPasser.wc.svelte @@ -75,10 +75,10 @@ /** * sets the query store - * @param queryStore the new query store + * @param newQuery the new query store */ - export const setQueryStoreAPI = (queryStore: QueryItem[][]): void => { - queryStore.set(queryStore); + export const setQueryStoreAPI = (newQuery: QueryItem[][]): void => { + queryStore.set(newQuery); }; /** From c0aad2d7d93015be5123306208ce97ac71d895ea Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Wed, 2 Oct 2024 10:07:10 +0200 Subject: [PATCH 3/3] fix(types): add function definition to datapasser interface --- packages/lib/src/types/dataPasser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/lib/src/types/dataPasser.ts b/packages/lib/src/types/dataPasser.ts index 72c25ca..5c2d419 100644 --- a/packages/lib/src/types/dataPasser.ts +++ b/packages/lib/src/types/dataPasser.ts @@ -29,4 +29,5 @@ export interface LensDataPasser extends HTMLElement { removeItemFromQuyeryAPI(params: RemoveItemFromQuyeryAPIParams): void; removeValueFromQueryAPI(params: RemoveValueFromQueryAPIParams): void; updateResponseAPI(params: ResponseStore): void; + setQueryStoreAPI(params: QueryItem[][]): void; }