diff --git a/packages/bbui/src/Modal/Modal.svelte b/packages/bbui/src/Modal/Modal.svelte index 3ed9b93fa5..c93467bc75 100644 --- a/packages/bbui/src/Modal/Modal.svelte +++ b/packages/bbui/src/Modal/Modal.svelte @@ -115,7 +115,6 @@ } .spectrum-Modal { - background: var(--background); overflow: visible; max-height: none; margin: 40px 0; diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index dae9b9e8af..e6d4ab5f0f 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -88,7 +88,6 @@ display: grid; position: relative; gap: var(--spacing-xl); - color: var(--ink); } .spectrum-Dialog-content { @@ -106,13 +105,8 @@ position: absolute; top: 15px; right: 15px; - color: var(--ink); font-size: var(--font-size-m); } - .close-icon:hover { - color: var(--grey-6); - cursor: pointer; - } .close-icon :global(svg) { margin-right: 0; } diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index b9cd134067..f84e1c8735 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -530,6 +530,11 @@ export const getFrontendStore = () => { selected._styles = { normal: {}, hover: {}, active: {} } await store.actions.preview.saveSelected() }, + updateConditions: async conditions => { + const selected = get(selectedComponent) + selected._conditions = conditions + await store.actions.preview.saveSelected() + }, updateProp: async (name, value) => { let component = get(selectedComponent) if (!name || !component) { diff --git a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte index 9139e4f6a2..0900bae1a7 100644 --- a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte @@ -1,32 +1,12 @@ + + +
+ Configure conditions +
+
+ + + Show, hide and update components in response to conditions being met. + + + + diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte index c1e26e68cd..e85c30a171 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( @@ -15,10 +16,13 @@
- - - - + {#key componentInstance?._id} + + + + + + {/key}
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..ebe60c7110 --- /dev/null +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte @@ -0,0 +1,290 @@ + + + +
+ + {#if conditions?.length} +
+ {#each conditions as condition (condition.id)} +
+
(dragDisabled = false)} + > + +
+ +
TO
+ {#if getSettingDefinition(condition.setting)} + (condition.settingValue = val)} + props={{ + options: getSettingDefinition(condition.setting).options, + placeholder: getSettingDefinition(condition.setting) + .placeholder, + }} + /> + {:else} + onOperatorChange(condition, e.detail)} + /> + + {/if} + removeCondition(condition.id)} + /> +
+ {/each} +
+ {:else} + Add your first condition to get started. + {/if} +
+ +
+
+
+
+ + diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/LuceneFilterBuilder.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/LuceneFilterBuilder.svelte index 539d53636c..e30c7dd63d 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/LuceneFilterBuilder.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/LuceneFilterBuilder.svelte @@ -11,44 +11,11 @@ import { getBindableProperties } from "builderStore/dataBinding" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import { generate } from "shortid" + import { OperatorOptions, getValidOperatorsForType } from "helpers/lucene" export let schemaFields export let value - const OperatorOptions = { - Equals: { - value: "equal", - label: "Equals", - }, - NotEquals: { - value: "notEqual", - label: "Not equals", - }, - Empty: { - value: "empty", - label: "Is empty", - }, - NotEmpty: { - value: "notEmpty", - label: "Is not empty", - }, - StartsWith: { - value: "string", - label: "Starts with", - }, - Like: { - value: "fuzzy", - label: "Like", - }, - MoreThan: { - value: "rangeLow", - label: "More than", - }, - LessThan: { - value: "rangeHigh", - label: "Less than", - }, - } const BannedTypes = ["link", "attachment"] $: bindableProperties = getBindableProperties( $currentAsset, @@ -75,61 +42,16 @@ value = value.filter(field => field.id !== id) } - const getValidOperatorsForType = type => { - const Op = OperatorOptions - if (type === "string") { - return [ - Op.Equals, - Op.NotEquals, - Op.StartsWith, - Op.Like, - Op.Empty, - Op.NotEmpty, - ] - } else if (type === "number") { - return [ - Op.Equals, - Op.NotEquals, - Op.MoreThan, - Op.LessThan, - Op.Empty, - Op.NotEmpty, - ] - } else if (type === "options") { - return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty] - } else if (type === "boolean") { - return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty] - } else if (type === "longform") { - return [ - Op.Equals, - Op.NotEquals, - Op.StartsWith, - Op.Like, - Op.Empty, - Op.NotEmpty, - ] - } else if (type === "datetime") { - return [ - Op.Equals, - Op.NotEquals, - Op.MoreThan, - Op.LessThan, - Op.Empty, - Op.NotEmpty, - ] - } - return [] - } - const onFieldChange = (expression, field) => { // Update the field type expression.type = schemaFields.find(x => x.name === field)?.type // Ensure a valid operator is set - const validOperators = getValidOperatorsForType(expression.type) + const validOperators = getValidOperatorsForType(expression.type).map( + x => x.value + ) if (!validOperators.includes(expression.operator)) { - expression.operator = - validOperators[0]?.value ?? OperatorOptions.Equals.value + expression.operator = validOperators[0] ?? OperatorOptions.Equals.value onOperatorChange(expression, expression.operator) } } diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte index 1cf6240572..4d1823108c 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte @@ -15,13 +15,13 @@ export let links = [] const flipDurationMs = 150 + let dragDisabled = true $: links.forEach(link => { if (!link.id) { link.id = generate() } }) - $: urlOptions = $store.screens .map(screen => screen.routing?.route) .filter(x => x != null) @@ -37,6 +37,11 @@ const updateLinks = e => { links = e.detail.items } + + const handleFinalize = e => { + updateLinks(e) + dragDisabled = true + } @@ -49,13 +54,21 @@ items: links, flipDurationMs, dropTargetStyle: { outline: "none" }, + dragDisabled, }} - on:finalize={updateLinks} + on:finalize={handleFinalize} on:consider={updateLinks} > {#each links as link (link.id)}