From 63bbc22251fa6d5e150730af66ba34c1767931d2 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 21 Jul 2021 08:46:02 +0100 Subject: [PATCH] Move lucene options into common file and add initial work on conditional UI components --- .../ConditionalUISection.svelte | 38 +++++ .../PropertiesPanel/PropertiesPanel.svelte | 2 + .../ConditionalUIDrawer.svelte | 156 ++++++++++++++++++ .../FilterEditor/LuceneFilterBuilder.svelte | 81 +-------- packages/builder/src/helpers/lucene.js | 80 +++++++++ 5 files changed, 277 insertions(+), 80 deletions(-) create mode 100644 packages/builder/src/components/design/PropertiesPanel/ConditionalUISection.svelte create mode 100644 packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte create mode 100644 packages/builder/src/helpers/lucene.js diff --git a/packages/builder/src/components/design/PropertiesPanel/ConditionalUISection.svelte b/packages/builder/src/components/design/PropertiesPanel/ConditionalUISection.svelte new file mode 100644 index 0000000000..5071354813 --- /dev/null +++ b/packages/builder/src/components/design/PropertiesPanel/ConditionalUISection.svelte @@ -0,0 +1,38 @@ + + + +
+ Configure conditions +
+
+{#key componentInstance?._id} + + + Show, hide and update components in response to conditions being met. + + + + +{/key} diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte index c1e26e68cd..a1b05ed19c 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte @@ -5,6 +5,7 @@ import ComponentSettingsSection from "./ComponentSettingsSection.svelte" import DesignSection from "./DesignSection.svelte" import CustomStylesSection from "./CustomStylesSection.svelte" + import ConditionalUISection from "./ConditionalUISection.svelte" $: componentInstance = $selectedComponent $: componentDefinition = store.actions.components.getDefinition( @@ -19,6 +20,7 @@ + diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte new file mode 100644 index 0000000000..8bd7341d7c --- /dev/null +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte @@ -0,0 +1,156 @@ + + + +
+ + {#if conditions?.length} +
+ {#each conditions as condition (condition.id)} +
+ +
TO
+ (condition.settingValue = e.detail)} + value={condition.settingValue} + /> + {/if} +
IF
+ (condition.newValue = e.detail)} + /> +