Merge branch 'master' into budi-8957-date-filter-equals-does-not-work

This commit is contained in:
Michael Drury 2025-01-10 14:21:56 +00:00 committed by GitHub
commit 8230a5de6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 33 additions and 47 deletions

View File

@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "3.2.37",
"version": "3.2.38",
"npmClient": "yarn",
"concurrency": 20,
"command": {

View File

@ -31,7 +31,7 @@ const getDatasourceFetchInstance = datasource => {
if (!handler) {
return null
}
return new handler({ API })
return new handler({ API, datasource })
}
/**
@ -52,7 +52,7 @@ export const fetchDatasourceSchema = async (
// Get the normal schema as long as we aren't wanting a form schema
let schema
if (datasource?.type !== "query" || !options?.formSchema) {
schema = instance.getSchema(datasource, definition)
schema = instance.getSchema(definition)
} else if (definition.parameters?.length) {
schema = {}
definition.parameters.forEach(param => {

View File

@ -1,4 +1,4 @@
import { FieldType } from "@budibase/types"
import { FieldType, UIColumn } from "@budibase/types"
import OptionsCell from "../cells/OptionsCell.svelte"
import DateCell from "../cells/DateCell.svelte"
@ -40,13 +40,23 @@ const TypeComponentMap = {
// Custom types for UI only
role: RoleCell,
}
export const getCellRenderer = column => {
function getCellRendererByType(type: FieldType | "role" | undefined) {
if (!type) {
return
}
return TypeComponentMap[type as keyof typeof TypeComponentMap]
}
export const getCellRenderer = (column: UIColumn) => {
if (column.calculationType) {
return NumberCell
}
return (
TypeComponentMap[column?.schema?.cellRenderType] ||
TypeComponentMap[column?.schema?.type] ||
getCellRendererByType(column.schema?.cellRenderType) ||
getCellRendererByType(column.schema?.type) ||
TextCell
)
}

View File

@ -1,32 +0,0 @@
// TODO: remove when all stores are typed
import { GeneratedIDPrefix, CellIDSeparator } from "./constants"
import { Helpers } from "@budibase/bbui"
export const parseCellID = cellId => {
if (!cellId) {
return { rowId: undefined, field: undefined }
}
const parts = cellId.split(CellIDSeparator)
const field = parts.pop()
return { rowId: parts.join(CellIDSeparator), field }
}
export const getCellID = (rowId, fieldName) => {
return `${rowId}${CellIDSeparator}${fieldName}`
}
export const parseEventLocation = e => {
return {
x: e.clientX ?? e.touches?.[0]?.clientX,
y: e.clientY ?? e.touches?.[0]?.clientY,
}
}
export const generateRowID = () => {
return `${GeneratedIDPrefix}${Helpers.uuid()}`
}
export const isGeneratedRowID = id => {
return id?.startsWith(GeneratedIDPrefix)
}

View File

@ -1,12 +1,14 @@
import { get } from "svelte/store"
import { createWebsocket } from "../../../utils"
import { SocketEvent, GridSocketEvent } from "@budibase/shared-core"
import { Store } from "../stores"
import { UIDatasource, UIUser } from "@budibase/types"
export const createGridWebsocket = context => {
export const createGridWebsocket = (context: Store) => {
const { rows, datasource, users, focusedCellId, definition, API } = context
const socket = createWebsocket("/socket/grid")
const connectToDatasource = datasource => {
const connectToDatasource = (datasource: UIDatasource) => {
if (!socket.connected) {
return
}
@ -18,7 +20,7 @@ export const createGridWebsocket = context => {
datasource,
appId,
},
({ users: gridUsers }) => {
({ users: gridUsers }: { users: UIUser[] }) => {
users.set(gridUsers)
}
)
@ -65,7 +67,7 @@ export const createGridWebsocket = context => {
GridSocketEvent.DatasourceChange,
({ datasource: newDatasource }) => {
// Listen builder renames, as these aren't handled otherwise
if (newDatasource?.name !== get(definition).name) {
if (newDatasource?.name !== get(definition)?.name) {
definition.set(newDatasource)
}
}

View File

@ -179,9 +179,6 @@ export default abstract class DataFetch<
this.store.update($store => ({ ...$store, loaded: true }))
return
}
// Initially fetch data but don't bother waiting for the result
this.getInitialData()
}
/**

View File

@ -33,7 +33,12 @@ const DataFetchMap = {
export const fetchData = ({ API, datasource, options }: any) => {
const Fetch =
DataFetchMap[datasource?.type as keyof typeof DataFetchMap] || TableFetch
return new Fetch({ API, datasource, ...options })
const fetch = new Fetch({ API, datasource, ...options })
// Initially fetch data but don't bother waiting for the result
fetch.getInitialData()
return fetch
}
// Creates an empty fetch instance with no datasource configured, so no data

View File

@ -209,6 +209,9 @@ export const buildFormBlockButtonConfig = props => {
{
"##eventHandlerType": "Close Side Panel",
},
{
"##eventHandlerType": "Close Modal",
},
...(actionUrl
? [

View File

@ -14,6 +14,7 @@ export type UIColumn = FieldSchema & {
type: FieldType
readonly: boolean
autocolumn: boolean
cellRenderType?: FieldType | "role"
}
calculationType: CalculationType
__idx: number