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 c321aeb..2055f60 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 newQuery the new query store + */ + export const setQueryStoreAPI = (newQuery: QueryItem[][]): void => { + queryStore.set(newQuery); + }; + /** * lets the library user add a single stratifier to the query store * @param params the parameters for the function 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; }