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

Add options picker for values when configuring conditions on options columns

This commit is contained in:
Andrew Kingston 2024-07-22 09:35:36 +01:00
parent d774e30a0a
commit 26a552ac5c
No known key found for this signature in database
3 changed files with 18 additions and 7 deletions

View file

@ -10,7 +10,6 @@
export let componentBindings export let componentBindings
export let bindings export let bindings
export let parseSettings export let parseSettings
export let disabled
const draggable = getContext("draggable") const draggable = getContext("draggable")
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()

View file

@ -108,12 +108,12 @@ const getColumns = ({
createComponent, createComponent,
schema schema
) )
const primary = draggableList.find( const primary = draggableList
entry => entry.field === primaryDisplayColumnName .filter(entry => entry.field === primaryDisplayColumnName)
) .map(instance => ({ ...instance, schema }))[0]
const sortable = draggableList.filter( const sortable = draggableList
entry => entry.field !== primaryDisplayColumnName .filter(entry => entry.field !== primaryDisplayColumnName)
) .map(instance => ({ ...instance, schema }))
return { return {
primary, primary,

View file

@ -8,6 +8,7 @@
Select, Select,
Icon, Icon,
DatePicker, DatePicker,
Combobox,
} from "@budibase/bbui" } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { cloneDeep } from "lodash" import { cloneDeep } from "lodash"
@ -18,6 +19,8 @@
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
@ -62,6 +65,8 @@
// 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 = [
@ -222,6 +227,13 @@
options={["True", "False"]} options={["True", "False"]}
bind:value={condition.referenceValue} bind:value={condition.referenceValue}
/> />
{:else if type === FieldType.OPTIONS && condition.valueType === type}
<Combobox
disabled={condition.noValue}
options={componentInstance.schema?.[componentInstance.field]
?.constraints?.inclusion || []}
bind:value={condition.referenceValue}
/>
{:else} {:else}
<DrawerBindableInput <DrawerBindableInput
{bindings} {bindings}