Type anys

This commit is contained in:
Adria Navarro 2025-03-03 22:38:00 +01:00
parent 8de7661289
commit 7623dcd30a
1 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { CoreSelect, CoreMultiselect } from "@budibase/bbui" import { CoreSelect, CoreMultiselect } from "@budibase/bbui"
import { FieldType, InternalTable } from "@budibase/types" import { BasicOperator, FieldType, InternalTable } from "@budibase/types"
import { fetchData, Utils } from "@budibase/frontend-core" import { fetchData, Utils } from "@budibase/frontend-core"
import { getContext } from "svelte" import { getContext } from "svelte"
import Field from "./Field.svelte" import Field from "./Field.svelte"
@ -9,10 +9,11 @@
RelationshipFieldMetadata, RelationshipFieldMetadata,
Row, Row,
} from "@budibase/types" } from "@budibase/types"
import { FieldApi } from "."
export let field: string | undefined = undefined export let field: string | undefined = undefined
export let label: string | undefined = undefined export let label: string | undefined = undefined
export let placeholder: any = undefined export let placeholder: string | undefined = undefined
export let disabled: boolean = false export let disabled: boolean = false
export let readonly: boolean = false export let readonly: boolean = false
export let validation: any export let validation: any
@ -35,12 +36,20 @@
const { API } = getContext("sdk") const { API } = getContext("sdk")
// Field state // Field state
let fieldState: any let fieldState:
let fieldApi: any | {
value: string | string[]
fieldId: string
disabled: boolean
readonly: boolean
}
| undefined
let fieldApi: FieldApi
let fieldSchema: RelationshipFieldMetadata | undefined let fieldSchema: RelationshipFieldMetadata | undefined
// Local UI state // Local UI state
let searchTerm: any let searchTerm: string
let open: boolean = false let open: boolean = false
// Options state // Options state
@ -306,14 +315,14 @@
} }
// Ensure we match all filters, rather than any // Ensure we match all filters, rather than any
let newFilter: any = filter let newFilter = filter
if (searchTerm) { if (searchTerm) {
// @ts-expect-error this doesn't fit types, but don't want to change it yet // @ts-expect-error this doesn't fit types, but don't want to change it yet
newFilter = (newFilter || []).filter(x => x.operator !== "allOr") newFilter = (newFilter || []).filter(x => x.operator !== "allOr")
newFilter.push({ newFilter.push({
// Use a big numeric prefix to avoid clashing with an existing filter // Use a big numeric prefix to avoid clashing with an existing filter
field: `999:${primaryDisplay}`, field: `999:${primaryDisplay}`,
operator: "string", operator: BasicOperator.STRING,
value: searchTerm, value: searchTerm,
}) })
} }