mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
Re-export JSON UI hooks
This commit is contained in:
@@ -46,7 +46,7 @@ Replaced all imports of `@github/spark/hooks` with the local `@/hooks/use-kv` im
|
||||
|
||||
### Config Files
|
||||
- `src/config/orchestration/data-source-manager.ts`
|
||||
- `src/lib/json-ui/hooks.ts`
|
||||
- `src/lib/json-ui/hooks.ts` (re-exported via `@/lib/json-ui`)
|
||||
|
||||
## Change Pattern
|
||||
All instances of:
|
||||
|
||||
@@ -27,7 +27,7 @@ Successfully implemented a comprehensive JSON-driven UI system that allows build
|
||||
- Array looping for lists
|
||||
- Form rendering with validation
|
||||
|
||||
- **hooks.ts**: React hooks for data management
|
||||
- **hooks.ts**: React hooks for data management (import from `@/lib/json-ui`)
|
||||
- `useJSONDataSource`: Single data source management (KV, API, static, computed)
|
||||
- `useJSONDataSources`: Multiple data sources orchestration
|
||||
- `useJSONActions`: Action registration and execution
|
||||
|
||||
@@ -275,6 +275,12 @@ registerComponent('MyCustom', MyCustomComponent)
|
||||
|
||||
### Add Custom Data Source Types
|
||||
|
||||
Use the public entrypoint when consuming JSON UI hooks:
|
||||
|
||||
```typescript
|
||||
import { useJSONDataSource, useJSONDataSources, useJSONActions } from '@/lib/json-ui'
|
||||
```
|
||||
|
||||
Edit `/src/lib/json-ui/hooks.ts` to add new data source handlers.
|
||||
|
||||
### Add Custom Actions
|
||||
@@ -296,7 +302,7 @@ const handleAction = (handler: EventHandler, event?: any) => {
|
||||
- **Schema Definitions**: `/src/lib/json-ui/schema.ts`
|
||||
- **Component Registry**: `/src/lib/json-ui/component-registry.ts`
|
||||
- **Renderer**: `/src/lib/json-ui/renderer.tsx`
|
||||
- **Hooks**: `/src/lib/json-ui/hooks.ts`
|
||||
- **Hooks**: Import from `@/lib/json-ui` (source: `/src/lib/json-ui/hooks.ts`)
|
||||
- **Utils**: `/src/lib/json-ui/utils.ts`
|
||||
- **Examples**: `/src/config/ui-examples/`
|
||||
- **Demo Page**: `/src/components/JSONUIShowcase.tsx`
|
||||
|
||||
@@ -226,6 +226,14 @@ const component: UIComponent = {
|
||||
}
|
||||
```
|
||||
|
||||
### Hooks
|
||||
|
||||
Consume JSON UI data hooks from the public entrypoint:
|
||||
|
||||
```typescript
|
||||
import { useJSONDataSource, useJSONDataSources, useJSONActions } from '@/lib/json-ui'
|
||||
```
|
||||
|
||||
## 📦 Exports
|
||||
|
||||
```typescript
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export { JSONUIRenderer, JSONFormRenderer } from './renderer'
|
||||
export { getUIComponent, uiComponentRegistry, registerComponent } from './component-registry'
|
||||
export * from './hooks'
|
||||
export * from './schema'
|
||||
export * from './utils'
|
||||
export * from './validator'
|
||||
|
||||
Reference in New Issue
Block a user