From 16cce9c10c643ca81381442938a6140132c95fdd Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 1 Feb 2021 11:51:53 +0000 Subject: [PATCH] binding panel options from helpers --- .../builder/src/builderStore/dataBinding.js | 1 - .../SetupPanel/GenericBindingPopover.svelte | 12 + .../PropertiesPanel/BindingPanel.svelte | 44 +- .../components/integration/QueryEditor.svelte | 22 + .../src/components/integration/codemirror.js | 2 + .../src/components/integration/index.svelte | 6 +- packages/builder/src/constants/completions.js | 14 + packages/client/yarn.lock | 1644 +---------------- 8 files changed, 102 insertions(+), 1643 deletions(-) create mode 100644 packages/builder/src/constants/completions.js diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index ed17f4bdab..299f11f0a7 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -6,7 +6,6 @@ import { makePropSafe } from "@budibase/string-templates" // Regex to match all instances of template strings const CAPTURE_VAR_INSIDE_TEMPLATE = /{{([^}]+)}}/g -const INVALID_BINDING = "{{ invalid binding }}" /** * Gets all bindable data context fields and instance fields. diff --git a/packages/builder/src/components/automation/SetupPanel/GenericBindingPopover.svelte b/packages/builder/src/components/automation/SetupPanel/GenericBindingPopover.svelte index 0609f3a4d5..08ad64e74f 100644 --- a/packages/builder/src/components/automation/SetupPanel/GenericBindingPopover.svelte +++ b/packages/builder/src/components/automation/SetupPanel/GenericBindingPopover.svelte @@ -11,6 +11,8 @@ } from "@budibase/bbui" import { createEventDispatcher } from "svelte" import { isValid } from "@budibase/string-templates" + import { handlebarsCompletions } from "constants/completions" + const dispatch = createEventDispatcher() export let value = "" @@ -19,6 +21,7 @@ export let align export let popover = null + let helpers = handlebarsCompletions() let getCaretPosition let validity = true @@ -63,6 +66,15 @@ {/each} {/each} + Helpers + + {#each helpers as helper} +
onClickBinding(helper)}> + {helper.displayText} +
+
{helper.description || ''}
+
+ {/each} diff --git a/packages/builder/src/components/design/PropertiesPanel/BindingPanel.svelte b/packages/builder/src/components/design/PropertiesPanel/BindingPanel.svelte index c33d61ee04..ef74dee8c0 100644 --- a/packages/builder/src/components/design/PropertiesPanel/BindingPanel.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/BindingPanel.svelte @@ -1,6 +1,6 @@
@@ -56,8 +72,10 @@ {/each} {/if} + {#if instance} Components +
    {#each instance as { readableBinding }}
  • addToText(readableBinding)}> @@ -66,9 +84,23 @@ {/each}
{/if} + + Helpers + +
    + {#each helpers as helper} +
  • addToText(helper.text)}> +
    + + {helper.description} +
    +
  • + {/each} +