From 4b2d96f5089f2ee03694cfc0502cb32f23718899 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 1 Dec 2022 10:29:06 +0000 Subject: [PATCH 1/3] Remove helpers and convert to JS query bindings --- .../components/common/bindings/BindingPanel.svelte | 14 ++++++++++++-- .../common/bindings/ClientBindingPanel.svelte | 2 ++ .../common/bindings/DrawerBindableInput.svelte | 2 ++ .../components/integration/KeyValueBuilder.svelte | 2 ++ .../integration/QueryViewerBindingBuilder.svelte | 1 + 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index d105253e14..7ba1c44853 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -39,6 +39,7 @@ export let value = "" export let valid export let allowJS = false + export let allowHelpers = true let helpers = handlebarsCompletions() let getCaretPosition @@ -54,6 +55,7 @@ let popoverAnchor let hoverTarget + $: console.log("HELPERS ", allowHelpers) $: usingJS = mode === "JavaScript" $: searchRgx = new RegExp(search, "ig") $: categories = Object.entries(groupBy("category", bindings)) @@ -85,7 +87,7 @@ return helper.label.match(searchRgx) || helper.description.match(searchRgx) }) - $: categoryNames = [...categories.map(cat => cat[0]), "Helpers"] + $: categoryNames = getCategoryNames(categories) $: codeMirrorHints = bindings?.map(x => `$("${x.readableBinding}")`) @@ -96,6 +98,14 @@ } } + const getCategoryNames = categories => { + let names = [...categories.map(cat => cat[0])] + if (allowHelpers) { + names.push("Helpers") + } + return names + } + // Adds a JS/HBS helper to the expression const addHelper = (helper, js) => { let tempVal @@ -343,7 +353,7 @@ for more details.

{/if} - {#if $admin.isDev} + {#if $admin.isDev && allowJS}
diff --git a/packages/builder/src/components/common/bindings/ClientBindingPanel.svelte b/packages/builder/src/components/common/bindings/ClientBindingPanel.svelte index b220a15fc8..74e14574ab 100644 --- a/packages/builder/src/components/common/bindings/ClientBindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/ClientBindingPanel.svelte @@ -5,6 +5,7 @@ export let valid export let value = "" export let allowJS = false + export let allowHelpers = true $: enrichedBindings = enrichBindings(bindings) @@ -25,5 +26,6 @@ bindings={enrichedBindings} {value} {allowJS} + {allowHelpers} on:change /> diff --git a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte index 22d322985d..cc64e28835 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte @@ -17,6 +17,7 @@ export let disabled = false export let fillWidth export let allowJS = true + export let allowHelpers = true export let updateOnChange = true export let drawerLeft @@ -77,6 +78,7 @@ on:change={event => (tempValue = event.detail)} {bindings} {allowJS} + {allowHelpers} /> diff --git a/packages/builder/src/components/integration/KeyValueBuilder.svelte b/packages/builder/src/components/integration/KeyValueBuilder.svelte index 28db6b61c6..5d35498cfe 100644 --- a/packages/builder/src/components/integration/KeyValueBuilder.svelte +++ b/packages/builder/src/components/integration/KeyValueBuilder.svelte @@ -33,6 +33,7 @@ export let showMenu = false export let bindings = [] export let bindingDrawerLeft + export let allowHelpers = true let fields = Object.entries(object || {}).map(([name, value]) => ({ name, @@ -122,6 +123,7 @@ disabled={readOnly} value={field.value} allowJS={false} + {allowHelpers} fillWidth={true} drawerLeft={bindingDrawerLeft} /> diff --git a/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte b/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte index 8372e2af7e..049eecafcc 100644 --- a/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte +++ b/packages/builder/src/components/integration/QueryViewerBindingBuilder.svelte @@ -37,6 +37,7 @@ valuePlaceholder="Default" bindings={[...userBindings]} bindingDrawerLeft="260px" + allowHelpers={false} on:change /> From 216539a454477b7b88564e8338243e166f25228e Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 1 Dec 2022 10:34:03 +0000 Subject: [PATCH 2/3] Adjust z index --- packages/builder/src/components/integration/QueryViewer.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/components/integration/QueryViewer.svelte b/packages/builder/src/components/integration/QueryViewer.svelte index e70cf8330e..6a49ffa634 100644 --- a/packages/builder/src/components/integration/QueryViewer.svelte +++ b/packages/builder/src/components/integration/QueryViewer.svelte @@ -223,6 +223,7 @@ .config { display: grid; grid-gap: var(--spacing-s); + z-index: 1; } .config-field { From 54f0112d683f919d388f34156886a1548c1a50c1 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 1 Dec 2022 10:37:58 +0000 Subject: [PATCH 3/3] Remove console log --- .../builder/src/components/common/bindings/BindingPanel.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 7ba1c44853..83fc19f388 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -55,7 +55,6 @@ let popoverAnchor let hoverTarget - $: console.log("HELPERS ", allowHelpers) $: usingJS = mode === "JavaScript" $: searchRgx = new RegExp(search, "ig") $: categories = Object.entries(groupBy("category", bindings))