From dc0f16747e63d59d53a9121ff064cf608ac1d037 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 24 Dec 2024 14:17:42 +0100 Subject: [PATCH] Types --- .../src/components/grid/stores/filter.ts | 13 +++++++++---- packages/types/src/ui/stores/grid/columns.ts | 2 +- packages/types/src/ui/stores/grid/filters.ts | 10 ++++++++++ packages/types/src/ui/stores/grid/index.ts | 1 + 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 packages/types/src/ui/stores/grid/filters.ts diff --git a/packages/frontend-core/src/components/grid/stores/filter.ts b/packages/frontend-core/src/components/grid/stores/filter.ts index 4061ee04d7..b9f54fefb8 100644 --- a/packages/frontend-core/src/components/grid/stores/filter.ts +++ b/packages/frontend-core/src/components/grid/stores/filter.ts @@ -1,11 +1,16 @@ 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 { memo } from "../../../utils/memo" export interface FilterStore { filter: Writable - inlineFilters: Writable + inlineFilters: Writable } export interface FilterDerivedStore { @@ -63,10 +68,10 @@ export const deriveStores = (context: StoreContext) => { export const createActions = (context: StoreContext) => { const { filter, inlineFilters } = context - const addInlineFilter = (column, value) => { + const addInlineFilter = (column: UIColumn, value: string) => { const filterId = `inline-${column.name}` const type = column.schema.type - let inlineFilter = { + const inlineFilter: UIInlineFilter = { field: column.name, id: filterId, operator: "string", diff --git a/packages/types/src/ui/stores/grid/columns.ts b/packages/types/src/ui/stores/grid/columns.ts index d12739fffe..a8be3b21b4 100644 --- a/packages/types/src/ui/stores/grid/columns.ts +++ b/packages/types/src/ui/stores/grid/columns.ts @@ -9,7 +9,7 @@ export type UIColumn = FieldSchema & { subField: string } primaryDisplay?: boolean - schema?: { + schema: { disabled: boolean type: FieldType readonly: boolean diff --git a/packages/types/src/ui/stores/grid/filters.ts b/packages/types/src/ui/stores/grid/filters.ts new file mode 100644 index 0000000000..3912a40f87 --- /dev/null +++ b/packages/types/src/ui/stores/grid/filters.ts @@ -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 +} diff --git a/packages/types/src/ui/stores/grid/index.ts b/packages/types/src/ui/stores/grid/index.ts index b6a152ed73..aa68c3f207 100644 --- a/packages/types/src/ui/stores/grid/index.ts +++ b/packages/types/src/ui/stores/grid/index.ts @@ -3,3 +3,4 @@ export * from "./datasource" export * from "./table" export * from "./view" export * from "./user" +export * from "./filters"