mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
Fix Promise await issues and add sx prop to fakemui components
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -117,7 +117,8 @@ function generateEntityInterface(entity) {
|
||||
|
||||
output += `export interface ${interfaceName} {\n`
|
||||
output += fields.join('\n')
|
||||
output += '\n}\n'
|
||||
output += '\n [key: string]: unknown // Allow additional properties for DBAL compatibility\n'
|
||||
output += '}\n'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface TypographyProps extends React.HTMLAttributes<HTMLElement> {
|
||||
gutterBottom?: boolean
|
||||
noWrap?: boolean
|
||||
as?: React.ElementType
|
||||
sx?: Record<string, unknown> // MUI sx prop for styling compatibility
|
||||
}
|
||||
|
||||
export const Typography: React.FC<TypographyProps> = ({
|
||||
@@ -21,6 +22,7 @@ export const Typography: React.FC<TypographyProps> = ({
|
||||
noWrap,
|
||||
className = '',
|
||||
as,
|
||||
sx,
|
||||
...props
|
||||
}) => {
|
||||
const Tag =
|
||||
|
||||
@@ -42,6 +42,8 @@ export interface FormControlProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
filled?: boolean
|
||||
/** Whether the input is focused */
|
||||
focused?: boolean
|
||||
/** MUI sx prop for styling compatibility */
|
||||
sx?: Record<string, unknown>
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +72,7 @@ export const FormControl = forwardRef<HTMLDivElement, FormControlProps>(
|
||||
filled = false,
|
||||
focused = false,
|
||||
className = '',
|
||||
sx,
|
||||
...props
|
||||
},
|
||||
ref
|
||||
|
||||
@@ -4,10 +4,11 @@ export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElemen
|
||||
children?: React.ReactNode
|
||||
sm?: boolean
|
||||
error?: boolean
|
||||
sx?: Record<string, unknown> // MUI sx prop for styling compatibility
|
||||
}
|
||||
|
||||
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
||||
({ children, sm, error, className = '', ...props }, ref) => (
|
||||
({ children, sm, error, className = '', sx, ...props }, ref) => (
|
||||
<select
|
||||
ref={ref}
|
||||
className={`select ${sm ? 'select--sm' : ''} ${error ? 'select--error' : ''} ${className}`}
|
||||
|
||||
@@ -3,10 +3,11 @@ import React, { forwardRef } from 'react'
|
||||
export interface BoxProps extends React.HTMLAttributes<HTMLElement> {
|
||||
children?: React.ReactNode
|
||||
component?: React.ElementType
|
||||
sx?: Record<string, unknown> // MUI sx prop for styling compatibility
|
||||
}
|
||||
|
||||
export const Box = forwardRef<HTMLElement, BoxProps>(
|
||||
({ children, component: Component = 'div', className = '', ...props }, ref) => (
|
||||
({ children, component: Component = 'div', className = '', sx, ...props }, ref) => (
|
||||
<Component ref={ref} className={className} {...props}>
|
||||
{children}
|
||||
</Component>
|
||||
|
||||
@@ -24,6 +24,7 @@ export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
||||
disabled?: boolean
|
||||
renderItem?: (item: PaginationRenderItemParams) => React.ReactNode
|
||||
getItemAriaLabel?: (type: string, page: number, selected: boolean) => string
|
||||
sx?: Record<string, unknown> // MUI sx prop for styling compatibility
|
||||
}
|
||||
|
||||
export const Pagination: React.FC<PaginationProps> = ({
|
||||
@@ -44,6 +45,7 @@ export const Pagination: React.FC<PaginationProps> = ({
|
||||
renderItem,
|
||||
getItemAriaLabel,
|
||||
className = '',
|
||||
sx,
|
||||
...props
|
||||
}) => {
|
||||
const generateItems = (): PaginationRenderItemParams[] => {
|
||||
|
||||
@@ -114,7 +114,7 @@ export default async function EntityPage({ params }: EntityPageProps) {
|
||||
|
||||
import type { EntitySchema } from '@/lib/entities/load-entity-schema'
|
||||
|
||||
function EntityListView({ tenant, pkg, entity, schema }: {
|
||||
async function EntityListView({ tenant, pkg, entity, schema }: {
|
||||
tenant: string
|
||||
pkg: string
|
||||
entity: string
|
||||
@@ -123,7 +123,7 @@ function EntityListView({ tenant, pkg, entity, schema }: {
|
||||
const apiUrl = `/api/v1/${tenant}/${pkg}/${entity}`
|
||||
|
||||
// Fetch entity list
|
||||
const response = fetchEntityList(tenant, pkg, entity)
|
||||
const response = await fetchEntityList(tenant, pkg, entity)
|
||||
|
||||
return (
|
||||
<div className="entity-list">
|
||||
@@ -204,7 +204,7 @@ function EntityListView({ tenant, pkg, entity, schema }: {
|
||||
)
|
||||
}
|
||||
|
||||
function EntityDetailView({ tenant, pkg, entity, id, schema }: {
|
||||
async function EntityDetailView({ tenant, pkg, entity, id, schema }: {
|
||||
tenant: string
|
||||
pkg: string
|
||||
entity: string
|
||||
@@ -214,7 +214,7 @@ function EntityDetailView({ tenant, pkg, entity, id, schema }: {
|
||||
const apiUrl = `/api/v1/${tenant}/${pkg}/${entity}/${id}`
|
||||
|
||||
// Fetch entity data
|
||||
const response = fetchEntity(tenant, pkg, entity, id)
|
||||
const response = await fetchEntity(tenant, pkg, entity, id)
|
||||
|
||||
return (
|
||||
<div className="entity-detail">
|
||||
@@ -326,7 +326,7 @@ function EntityCreateView({ tenant, pkg, entity, schema }: {
|
||||
)
|
||||
}
|
||||
|
||||
function EntityEditView({ tenant, pkg, entity, id, schema }: {
|
||||
async function EntityEditView({ tenant, pkg, entity, id, schema }: {
|
||||
tenant: string
|
||||
pkg: string
|
||||
entity: string
|
||||
@@ -336,7 +336,7 @@ function EntityEditView({ tenant, pkg, entity, id, schema }: {
|
||||
const apiUrl = `/api/v1/${tenant}/${pkg}/${entity}/${id}`
|
||||
|
||||
// Fetch entity data
|
||||
const response = fetchEntity(tenant, pkg, entity, id)
|
||||
const response = await fetchEntity(tenant, pkg, entity, id)
|
||||
|
||||
return (
|
||||
<div className="entity-edit">
|
||||
|
||||
Reference in New Issue
Block a user