use display to hide picker button instead of prop

This commit is contained in:
Peter Clement 2023-08-30 10:50:49 +01:00
parent 2aff73ac25
commit 84571e36c2
3 changed files with 69 additions and 65 deletions

View File

@ -92,7 +92,8 @@
</div> </div>
</FancyField> </FancyField>
<Picker <div id="picker-wrapper">
<Picker
customAnchor={wrapper} customAnchor={wrapper}
onlyPopover={true} onlyPopover={true}
bind:open bind:open
@ -108,9 +109,13 @@
placeholderOption={placeholder === false ? null : placeholder} placeholderOption={placeholder === false ? null : placeholder}
onSelectOption={onChange} onSelectOption={onChange}
isOptionSelected={option => option === value} isOptionSelected={option => option === value}
/> />
</div>
<style> <style>
#picker-wrapper :global(.spectrum-Picker) {
display: none;
}
.value { .value {
display: block; display: block;
flex: 1 1 auto; flex: 1 1 auto;

View File

@ -40,7 +40,6 @@
export let customPopoverHeight export let customPopoverHeight
export let align = "left" export let align = "left"
export let footer = null export let footer = null
export let onlyPopover = false
export let customAnchor = null export let customAnchor = null
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -91,8 +90,7 @@
} }
</script> </script>
{#if !onlyPopover} <button
<button
{id} {id}
class="spectrum-Picker spectrum-Picker--sizeM" class="spectrum-Picker spectrum-Picker--sizeM"
class:spectrum-Picker--quiet={quiet} class:spectrum-Picker--quiet={quiet}
@ -102,7 +100,7 @@
aria-haspopup="listbox" aria-haspopup="listbox"
on:click={onClick} on:click={onClick}
bind:this={button} bind:this={button}
> >
{#if fieldIcon} {#if fieldIcon}
{#if !useOptionIconImage}x {#if !useOptionIconImage}x
<span class="option-extra icon"> <span class="option-extra icon">
@ -143,10 +141,9 @@
> >
<use xlink:href="#spectrum-css-icon-Chevron100" /> <use xlink:href="#spectrum-css-icon-Chevron100" />
</svg> </svg>
</button> </button>
{/if}
<Popover <Popover
anchor={!onlyPopover ? button : customAnchor} anchor={customAnchor ? customAnchor : button}
align={align || "left"} align={align || "left"}
bind:this={popover} bind:this={popover}
{open} {open}

View File

@ -253,6 +253,8 @@
notifications.error("A group must be specified") notifications.error("A group must be specified")
return return
} }
console.log(group)
console.log(role)
try { try {
if (group?.builder?.apps.includes(prodAppId)) { if (group?.builder?.apps.includes(prodAppId)) {
await removeGroupAppBuilder(group._id) await removeGroupAppBuilder(group._id)