mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 14:14:57 +00:00
Add JSON page routing support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pagesConfig from './pages.json'
|
||||
import { PageSchema } from '@/types/json-ui'
|
||||
import { FeatureToggles } from '@/types/project'
|
||||
|
||||
export interface PropConfig {
|
||||
@@ -23,7 +24,10 @@ export interface PageConfig {
|
||||
id: string
|
||||
title: string
|
||||
icon: string
|
||||
component: string
|
||||
component?: string
|
||||
type?: 'json' | 'component'
|
||||
schemaPath?: string
|
||||
schema?: PageSchema
|
||||
enabled: boolean
|
||||
isRoot?: boolean
|
||||
toggleKey?: string
|
||||
|
||||
@@ -57,7 +57,9 @@ export function validatePageConfig(): ValidationError[] {
|
||||
})
|
||||
}
|
||||
|
||||
if (!page.component) {
|
||||
const isJsonPage = page.type === 'json' || Boolean(page.schemaPath)
|
||||
|
||||
if (!page.component && !isJsonPage) {
|
||||
errors.push({
|
||||
page: page.id || 'Unknown',
|
||||
field: 'component',
|
||||
@@ -66,6 +68,15 @@ export function validatePageConfig(): ValidationError[] {
|
||||
})
|
||||
}
|
||||
|
||||
if (isJsonPage && !page.schemaPath && !page.schema) {
|
||||
errors.push({
|
||||
page: page.id || 'Unknown',
|
||||
field: 'schemaPath',
|
||||
message: 'schemaPath is required for JSON pages',
|
||||
severity: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
if (!page.icon) {
|
||||
errors.push({
|
||||
page: page.id || 'Unknown',
|
||||
|
||||
Reference in New Issue
Block a user