Skip to content

Commit

Permalink
Merge pull request #132 from samply/feat/query-and-ast-overwrite-api
Browse files Browse the repository at this point in the history
Feat/query and ast overwrite api
  • Loading branch information
MatsJohansen87 authored Oct 2, 2024
2 parents e4667c0 + c0aad2d commit 019a725
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/demo/src/AppFragmentDevelopment.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -158,6 +179,7 @@
<button on:click={() => getQuery()}>Get Query Store</button>
<button on:click={() => getResponse()}>Get Response Store</button>
<button on:click={() => getAST()}>Get AST</button>
<button on:click={() => setQueryStore()}>Set Query Store</button>
{#each queryStore as queryStoreGroup}
<div>
{#each queryStoreGroup as queryStoreItem}
Expand Down
8 changes: 8 additions & 0 deletions packages/lib/src/components/DataPasser.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/lib/src/types/dataPasser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 019a725

Please sign in to comment.