custom popover height and sidebar styling

This commit is contained in:
Peter Clement 2023-02-22 12:31:04 +00:00
parent 6681853acf
commit ffee41aea3
8 changed files with 63 additions and 12 deletions

View File

@ -15,6 +15,7 @@
export let sort = false export let sort = false
export let autoWidth = false export let autoWidth = false
export let fetchTerm = null export let fetchTerm = null
export let customPopoverHeight
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -91,4 +92,5 @@
onSelectOption={toggleOption} onSelectOption={toggleOption}
{sort} {sort}
{autoWidth} {autoWidth}
{customPopoverHeight}
/> />

View File

@ -32,6 +32,7 @@
export let autocomplete = false export let autocomplete = false
export let sort = false export let sort = false
export let fetchTerm = null export let fetchTerm = null
export let customPopoverHeight
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let searchTerm = null let searchTerm = null
@ -136,6 +137,7 @@
on:close={() => (open = false)} on:close={() => (open = false)}
useAnchorWidth={!autoWidth} useAnchorWidth={!autoWidth}
maxWidth={autoWidth ? 400 : null} maxWidth={autoWidth ? 400 : null}
customHeight={customPopoverHeight}
> >
<div <div
class="popover-content" class="popover-content"
@ -266,6 +268,7 @@
.popover-content :global(.spectrum-Search) { .popover-content :global(.spectrum-Search) {
margin-top: -1px; margin-top: -1px;
margin-left: -1px; margin-left: -1px;
width: calc(100% + 2px);
} }
.popover-content :global(.spectrum-Search input) { .popover-content :global(.spectrum-Search input) {
height: auto; height: auto;

View File

@ -17,6 +17,7 @@
export let autoWidth = false export let autoWidth = false
export let autocomplete = false export let autocomplete = false
export let fetchTerm = null export let fetchTerm = null
export let customPopoverHeight
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = e => { const onChange = e => {
@ -38,6 +39,7 @@
{getOptionValue} {getOptionValue}
{autoWidth} {autoWidth}
{autocomplete} {autocomplete}
{customPopoverHeight}
bind:fetchTerm bind:fetchTerm
on:change={onChange} on:change={onChange}
on:click on:click

View File

@ -21,6 +21,7 @@
export let sort = false export let sort = false
export let tooltip = "" export let tooltip = ""
export let autocomplete = false export let autocomplete = false
export let customPopoverHeight
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = e => { const onChange = e => {
@ -53,6 +54,7 @@
{getOptionColour} {getOptionColour}
{isOptionEnabled} {isOptionEnabled}
{autocomplete} {autocomplete}
{customPopoverHeight}
on:change={onChange} on:change={onChange}
on:click on:click
/> />

View File

@ -18,6 +18,7 @@
export let useAnchorWidth = false export let useAnchorWidth = false
export let dismissible = true export let dismissible = true
export let offset = 5 export let offset = 5
export let customHeight
$: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum" $: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
@ -74,6 +75,7 @@
on:keydown={handleEscape} on:keydown={handleEscape}
class="spectrum-Popover is-open" class="spectrum-Popover is-open"
role="presentation" role="presentation"
style="height: {customHeight}"
transition:fly|local={{ y: -20, duration: 200 }} transition:fly|local={{ y: -20, duration: 200 }}
> >
<slot /> <slot />

View File

@ -2,4 +2,4 @@
export let value export let value
</script> </script>
<div>{value?.name || "N/A"}</div> <div>{value?.name || ""}</div>

View File

@ -18,11 +18,11 @@
on:focus={() => (showTooltip = true)} on:focus={() => (showTooltip = true)}
on:mouseleave={() => (showTooltip = false)} on:mouseleave={() => (showTooltip = false)}
> >
<Avatar size="M" initials={getInitials(row.user)} /> <Avatar size="M" initials={getInitials(row?.user)} />
</div> </div>
{#if showTooltip} {#if showTooltip}
<div class="tooltip"> <div class="tooltip">
<Tooltip textWrapping text={row.user.email} direction="bottom" /> <Tooltip textWrapping text={row?.user.email} direction="bottom" />
</div> </div>
{/if} {/if}

View File

@ -10,6 +10,7 @@
CoreTextArea, CoreTextArea,
DatePicker, DatePicker,
Pagination, Pagination,
Helpers,
Divider, Divider,
} from "@budibase/bbui" } from "@budibase/bbui"
import { licensing, users, apps, auditLogs } from "stores/portal" import { licensing, users, apps, auditLogs } from "stores/portal"
@ -185,6 +186,11 @@
viewDetails, viewDetails,
}) })
const copyToClipboard = async value => {
await Helpers.copyToClipboard(value)
notifications.success("Copied")
}
onMount(async () => { onMount(async () => {
await auditLogs.getEventDefinitions() await auditLogs.getEventDefinitions()
}) })
@ -246,6 +252,7 @@
</div> </div>
<div class="select"> <div class="select">
<Multiselect <Multiselect
customPopoverHeight="500px"
autocomplete autocomplete
getOptionValue={event => event[0]} getOptionValue={event => event[0]}
getOptionLabel={event => event[1]} getOptionLabel={event => event[1]}
@ -318,6 +325,12 @@
<Divider /> <Divider />
<div class="side-panel-body"> <div class="side-panel-body">
<div
on:click={() => copyToClipboard(JSON.stringify(selectedLog.metadata))}
class="copy-icon"
>
<Icon name="Copy" size="S" />
</div>
<CoreTextArea <CoreTextArea
disabled disabled
minHeight={"300px"} minHeight={"300px"}
@ -329,6 +342,34 @@
{/if} {/if}
<style> <style>
.copy-icon {
right: 16px;
top: 80px;
z-index: 10;
justify-content: center;
align-items: center;
display: flex;
flex-direction: row;
box-sizing: border-box;
border: 1px solid var(--spectrum-alias-border-color);
border-radius: var(--spectrum-alias-border-radius-regular);
width: 31px;
color: var(--spectrum-alias-text-color);
background-color: var(--spectrum-global-color-gray-75);
transition: background-color
var(--spectrum-global-animation-duration-100, 130ms),
box-shadow var(--spectrum-global-animation-duration-100, 130ms),
border-color var(--spectrum-global-animation-duration-100, 130ms);
height: calc(var(--spectrum-alias-item-height-m) - 2px);
position: absolute;
}
.copy-icon:hover {
cursor: pointer;
color: var(--spectrum-alias-text-color-hover);
background-color: var(--spectrum-global-color-gray-50);
border-color: var(--spectrum-alias-border-color-hover);
}
.side-panel-header { .side-panel-header {
display: flex; display: flex;
padding: 20px 10px 10px 10px; padding: 20px 10px 10px 10px;
@ -346,7 +387,7 @@
.side-panel-body { .side-panel-body {
padding: 10px; padding: 10px;
height: 95%; height: calc(100% - 67px);
} }
#side-panel { #side-panel {
position: absolute; position: absolute;
@ -357,11 +398,11 @@
border-left: var(--border-light); border-left: var(--border-light);
width: 320px; width: 320px;
max-width: calc(100vw - 48px - 48px); max-width: calc(100vw - 48px - 48px);
overflow: auto;
overflow-x: hidden;
transform: translateX(100%); transform: translateX(100%);
transition: transform 130ms ease-in-out; transition: transform 130ms ease-in-out;
height: calc(100% - 25px); height: calc(100% - 24px);
overflow-y: hidden;
overflow-x: hidden;
z-index: 2; z-index: 2;
} }
#side-panel.visible { #side-panel.visible {
@ -373,15 +414,14 @@
} }
#side-panel :global(textarea) { #side-panel :global(textarea) {
min-height: 202px !important; min-height: 100% !important;
background-color: var( background-color: var(
--spectrum-textfield-m-background-color, --spectrum-textfield-m-background-color,
var(--spectrum-global-color-gray-50) var(--spectrum-global-color-gray-50)
); );
color: var( padding-top: var(--spacing-l);
--spectrum-textfield-m-text-color, padding-left: var(--spacing-l);
var(--spectrum-alias-text-color) font-size: 13px;
);
} }
.search :global(.spectrum-InputGroup) { .search :global(.spectrum-InputGroup) {