diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 97bd1394b4..63f07b7cd6 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -88,8 +88,8 @@ on:click={onClick} > {#if fieldIcon} - - + + {/if} {#if fieldColour} @@ -168,8 +168,8 @@ class:is-disabled={!isOptionEnabled(option)} > {#if getOptionIcon(option, idx)} - - + + {/if} {#if getOptionColour(option, idx)} @@ -241,6 +241,9 @@ .option-extra { padding-right: 8px; } + .option-extra.icon { + margin: 0 -1px; + } .spectrum-Popover :global(.spectrum-Search) { margin-top: -1px; diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index cec270486a..3a4446b5b1 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -21,6 +21,8 @@ * template: a HBS or JS binding to use as the value * background: the background color * color: the text color + * borderLeft: show a left border + * borderRight: show a right border */ export let data = [] export let schema = {} @@ -270,6 +272,14 @@ if (schema[field].align === "Right") { styles[field] += "justify-content: flex-end; text-align: right;" } + if (schema[field].borderLeft) { + styles[field] += + "border-left: 1px solid var(--spectrum-global-color-gray-200);" + } + if (schema[field].borderLeft) { + styles[field] += + "border-right: 1px solid var(--spectrum-global-color-gray-200);" + } }) return styles } diff --git a/packages/builder/src/components/common/RoleSelect.svelte b/packages/builder/src/components/common/RoleSelect.svelte index aa39e5cb60..645e82c8ba 100644 --- a/packages/builder/src/components/common/RoleSelect.svelte +++ b/packages/builder/src/components/common/RoleSelect.svelte @@ -2,6 +2,7 @@ import { Select } from "@budibase/bbui" import { roles } from "stores/backend" import { Constants, RoleUtils } from "@budibase/frontend-core" + import { createEventDispatcher } from "svelte" export let value export let error @@ -9,26 +10,62 @@ export let autoWidth = false export let quiet = false export let allowPublic = true + export let allowRemove = false - $: options = getOptions($roles, allowPublic) + const dispatch = createEventDispatcher() + const RemoveID = "remove" + + $: options = getOptions($roles, allowPublic, allowRemove) const getOptions = (roles, allowPublic) => { + if (allowRemove) { + roles = [ + ...roles, + { + _id: RemoveID, + name: "Remove", + }, + ] + } if (allowPublic) { return roles } return roles.filter(role => role._id !== Constants.Roles.PUBLIC) } + + const getColor = role => { + if (allowRemove && role._id === RemoveID) { + return null + } + return RoleUtils.getRoleColour(role._id) + } + + const getIcon = role => { + if (allowRemove && role._id === RemoveID) { + return "Close" + } + return null + } + + const onChange = e => { + if (allowRemove && e.detail === RemoveID) { + dispatch("remove") + } else { + dispatch("change", e.detail) + } + }