From b77fed6766b649241e14db874da600c2d67a6c45 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Aug 2021 09:50:09 +0100 Subject: [PATCH 1/6] Add duplicate action to filter drawer --- .../FilterEditor/FilterDrawer.svelte | 182 ++++++++++++++++++ .../FilterEditor/FilterEditor.svelte | 34 +--- .../FilterEditor/LuceneFilterBuilder.svelte | 151 --------------- 3 files changed, 190 insertions(+), 177 deletions(-) create mode 100644 packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte delete mode 100644 packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/LuceneFilterBuilder.svelte diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte new file mode 100644 index 0000000000..c206492595 --- /dev/null +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte @@ -0,0 +1,182 @@ + + + +
+ + + {#if !filters?.length} + Add your first filter column. + {:else} + Results are filtered to only those which match all of the following + constraints. + {/if} + + {#if filters?.length} +
+ {#each filters as filter, idx} + onOperatorChange(filter, e.detail)} + placeholder={null} + /> + + {:else if filter.type === "options"} + + {:else if filter.type === "boolean"} + + {:else if filter.type === "datetime"} + + {:else} + + {/if} + duplicateFilter(filter.id)} + /> + removeFilter(filter.id)} + /> + {/each} +
+ {/if} +
+ +
+
+
+
+ + diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterEditor.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterEditor.svelte index adcf7ec29b..58b767353b 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterEditor.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterEditor.svelte @@ -1,19 +1,11 @@ - -{#if value?.length} -
- {#each value as expression, idx} - onOperatorChange(expression, e.detail)} - placeholder={null} - /> - - {:else if expression.type === "options"} - - {:else if expression.type === "boolean"} - - {:else if expression.type === "datetime"} - - {:else} - - {/if} - - removeField(expression.id)} - /> - {/each} -
-{/if} -
- -
- - From 72ab0c4158bc86b62799ebab11170185abf059ea Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Aug 2021 09:55:41 +0100 Subject: [PATCH 2/6] Fix issue with duplicate icon in condtitional UI not being accounted for when using an update action --- .../PropertyControls/ConditionalUIDrawer.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte index 006039edda..638fd44de6 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte @@ -282,12 +282,12 @@ gap: var(--spacing-l); display: grid; align-items: center; - grid-template-columns: auto 1fr auto 1fr 1fr 1fr 1fr auto auto; + grid-template-columns: auto 160px auto 1fr 130px 130px 1fr auto auto; border-radius: var(--border-radius-s); transition: background-color ease-in-out 130ms; } .condition.update { - grid-template-columns: auto 1fr 1fr auto 1fr auto 1fr 1fr 1fr 1fr auto; + grid-template-columns: auto 160px 1fr auto 1fr auto 1fr 130px 130px 1fr auto auto; } .condition:hover { background-color: var(--spectrum-global-color-gray-100); From f6cd99166a4b9fe97be60596fca493596a1b4bdb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Aug 2021 10:03:56 +0100 Subject: [PATCH 3/6] Hide formula fields from filter expressions until they can be searched --- .../PropertyControls/FilterEditor/FilterDrawer.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte index c206492595..d41d28e4e3 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte @@ -18,7 +18,7 @@ export let filters = [] export let bindings = [] - const BannedTypes = ["link", "attachment"] + const BannedTypes = ["link", "attachment", "formula"] $: fieldOptions = (schemaFields ?? []) .filter(field => !BannedTypes.includes(field.type)) From cb55139cea83ddf8f1f52f39c5beb43743d2c272 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Aug 2021 10:09:38 +0100 Subject: [PATCH 4/6] Sort picker options alphabetically --- packages/bbui/src/Form/Core/Picker.svelte | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index e2456271c7..3de454668c 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -23,7 +23,11 @@ export let readonly = false export let quiet = false export let autoWidth = false + const dispatch = createEventDispatcher() + + $: sortedOptions = getSortedOptions(options, getOptionLabel) + const onClick = () => { dispatch("click") if (readonly) { @@ -31,6 +35,17 @@ } open = true } + + const getSortedOptions = (options, getLabel) => { + if (!options?.length || !Array.isArray(options)) { + return [] + } + return options.sort((a, b) => { + const labelA = getLabel(a) + const labelB = getLabel(b) + return labelA > labelB ? 1 : -1 + }) + }