Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/query and ast overwrite api #132

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading