From a94953289eeb6d168b45d4e7d41443b1d44cf170 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Mon, 22 Apr 2024 08:23:38 +0100 Subject: [PATCH] Remove old stuff i aded to selects and picker --- .../bbui/src/Form/Core/Multiselect.svelte | 10 - packages/bbui/src/Form/Core/Picker.svelte | 198 ++++++++---------- packages/bbui/src/Form/Multiselect.svelte | 10 - 3 files changed, 92 insertions(+), 126 deletions(-) diff --git a/packages/bbui/src/Form/Core/Multiselect.svelte b/packages/bbui/src/Form/Core/Multiselect.svelte index a9e0efb57b..4873430fa0 100644 --- a/packages/bbui/src/Form/Core/Multiselect.svelte +++ b/packages/bbui/src/Form/Core/Multiselect.svelte @@ -9,10 +9,6 @@ export let options = [] export let getOptionLabel = option => option export let getOptionValue = option => option - export let getOptionIcon = () => null - export let getOptionIconTooltip = () => null - export let getOptionTooltip = () => null - export let isOptionEnabled = () => true export let readonly = false export let autocomplete = false export let sort = false @@ -21,7 +17,6 @@ export let customPopoverHeight export let open = false export let loading - export let align export let onOptionMouseenter = () => {} export let onOptionMouseleave = () => {} @@ -87,10 +82,6 @@ diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index a9a9c01ce0..55bd95b5e2 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -11,13 +11,6 @@ import Tags from "../../Tags/Tags.svelte" import Tag from "../../Tags/Tag.svelte" import ProgressCircle from "../../ProgressCircle/ProgressCircle.svelte" - import { - default as AbsTooltip, - TooltipPosition, - TooltipType, - } from "../../Tooltip/AbsTooltip.svelte" - import ContextTooltip from "../../Tooltip/Context.svelte" - import { Heading } from "@budibase/bbui" export let id = null export let disabled = false @@ -33,8 +26,6 @@ export let getOptionLabel = option => option export let getOptionValue = option => option export let getOptionIcon = () => null - export let getOptionIconTooltip = () => null - export let getOptionTooltip = () => null export let useOptionIconImage = false export let getOptionColour = () => null export let getOptionSubtitle = () => null @@ -56,6 +47,7 @@ const dispatch = createEventDispatcher() let button + let popover let component $: sortedOptions = getSortedOptions(options, getOptionLabel, sort) @@ -161,6 +153,7 @@ (open = false)} useAnchorWidth={!autoWidth} @@ -168,29 +161,85 @@ customHeight={customPopoverHeight} >
(open = false)} - > - {#if autocomplete} - (searchTerm = event.detail)} - {disabled} - placeholder="Search" - /> + class="popover-content" + class:auto-width={autoWidth} + use:clickOutside={() => (open = false)} + > + {#if autocomplete} + (searchTerm = event.detail)} + {disabled} + placeholder="Search" + /> + {/if} +
    + {#if placeholderOption} +
  • onSelectOption(null)} + > + {placeholderOption} + +
  • {/if} -
      - {#if placeholderOption} + {#if filteredOptions.length} + {#each filteredOptions as option, idx}
    • onSelectOption(null)} + on:click={() => onSelectOption(getOptionValue(option, idx))} + on:mouseenter={(e) => onOptionMouseenter(e, option)} + on:mouseleave={(e) => onOptionMouseleave(e, option)} + class:is-disabled={!isOptionEnabled(option)} > - {placeholderOption} + {#if getOptionIcon(option, idx)} + + {#if useOptionIconImage} + icon + {:else} + + {/if} + + {/if} + {#if getOptionColour(option, idx)} + + + + {/if} + + {getOptionLabel(option, idx)} + {#if getOptionSubtitle(option, idx)} + + {getOptionSubtitle(option, idx)} + + {/if} + + {#if option.tag} + + + {option.tag} + + + {/if}
    • - {/if} - {#if filteredOptions.length} - {#each filteredOptions as option, idx} -
    • onOptionMouseenter(e, option)} - on:mouseleave={(e) => onOptionMouseleave(e, option)} - class="spectrum-Menu-item" - class:is-selected={isOptionSelected(getOptionValue(option, idx))} - role="option" - aria-selected="true" - tabindex="0" - on:click={() => onSelectOption(getOptionValue(option, idx))} - class:is-disabled={!isOptionEnabled(option)} - > - {#if getOptionIcon(option, idx)} - - {#if useOptionIconImage} - icon - {:else} - - {/if} - - {/if} - {#if getOptionColour(option, idx)} - - - - {/if} - - {getOptionLabel(option, idx)} - {#if getOptionSubtitle(option, idx)} - - {getOptionSubtitle(option, idx)} - - {/if} - - {#if option.tag} - - - {option.tag} - - - {/if} - -
    • - {/each} - {/if} -
    - - {#if loading} -
    - -
    + {/each} {/if} +
+ + {#if loading} +
+ +
+ {/if} + + {#if footer} + + {/if} +
+
- {#if footer} - - {/if} - -