1
0
Fork 0
mirror of synced 2024-09-20 11:27:56 +12:00

Add bespoke component for selecting users in table conditions

This commit is contained in:
Andrew Kingston 2024-07-22 09:58:59 +01:00
parent e4cd71feab
commit 6fd265776d
No known key found for this signature in database
2 changed files with 12 additions and 6 deletions

View file

@ -9,19 +9,16 @@
Icon, Icon,
DatePicker, DatePicker,
Combobox, Combobox,
Multiselect,
} from "@budibase/bbui" } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { cloneDeep } from "lodash" import { cloneDeep } from "lodash"
import ColorPicker from "./ColorPicker.svelte" import ColorPicker from "./ColorPicker.svelte"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import { QueryUtils, Constants } from "@budibase/frontend-core" import { QueryUtils, Constants, FilterUsers } from "@budibase/frontend-core"
import { generate } from "shortid" import { generate } from "shortid"
import { FieldType, FormulaType } from "@budibase/types" import { FieldType, FormulaType } from "@budibase/types"
import { dndzone } from "svelte-dnd-action" import { dndzone } from "svelte-dnd-action"
import { flip } from "svelte/animate" import { flip } from "svelte/animate"
import { getDatasourceForProvider } from "dataBinding"
import { selectedScreen } from "stores/builder"
export let componentInstance export let componentInstance
export let bindings export let bindings
@ -66,8 +63,6 @@
// on the page, so adding this ensures formula columns get operators // on the page, so adding this ensures formula columns get operators
formulaType: FormulaType.STATIC, formulaType: FormulaType.STATIC,
}) })
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
$: console.log(componentInstance)
const getValueTypeOptions = type => { const getValueTypeOptions = type => {
let options = [ let options = [
@ -235,6 +230,16 @@
?.constraints?.inclusion || []} ?.constraints?.inclusion || []}
bind:value={condition.referenceValue} bind:value={condition.referenceValue}
/> />
{:else if (type === FieldType.BB_REFERENCE || type === FieldType.BB_REFERENCE_SINGLE) && condition.valueType === type}
<FilterUsers
bind:value={condition.referenceValue}
multiselect={[
Constants.OperatorOptions.In.value,
Constants.OperatorOptions.ContainsAny.value,
].includes(condition.operator)}
disabled={condition.noValue}
type={condition.valueType}
/>
{:else} {:else}
<DrawerBindableInput <DrawerBindableInput
{bindings} {bindings}

View file

@ -8,3 +8,4 @@ export { default as Updating } from "./Updating.svelte"
export { Grid } from "./grid" export { Grid } from "./grid"
export { default as ClientAppSkeleton } from "./ClientAppSkeleton.svelte" export { default as ClientAppSkeleton } from "./ClientAppSkeleton.svelte"
export { default as FilterBuilder } from "./FilterBuilder.svelte" export { default as FilterBuilder } from "./FilterBuilder.svelte"
export { default as FilterUsers } from "./FilterUsers.svelte"