This commit is contained in:
Adria Navarro 2024-12-24 14:17:42 +01:00
parent c682a43d9a
commit dc0f16747e
4 changed files with 21 additions and 5 deletions

View File

@ -1,11 +1,16 @@
import { get, derived, Writable } from "svelte/store" import { get, derived, Writable } from "svelte/store"
import { FieldType, UILogicalOperator } from "@budibase/types" import {
FieldType,
UIColumn,
UIInlineFilter,
UILogicalOperator,
} from "@budibase/types"
import { Store as StoreContext } from "." import { Store as StoreContext } from "."
import { memo } from "../../../utils/memo" import { memo } from "../../../utils/memo"
export interface FilterStore { export interface FilterStore {
filter: Writable<any> filter: Writable<any>
inlineFilters: Writable<any> inlineFilters: Writable<UIInlineFilter[]>
} }
export interface FilterDerivedStore { export interface FilterDerivedStore {
@ -63,10 +68,10 @@ export const deriveStores = (context: StoreContext) => {
export const createActions = (context: StoreContext) => { export const createActions = (context: StoreContext) => {
const { filter, inlineFilters } = context const { filter, inlineFilters } = context
const addInlineFilter = (column, value) => { const addInlineFilter = (column: UIColumn, value: string) => {
const filterId = `inline-${column.name}` const filterId = `inline-${column.name}`
const type = column.schema.type const type = column.schema.type
let inlineFilter = { const inlineFilter: UIInlineFilter = {
field: column.name, field: column.name,
id: filterId, id: filterId,
operator: "string", operator: "string",

View File

@ -9,7 +9,7 @@ export type UIColumn = FieldSchema & {
subField: string subField: string
} }
primaryDisplay?: boolean primaryDisplay?: boolean
schema?: { schema: {
disabled: boolean disabled: boolean
type: FieldType type: FieldType
readonly: boolean readonly: boolean

View File

@ -0,0 +1,10 @@
import { FieldType } from "@budibase/types"
export interface UIInlineFilter {
field: string
type: FieldType
value: number | string
operator: string
id: string
valueType: string
}

View File

@ -3,3 +3,4 @@ export * from "./datasource"
export * from "./table" export * from "./table"
export * from "./view" export * from "./view"
export * from "./user" export * from "./user"
export * from "./filters"